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

Migrate packaging toward declarative setup.cfg #6165

Merged
merged 2 commits into from
Oct 28, 2021
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`.
71 changes: 71 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,76 @@
[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.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10

Topic :: Internet :: WWW/HTTP

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

install_requires =
charset-normalizer >=2.0, < 3.0
multidict >=4.5, < 7.0
async_timeout >= 4.0a2, < 5.0
asynctest == 0.13.0; python_version<"3.8"
yarl >= 1.0, < 2.0
typing_extensions >= 3.7.4
frozenlist >= 1.1.1
aiosignal >= 1.1.2

[options.extras_require]
speedups =
aiodns >= 1.1
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
93 changes: 6 additions & 87 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import pathlib
import re
import sys

from setuptools import Extension, setup
Expand Down Expand Up @@ -43,90 +42,10 @@
]


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.")
build_type = "Pure" if NO_EXTENSIONS else "Accelerated"
setup_kwargs = {} if NO_EXTENSIONS else {"ext_modules": extensions}

install_requires = [
"charset-normalizer>=2.0,<3.0",
"multidict>=4.5,<7.0",
"async_timeout>=4.0a2,<5.0",
'asynctest==0.13.0; python_version<"3.8"',
"yarl>=1.0,<2.0",
"typing_extensions>=3.7.4",
"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.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: 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",
},
license="Apache 2",
packages=["aiohttp"],
python_requires=">=3.7",
install_requires=install_requires,
extras_require={
"speedups": [
"aiodns>=1.1",
"Brotli",
"cchardet",
],
},
include_package_data=True,
)

if not NO_EXTENSIONS:
print("*********************")
print("* Accelerated build *")
print("*********************")
setup(ext_modules=extensions, **args)
else:
print("*********************")
print("* Pure Python build *")
print("*********************")
setup(**args)
print("*********************", file=sys.stderr)
print("* {build_type} build *".format_map(locals()), file=sys.stderr)
print("*********************", file=sys.stderr)
setup(**setup_kwargs)