Skip to content

Commit 1dc5903

Browse files
committed
fix(packaging): single-source version and drop obsolete setup.cfg
- setup.py now reads __version__ from currentsapi/__init__.py so the version can no longer drift between the two files. - Replace deprecated tests_require with an extras_require 'dev' extra. - Remove setup.cfg: description-file is deprecated and the universal wheel flag is wrong for a Python 3-only package (wheels now build as py3-none-any).
1 parent 6b32f00 commit 1dc5903

2 files changed

Lines changed: 20 additions & 10 deletions

File tree

‎setup.cfg‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎setup.py‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,37 @@
11
#!/usr/bin/env python
22

3+
import re
4+
from pathlib import Path
5+
36
from setuptools import setup, find_packages
47

5-
with open("README.md", "r") as fh:
8+
ROOT = Path(__file__).parent
9+
10+
with (ROOT / "README.md").open(encoding="utf-8") as fh:
611
long_description = fh.read()
712

13+
with (ROOT / "currentsapi" / "__init__.py").open(encoding="utf-8") as fh:
14+
version = re.search(r'^__version__ = "(.*?)"$', fh.read(), re.MULTILINE).group(1)
15+
816
install_requires = [
917
"requests>=2.25.0",
1018
"python-dateutil>=2.8.0",
1119
]
1220

13-
tests_require = [
14-
"pytest",
21+
extras_require = {
22+
"dev": [
23+
"pytest",
24+
],
25+
}
26+
27+
install_requires = [
28+
"requests>=2.25.0",
29+
"python-dateutil>=2.8.0",
1530
]
1631

1732
setup(
1833
name="currentsapi",
19-
version="0.1.0",
34+
version=version,
2035
author="Currents Dev",
2136
author_email="[email protected]",
2237
license="MIT",
@@ -25,7 +40,7 @@
2540
long_description=long_description,
2641
long_description_content_type="text/markdown",
2742
install_requires=install_requires,
28-
tests_require=tests_require,
43+
extras_require=extras_require,
2944
description="Official Python client for the Currents API",
3045
keywords=["currentsapi", "news", "wrapper", "currents", "api"],
3146
classifiers=[

0 commit comments

Comments
 (0)