From f9ee5de42d3203f53f436ba176268be2e58fa7da Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 28 Oct 2021 22:22:39 +0200 Subject: [PATCH 1/2] Migrate packaging toward declarative `setup.cfg` --- setup.cfg | 71 ++++++++++++++++++++++++++++++++++++++++++ setup.py | 93 ++++--------------------------------------------------- 2 files changed, 77 insertions(+), 87 deletions(-) diff --git a/setup.cfg b/setup.cfg index e391b4c8fe0..06a373540e1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 = fafhrd91@gmail.com +maintainer = Nikolay Kim , Andrew Svetlov +maintainer_email = aio-libs@googlegroups.com +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 diff --git a/setup.py b/setup.py index 3e58ae31026..2086b0cf585 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ import os import pathlib -import re import sys from setuptools import Extension, setup @@ -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="fafhrd91@gmail.com", - maintainer=", ".join( - ( - "Nikolay Kim ", - "Andrew Svetlov ", - ) - ), - maintainer_email="aio-libs@googlegroups.com", - 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) From 5256a89758e82ec518b65bff362775c099088332 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 28 Oct 2021 22:27:49 +0200 Subject: [PATCH 2/2] Add a change note for PR #6165 --- CHANGES/6165.misc | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 CHANGES/6165.misc diff --git a/CHANGES/6165.misc b/CHANGES/6165.misc new file mode 100644 index 00000000000..f9c5097ab68 --- /dev/null +++ b/CHANGES/6165.misc @@ -0,0 +1,2 @@ +Migrated the Python packaging setup to have static metadata +in the declarative ``setup.cfg`` file — :user:`webknjaz`.