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

Move metadata to pyproject.toml #9951

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions CHANGES/9951.packaging.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Moved static metadata from ``setup.cfg`` to ``pyproject.toml`` -- by :user:`cdce8p`.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,5 @@ install-dev: .develop

.PHONY: sync-direct-runtime-deps
sync-direct-runtime-deps:
@echo Updating 'requirements/runtime-deps.in' from 'setup.cfg'... >&2
@echo Updating 'requirements/runtime-deps.in' from 'pyproject.toml'... >&2
@python requirements/sync-direct-runtime-deps.py
76 changes: 68 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,74 @@
[build-system]
requires = [
"setuptools >= 46.4.0",
]
requires = ["setuptools >= 70.0.0"]
build-backend = "setuptools.build_meta"

[project]
name = "aiohttp"
license = {text = "Apache-2.0"}
description = "Async http client/server framework (asyncio)"
readme = "README.rst"
maintainers = [{name = "aiohttp team", email = "[email protected]"}]
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.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Internet :: WWW/HTTP",
]
requires-python = ">=3.9"
dependencies = [
"aiohappyeyeballs >= 2.3.0",
"aiosignal >= 1.1.2",
"async-timeout >= 4.0, < 6.0 ; python_version < '3.11'",
"frozenlist >= 1.1.1",
"multidict >=4.5, < 7.0",
"propcache >= 0.2.0",
"yarl >= 1.17.0, < 2.0",
]
dynamic = ["version"]

[project.optional-dependencies]
speedups = [
# required c-ares (aiodns' backend) will not build on windows
"aiodns >= 3.2.0; sys_platform=='linux' or sys_platform=='darwin'",
"Brotli; platform_python_implementation == 'CPython'",
"brotlicffi; platform_python_implementation != 'CPython'",
]

[project.urls]
"Homepage" = "https://github.com/aio-libs/aiohttp"
"Chat: Matrix" = "https://matrix.to/#/#aio-libs:matrix.org"
"Chat: Matrix Space" = "https://matrix.to/#/#aio-libs-space:matrix.org"
"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"

[tool.setuptools.dynamic]
version = {attr = "aiohttp.__version__"}

[tool.setuptools.packages.find]
include = ["aiohttp*"]
exclude = ["examples"]

[tool.setuptools.package-data]
"*" = ["*.so"]

[tool.setuptools.exclude-package-data]
"*" = ["*.c", "*.h"]

[tool.towncrier]
package = "aiohttp"
filename = "CHANGES.rst"
Expand Down Expand Up @@ -87,8 +152,3 @@ ignore-words-list = 'te,assertIn'
# TODO(3.13): Remove aiohttp.helpers once https://github.com/python/cpython/pull/106771
# is available in all supported cpython versions
exclude-modules = "(^aiohttp\\.helpers)"

[tool.black]
# TODO: Remove when project metadata is moved here.
# Black can read the value from [project.requires-python].
target-version = ["py39", "py310", "py311", "py312", "py313"]
1 change: 1 addition & 0 deletions requirements/lint.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pytest-mock
pytest_codspeed
python-on-whales
slotscheck
tomli; python_version < '3.11'
trustme
uvloop; platform_system != "Windows"
valkey
1 change: 1 addition & 0 deletions requirements/lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ slotscheck==0.19.1
# via -r requirements/lint.in
tomli==2.0.2
# via
# -r requirements/lint.in
# mypy
# pytest
# slotscheck
Expand Down
6 changes: 3 additions & 3 deletions requirements/runtime-deps.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Extracted from `setup.cfg` via `make sync-direct-runtime-deps`
# Extracted from `pyproject.toml` via `make sync-direct-runtime-deps`

aiodns >= 3.2.0; sys_platform=="linux" or sys_platform=="darwin"
aiodns >= 3.2.0; sys_platform=='linux' or sys_platform=='darwin'
aiohappyeyeballs >= 2.3.0
aiosignal >= 1.1.2
async-timeout >= 4.0, < 6.0 ; python_version < "3.11"
async-timeout >= 4.0, < 6.0 ; python_version < '3.11'
Brotli; platform_python_implementation == 'CPython'
brotlicffi; platform_python_implementation != 'CPython'
frozenlist >= 1.1.1
Expand Down
22 changes: 14 additions & 8 deletions requirements/sync-direct-runtime-deps.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#!/usr/bin/env python
"""Sync direct runtime dependencies from setup.cfg to runtime-deps.in."""
"""Sync direct runtime dependencies from pyproject.toml to runtime-deps.in."""

from configparser import ConfigParser
import sys
from pathlib import Path

cfg = ConfigParser()
cfg.read(Path("setup.cfg"))
reqs = cfg["options"]["install_requires"] + cfg.items("options.extras_require")[0][1]
reqs = sorted(reqs.split("\n"), key=str.casefold)
reqs.remove("")
if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib

data = tomllib.loads(Path("pyproject.toml").read_text())
reqs = (
data["project"]["dependencies"]
+ data["project"]["optional-dependencies"]["speedups"]
)
reqs = sorted(reqs, key=str.casefold)

with open(Path("requirements", "runtime-deps.in"), "w") as outfile:
header = "# Extracted from `setup.cfg` via `make sync-direct-runtime-deps`\n\n"
header = "# Extracted from `pyproject.toml` via `make sync-direct-runtime-deps`\n\n"
outfile.write(header)
outfile.write("\n".join(reqs) + "\n")
84 changes: 0 additions & 84 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,87 +1,3 @@
[metadata]
name = aiohttp
version = attr: aiohttp.__version__
url = https://github.com/aio-libs/aiohttp
project_urls =
Chat: Matrix = https://matrix.to/#/#aio-libs:matrix.org
Chat: Matrix Space = https://matrix.to/#/#aio-libs-space:matrix.org
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
maintainer = aiohttp team <[email protected]>
maintainer_email = [email protected]
license = Apache-2.0
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.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13

Topic :: Internet :: WWW/HTTP

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

install_requires =
aiohappyeyeballs >= 2.3.0
aiosignal >= 1.1.2
async-timeout >= 4.0, < 6.0 ; python_version < "3.11"
frozenlist >= 1.1.1
multidict >=4.5, < 7.0
propcache >= 0.2.0
yarl >= 1.17.0, < 2.0

[options.exclude_package_data]
* =
*.c
*.h

[options.extras_require]
speedups =
# required c-ares (aiodns' backend) will not build on windows
aiodns >= 3.2.0; sys_platform=="linux" or sys_platform=="darwin"
Brotli; platform_python_implementation == 'CPython'
brotlicffi; platform_python_implementation != 'CPython'

[options.packages.find]
exclude =
examples

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

[pep8]
max-line-length=79

Expand Down
Loading