Skip to content

Commit 850785c

Browse files
authored
Migrate packaging toward declarative setup.cfg (#6165)
1 parent 06e653d commit 850785c

File tree

3 files changed

+79
-87
lines changed

3 files changed

+79
-87
lines changed

CHANGES/6165.misc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Migrated the Python packaging setup to have static metadata
2+
in the declarative ``setup.cfg`` file — :user:`webknjaz`.

setup.cfg

+71
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,76 @@
11
[metadata]
2+
name = aiohttp
3+
version = attr: aiohttp.__version__
4+
url = https://github.com/aio-libs/aiohttp
5+
project_urls =
6+
Chat: Gitter = https://gitter.im/aio-libs/Lobby
7+
CI: GitHub Actions = https://github.com/aio-libs/aiohttp/actions?query=workflow%%3ACI
8+
Coverage: codecov = https://codecov.io/github/aio-libs/aiohttp
9+
Docs: Changelog = https://docs.aiohttp.org/en/stable/changes.html
10+
Docs: RTD = https://docs.aiohttp.org
11+
GitHub: issues = https://github.com/aio-libs/aiohttp/issues
12+
GitHub: repo = https://github.com/aio-libs/aiohttp
13+
description = Async http client/server framework (asyncio)
14+
long_description = file: README.rst
15+
long_description_content_type = text/x-rst
16+
author = Nikolay Kim
17+
author_email = [email protected]
18+
maintainer = Nikolay Kim <[email protected]>, Andrew Svetlov <[email protected]>
19+
maintainer_email = [email protected]
20+
license = Apache 2
221
license_files = LICENSE.txt
22+
classifiers =
23+
Development Status :: 5 - Production/Stable
24+
25+
Framework :: AsyncIO
26+
27+
Intended Audience :: Developers
28+
29+
License :: OSI Approved :: Apache Software License
30+
31+
Operating System :: POSIX
32+
Operating System :: MacOS :: MacOS X
33+
Operating System :: Microsoft :: Windows
34+
35+
Programming Language :: Python
36+
Programming Language :: Python :: 3
37+
Programming Language :: Python :: 3.7
38+
Programming Language :: Python :: 3.8
39+
Programming Language :: Python :: 3.9
40+
Programming Language :: Python :: 3.10
41+
42+
Topic :: Internet :: WWW/HTTP
43+
44+
[options]
45+
python_requires = >=3.7
46+
packages = find:
47+
# https://setuptools.readthedocs.io/en/latest/setuptools.html#setting-the-zip-safe-flag
48+
zip_safe = False
49+
include_package_data = True
50+
51+
install_requires =
52+
charset-normalizer >=2.0, < 3.0
53+
multidict >=4.5, < 7.0
54+
async_timeout >= 4.0a2, < 5.0
55+
asynctest == 0.13.0; python_version<"3.8"
56+
yarl >= 1.0, < 2.0
57+
typing_extensions >= 3.7.4
58+
frozenlist >= 1.1.1
59+
aiosignal >= 1.1.2
60+
61+
[options.extras_require]
62+
speedups =
63+
aiodns >= 1.1
64+
Brotli
65+
cchardet
66+
67+
[options.package_data]
68+
# Ref:
69+
# https://setuptools.readthedocs.io/en/latest/setuptools.html#options
70+
# (see notes for the asterisk/`*` meaning)
71+
* =
72+
# *.c
73+
*.so
374

475
[pep8]
576
max-line-length=79

setup.py

+6-87
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
import pathlib
3-
import re
43
import sys
54

65
from setuptools import Extension, setup
@@ -43,90 +42,10 @@
4342
]
4443

4544

46-
txt = (HERE / "aiohttp" / "__init__.py").read_text("utf-8")
47-
try:
48-
version = re.findall(r'^__version__ = "([^"]+)"\r?$', txt, re.M)[0]
49-
except IndexError:
50-
raise RuntimeError("Unable to determine version.")
45+
build_type = "Pure" if NO_EXTENSIONS else "Accelerated"
46+
setup_kwargs = {} if NO_EXTENSIONS else {"ext_modules": extensions}
5147

52-
install_requires = [
53-
"charset-normalizer>=2.0,<3.0",
54-
"multidict>=4.5,<7.0",
55-
"async_timeout>=4.0a2,<5.0",
56-
'asynctest==0.13.0; python_version<"3.8"',
57-
"yarl>=1.0,<2.0",
58-
"typing_extensions>=3.7.4",
59-
"frozenlist>=1.1.1",
60-
"aiosignal>=1.1.2",
61-
]
62-
63-
64-
def read(f):
65-
return (HERE / f).read_text("utf-8").strip()
66-
67-
68-
args = dict(
69-
name="aiohttp",
70-
version=version,
71-
description="Async http client/server framework (asyncio)",
72-
long_description=read("README.rst"),
73-
long_description_content_type="text/x-rst",
74-
classifiers=[
75-
"License :: OSI Approved :: Apache Software License",
76-
"Intended Audience :: Developers",
77-
"Programming Language :: Python",
78-
"Programming Language :: Python :: 3",
79-
"Programming Language :: Python :: 3.7",
80-
"Programming Language :: Python :: 3.8",
81-
"Programming Language :: Python :: 3.9",
82-
"Programming Language :: Python :: 3.10",
83-
"Development Status :: 5 - Production/Stable",
84-
"Operating System :: POSIX",
85-
"Operating System :: MacOS :: MacOS X",
86-
"Operating System :: Microsoft :: Windows",
87-
"Topic :: Internet :: WWW/HTTP",
88-
"Framework :: AsyncIO",
89-
],
90-
author="Nikolay Kim",
91-
author_email="[email protected]",
92-
maintainer=", ".join(
93-
(
94-
"Nikolay Kim <[email protected]>",
95-
"Andrew Svetlov <[email protected]>",
96-
)
97-
),
98-
maintainer_email="[email protected]",
99-
url="https://github.com/aio-libs/aiohttp",
100-
project_urls={
101-
"Chat: Gitter": "https://gitter.im/aio-libs/Lobby",
102-
"CI: GitHub Actions": "https://github.com/aio-libs/aiohttp/actions?query=workflow%3ACI", # noqa
103-
"Coverage: codecov": "https://codecov.io/github/aio-libs/aiohttp",
104-
"Docs: Changelog": "https://docs.aiohttp.org/en/stable/changes.html",
105-
"Docs: RTD": "https://docs.aiohttp.org",
106-
"GitHub: issues": "https://github.com/aio-libs/aiohttp/issues",
107-
"GitHub: repo": "https://github.com/aio-libs/aiohttp",
108-
},
109-
license="Apache 2",
110-
packages=["aiohttp"],
111-
python_requires=">=3.7",
112-
install_requires=install_requires,
113-
extras_require={
114-
"speedups": [
115-
"aiodns>=1.1",
116-
"Brotli",
117-
"cchardet",
118-
],
119-
},
120-
include_package_data=True,
121-
)
122-
123-
if not NO_EXTENSIONS:
124-
print("*********************")
125-
print("* Accelerated build *")
126-
print("*********************")
127-
setup(ext_modules=extensions, **args)
128-
else:
129-
print("*********************")
130-
print("* Pure Python build *")
131-
print("*********************")
132-
setup(**args)
48+
print("*********************", file=sys.stderr)
49+
print("* {build_type} build *".format_map(locals()), file=sys.stderr)
50+
print("*********************", file=sys.stderr)
51+
setup(**setup_kwargs)

0 commit comments

Comments
 (0)