Skip to content

Commit 1c2c7a3

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

File tree

2 files changed

+31
-23
lines changed

2 files changed

+31
-23
lines changed

pottery/__init__.py

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

26+
import importlib.metadata
27+
from typing import Final, Tuple
2628

27-
from typing import Tuple
2829

29-
# TODO: When we drop support for Python 3.7, change the following import to:
30-
# from typing import Final
31-
from typing_extensions import Final
3230

31+
metadata = importlib.metadata.metadata('pottery')
3332

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.'
33+
__title__: Final[str] = metadata['Name']
34+
__version__: Final[str] = metadata['Version']
35+
__description__: Final[str] = metadata['Summary']
36+
__url__: Final[str] = metadata['Home-page']
37+
__author__: Final[str] = metadata['Author']
38+
__author_email__: Final[str] = metadata['Author-email']
39+
__license__: Final[str] = metadata['License']
40+
__keywords__: Final[str] = metadata['Keywords']
41+
__copyright__: Final[str] = metadata['Copyright']
4342

4443

4544
from .monkey import PotteryEncoder # isort: skip

setup.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,35 @@
1818

1919
import pathlib
2020

21+
from typing import Final
2122
from setuptools import find_packages
2223
from setuptools import setup
2324

24-
import pottery
25-
2625

2726
_package_dir = pathlib.Path(__file__).parent
2827
_long_description = (_package_dir / 'README.md').read_text()
2928

3029

30+
__title__: Final[str] = 'pottery'
31+
__version__: Final[str] = '3.0.1rc1'
32+
__description__: Final[str] = 'Redis for Humans.'
33+
__url__: Final[str] = 'https://github.com/brainix/pottery'
34+
__author__: Final[str] = 'Rajiv Bakulesh Shah'
35+
__author_email__: Final[str] = 'brainix@gmail.com'
36+
__license__: Final[str] = 'Apache 2.0'
37+
__keywords__: Final[str] = 'Redis client persistent storage'
38+
__copyright__: Final[str] = f'Copyright © 2015-2022, {__author__}, original author.'
39+
3140
setup(
32-
name=pottery.__name__,
33-
version=pottery.__version__,
34-
description=pottery.__description__,
41+
name=__title__,
42+
version=__version__,
43+
description=__description__,
3544
long_description=_long_description,
3645
long_description_content_type='text/markdown',
37-
url=pottery.__url__,
38-
author=pottery.__author__,
39-
author_email=pottery.__author_email__,
40-
license=pottery.__license__,
46+
url=__url__,
47+
author= "Rajiv Bakulesh Shah",
48+
author_email=__author_email__,
49+
license=__license__,
4150
classifiers=[
4251
'License :: OSI Approved :: Apache Software License',
4352
'Intended Audience :: Developers',
@@ -55,7 +64,7 @@
5564
'Framework :: AsyncIO',
5665
'Typing :: Typed',
5766
],
58-
keywords=pottery.__keywords__,
67+
keywords=__keywords__,
5968
python_requires='>=3.9, <4',
6069
install_requires=('redis>=4.2.0rc1', 'mmh3', 'typing_extensions'),
6170
extras_require={},

0 commit comments

Comments
 (0)