Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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/11643.packaging.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Moved dependency metadata from :file:`setup.cfg` to :file:`pyproject.toml` per :pep:`621`
-- by :user:`cdce8p`.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,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
21 changes: 17 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,23 @@ classifiers = [
"Topic :: Internet :: WWW/HTTP",
]
requires-python = ">= 3.10"
dynamic = [
"dependencies",
"optional-dependencies",
"version",
dependencies = [
"aiohappyeyeballs >= 2.5.0",
"aiosignal >= 1.4.0",
"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 = [
"aiodns >= 3.3.0",
"Brotli; platform_python_implementation == 'CPython'",
"brotlicffi; platform_python_implementation != 'CPython'",
"backports.zstd; platform_python_implementation == 'CPython' and python_version < '3.14'",
]

[[project.maintainers]]
Expand Down
1 change: 1 addition & 0 deletions requirements/lint.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pytest-mock
pytest_codspeed
python-on-whales
slotscheck
tomli; python_version < "3.11"
trustme
uvloop; platform_system != "Windows"
valkey
Expand Down
5 changes: 3 additions & 2 deletions requirements/lint.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --allow-unsafe --output-file=requirements/lint.txt --strip-extras requirements/lint.in
Expand Down Expand Up @@ -98,8 +98,9 @@ six==1.17.0
# via python-dateutil
slotscheck==0.19.1
# via -r requirements/lint.in
tomli==2.3.0
tomli==2.3.0 ; python_version < "3.11"
# 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,10 +1,10 @@
# Extracted from `setup.cfg` via `make sync-direct-runtime-deps`
# Extracted from `pyproject.toml` via `make sync-direct-runtime-deps`

aiodns >= 3.3.0
aiohappyeyeballs >= 2.5.0
aiosignal >= 1.4.0
async-timeout >= 4.0, < 6.0 ; python_version < "3.11"
backports.zstd; platform_python_implementation == 'CPython' and python_version < "3.14"
async-timeout >= 4.0, < 6.0 ; python_version < '3.11'
backports.zstd; platform_python_implementation == 'CPython' and python_version < '3.14'
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 # noqa: I900

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")
17 changes: 0 additions & 17 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
[options]
install_requires =
aiohappyeyeballs >= 2.5.0
aiosignal >= 1.4.0
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.extras_require]
speedups =
aiodns >= 3.3.0
Brotli; platform_python_implementation == 'CPython'
brotlicffi; platform_python_implementation != 'CPython'
backports.zstd; platform_python_implementation == 'CPython' and python_version < "3.14"

[pep8]
max-line-length=79

Expand Down
Loading