Skip to content

Commit a59e750

Browse files
committed
build(setup.py): remove dependency on package to run setup.py
1 parent 78df8cf commit a59e750

File tree

2 files changed

+30
-20
lines changed

2 files changed

+30
-20
lines changed

pottery/__init__.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,25 @@
2323
been battle tested in production at scale.
2424
'''
2525

26-
26+
import importlib.metadata
2727
from typing import Tuple
2828

2929
# TODO: When we drop support for Python 3.7, change the following import to:
3030
# from typing import Final
3131
from typing_extensions import Final
3232

3333

34-
__title__: Final[str] = 'pottery'
35-
__version__: Final[str] = '3.0.0'
36-
__description__: Final[str] = __doc__.split(sep='\n\n', maxsplit=1)[0]
37-
__url__: Final[str] = 'https://github.com/brainix/pottery'
38-
__author__: Final[str] = 'Rajiv Bakulesh Shah'
39-
__author_email__: Final[str] = 'brainix@gmail.com'
40-
__license__: Final[str] = 'Apache 2.0'
41-
__keywords__: Final[str] = 'Redis client persistent storage'
42-
__copyright__: Final[str] = f'Copyright © 2015-2022, {__author__}, original author.'
34+
metadata = importlib.metadata.metadata('pottery')
35+
36+
__title__: Final[str] = metadata['Name']
37+
__version__: Final[str] = metadata['Version']
38+
__description__: Final[str] = metadata['Summary']
39+
__url__: Final[str] = metadata['Home-page']
40+
__author__: Final[str] = metadata['Author']
41+
__author_email__: Final[str] = metadata['Author-email']
42+
__license__: Final[str] = metadata['License']
43+
__keywords__: Final[str] = metadata['Keywords']
44+
__copyright__: Final[str] = metadata['Copyright']
4345

4446

4547
from .monkey import PotteryEncoder # isort: skip

setup.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,31 @@
2121
from setuptools import find_packages
2222
from setuptools import setup
2323

24-
import pottery
25-
2624

2725
_package_dir = pathlib.Path(__file__).parent
2826
_long_description = (_package_dir / 'README.md').read_text()
2927

3028

29+
__title__: Final[str] = 'pottery'
30+
__version__: Final[str] = '3.0.1rc1'
31+
__description__: Final[str] = 'Redis for Humans.'
32+
__url__: Final[str] = 'https://github.com/brainix/pottery'
33+
__author__: Final[str] = 'Rajiv Bakulesh Shah'
34+
__author_email__: Final[str] = 'brainix@gmail.com'
35+
__license__: Final[str] = 'Apache 2.0'
36+
__keywords__: Final[str] = 'Redis client persistent storage'
37+
__copyright__: Final[str] = f'Copyright © 2015-2022, {__author__}, original author.'
38+
3139
setup(
32-
name=pottery.__name__,
33-
version=pottery.__version__,
34-
description=pottery.__description__,
40+
name=__title__,
41+
version=__version__,
42+
description=__description__,
3543
long_description=_long_description,
3644
long_description_content_type='text/markdown',
37-
url=pottery.__url__,
38-
author=pottery.__author__,
39-
author_email=pottery.__author_email__,
40-
license=pottery.__license__,
45+
url=__url__,
46+
author= "Rajiv Bakulesh Shah",
47+
author_email=__author_email__,
48+
license=__license__,
4149
classifiers=[
4250
'License :: OSI Approved :: Apache Software License',
4351
'Intended Audience :: Developers',
@@ -55,7 +63,7 @@
5563
'Framework :: AsyncIO',
5664
'Typing :: Typed',
5765
],
58-
keywords=pottery.__keywords__,
66+
keywords=__keywords__,
5967
python_requires='>=3.9, <4',
6068
install_requires=('redis>=4.2.0rc1', 'mmh3', 'typing_extensions'),
6169
extras_require={},

0 commit comments

Comments
 (0)