Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR #6165/850785c3 backport][3.8] Migrate packaging toward declarative setup.cfg #6168

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES/6165.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Migrated the Python packaging setup to have static metadata
in the declarative ``setup.cfg`` file — :user:`webknjaz`.
74 changes: 74 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,79 @@
[metadata]
name = aiohttp
version = attr: aiohttp.__version__
url = https://github.com/aio-libs/aiohttp
project_urls =
Chat: Gitter = https://gitter.im/aio-libs/Lobby
CI: GitHub Actions = https://github.com/aio-libs/aiohttp/actions?query=workflow%%3ACI
Coverage: codecov = https://codecov.io/github/aio-libs/aiohttp
Docs: Changelog = https://docs.aiohttp.org/en/stable/changes.html
Docs: RTD = https://docs.aiohttp.org
GitHub: issues = https://github.com/aio-libs/aiohttp/issues
GitHub: repo = https://github.com/aio-libs/aiohttp
description = Async http client/server framework (asyncio)
long_description = file: README.rst
long_description_content_type = text/x-rst
author = Nikolay Kim
author_email = [email protected]
maintainer = Nikolay Kim <[email protected]>, Andrew Svetlov <[email protected]>
maintainer_email = [email protected]
license = Apache 2
license_files = LICENSE.txt
classifiers =
Development Status :: 5 - Production/Stable

Framework :: AsyncIO

Intended Audience :: Developers

License :: OSI Approved :: Apache Software License

Operating System :: POSIX
Operating System :: MacOS :: MacOS X
Operating System :: Microsoft :: Windows

Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10

Topic :: Internet :: WWW/HTTP

[options]
python_requires = >=3.6
packages = find:
# https://setuptools.readthedocs.io/en/latest/setuptools.html#setting-the-zip-safe-flag
zip_safe = False
include_package_data = True

install_requires =
attrs >= 17.3.0
charset-normalizer >=2.0, < 3.0
multidict >=4.5, < 7.0
async_timeout >= 4.0.0a3, < 5.0
asynctest == 0.13.0; python_version<"3.8"
yarl >= 1.0, < 2.0
idna-ssl >= 1.0; python_version<"3.7"
typing_extensions >= 3.7.4; python_version<"3.8"
frozenlist >= 1.1.1
aiosignal >= 1.1.2

[options.extras_require]
speedups =
aiodns
Brotli
cchardet

[options.package_data]
# Ref:
# https://setuptools.readthedocs.io/en/latest/setuptools.html#options
# (see notes for the asterisk/`*` meaning)
* =
# *.c
*.so

[pep8]
max-line-length=79
Expand Down
95 changes: 7 additions & 88 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pathlib
import re
import sys
from distutils.command.build_ext import build_ext
from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError
Expand All @@ -9,9 +8,9 @@
if sys.version_info < (3, 6):
raise RuntimeError("aiohttp 3.7+ requires Python 3.6+")

here = pathlib.Path(__file__).parent
HERE = pathlib.Path(__file__).parent

if (here / ".git").exists() and not (here / "vendor/http-parser/README.md").exists():
if (HERE / ".git").exists() and not (HERE / "vendor/http-parser/README.md").exists():
print("Install submodules when building from git clone", file=sys.stderr)
print("Hint:", file=sys.stderr)
print(" git submodule update --init", file=sys.stderr)
Expand Down Expand Up @@ -56,93 +55,13 @@ def build_extension(self, ext):
raise BuildFailed()


txt = (here / "aiohttp" / "__init__.py").read_text("utf-8")
try:
version = re.findall(r'^__version__ = "([^"]+)"\r?$', txt, re.M)[0]
except IndexError:
raise RuntimeError("Unable to determine version.")

install_requires = [
"attrs>=17.3.0",
"charset-normalizer>=2.0,<3.0",
"multidict>=4.5,<7.0",
"async_timeout>=4.0.0a3,<5.0",
'asynctest==0.13.0; python_version<"3.8"',
"yarl>=1.0,<2.0",
'idna-ssl>=1.0; python_version<"3.7"',
'typing_extensions>=3.7.4; python_version<"3.8"',
"frozenlist>=1.1.1",
"aiosignal>=1.1.2",
]


def read(f):
return (here / f).read_text("utf-8").strip()


args = dict(
name="aiohttp",
version=version,
description="Async http client/server framework (asyncio)",
long_description=read("README.rst"),
long_description_content_type="text/x-rst",
classifiers=[
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Development Status :: 5 - Production/Stable",
"Operating System :: POSIX",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Topic :: Internet :: WWW/HTTP",
"Framework :: AsyncIO",
],
author="Nikolay Kim",
author_email="[email protected]",
maintainer=", ".join(
(
"Nikolay Kim <[email protected]>",
"Andrew Svetlov <[email protected]>",
)
),
maintainer_email="[email protected]",
url="https://github.com/aio-libs/aiohttp",
project_urls={
"Chat: Gitter": "https://gitter.im/aio-libs/Lobby",
"CI: GitHub Actions": "https://github.com/aio-libs/aiohttp/actions?query=workflow%3ACI", # noqa
"Coverage: codecov": "https://codecov.io/github/aio-libs/aiohttp",
"Docs: RTD": "https://docs.aiohttp.org",
"GitHub: issues": "https://github.com/aio-libs/aiohttp/issues",
"GitHub: repo": "https://github.com/aio-libs/aiohttp",
},
license="Apache 2",
packages=["aiohttp"],
python_requires=">=3.6",
install_requires=install_requires,
extras_require={
"speedups": [
"aiodns",
"Brotli",
"cchardet",
],
},
include_package_data=True,
ext_modules=extensions,
cmdclass=dict(build_ext=ve_build_ext),
)

try:
setup(**args)
setup(
ext_modules=extensions,
cmdclass=dict(build_ext=ve_build_ext),
)
except BuildFailed:
print("************************************************************")
print("Cannot compile C accelerator module, use pure python version")
print("************************************************************")
del args["ext_modules"]
del args["cmdclass"]
setup(**args)
setup()