Skip to content

Commit 7fab03a

Browse files
authored
Use setuptools setup.cfg declarative configuration (#1316)
For details on this feature, see: https://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files Setuptools allows using setup.cfg as a configuration file to define the package metadata and options. This approach reduces boilerplate code in favor of a declarative configuration. Down the road, this approach also allows for automation through scripts and tools.
1 parent 27ebfc4 commit 7fab03a

File tree

2 files changed

+35
-44
lines changed

2 files changed

+35
-44
lines changed

setup.cfg

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
1+
[metadata]
2+
name = redis
3+
version = attr: redis.__version__
4+
description = Python client for Redis key-value store
5+
long_description = file: README.rst
6+
url = https://github.com/andymccurdy/redis-py
7+
author = Andy McCurdy
8+
author_email = sedrik@gmail.com
9+
maintainer = Andy McCurdy
10+
maintainer_email = sedrik@gmail.com
11+
keywords = Redis, key-value store
12+
license = MIT
13+
classifiers =
14+
Development Status :: 5 - Production/Stable
15+
Environment :: Console
16+
Intended Audience :: Developers
17+
License :: OSI Approved :: MIT License
18+
Operating System :: OS Independent
19+
Programming Language :: Python
20+
Programming Language :: Python :: 2
21+
Programming Language :: Python :: 2.7
22+
Programming Language :: Python :: 3
23+
Programming Language :: Python :: 3.5
24+
Programming Language :: Python :: 3.6
25+
Programming Language :: Python :: 3.7
26+
Programming Language :: Python :: 3.8
27+
28+
[options]
29+
packages = redis
30+
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
31+
32+
[options.extras_require]
33+
hiredis = hiredis>=0.1.3
34+
135
[pycodestyle]
236
show-source = 1
337
exclude = .venv,.tox,dist,docs,build,*.egg,redis_install

setup.py

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,4 @@
11
#!/usr/bin/env python
2-
import os
32
from setuptools import setup
43

5-
from redis import __version__
6-
7-
8-
f = open(os.path.join(os.path.dirname(__file__), 'README.rst'))
9-
long_description = f.read()
10-
f.close()
11-
12-
setup(
13-
name='redis',
14-
version=__version__,
15-
description='Python client for Redis key-value store',
16-
long_description=long_description,
17-
long_description_content_type='text/x-rst',
18-
url='https://github.com/andymccurdy/redis-py',
19-
author='Andy McCurdy',
20-
author_email='sedrik@gmail.com',
21-
maintainer='Andy McCurdy',
22-
maintainer_email='sedrik@gmail.com',
23-
keywords=['Redis', 'key-value store'],
24-
license='MIT',
25-
packages=['redis'],
26-
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
27-
extras_require={
28-
'hiredis': [
29-
"hiredis>=0.1.3",
30-
],
31-
},
32-
classifiers=[
33-
'Development Status :: 5 - Production/Stable',
34-
'Environment :: Console',
35-
'Intended Audience :: Developers',
36-
'License :: OSI Approved :: MIT License',
37-
'Operating System :: OS Independent',
38-
'Programming Language :: Python',
39-
'Programming Language :: Python :: 2',
40-
'Programming Language :: Python :: 2.7',
41-
'Programming Language :: Python :: 3',
42-
'Programming Language :: Python :: 3.5',
43-
'Programming Language :: Python :: 3.6',
44-
'Programming Language :: Python :: 3.7',
45-
'Programming Language :: Python :: 3.8',
46-
]
47-
)
4+
setup()

0 commit comments

Comments
 (0)