Skip to content

Commit e1aec0a

Browse files
authored
Move dependency metadata from setup.cfg to pyproject.toml
PR #11643. This is a follow-up to #9951 implementing PEP 621.
1 parent 6cffcfd commit e1aec0a

File tree

7 files changed

+38
-32
lines changed

7 files changed

+38
-32
lines changed

.github/workflows/ci-cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
submodules: true
4242
- name: >-
4343
Verify that `requirements/runtime-deps.in`
44-
is in sync with `setup.cfg`
44+
is in sync with `pyproject.toml`
4545
run: |
4646
set -eEuo pipefail
4747
make sync-direct-runtime-deps

CHANGES/11643.packaging.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Moved dependency metadata from :file:`setup.cfg` to :file:`pyproject.toml` per :pep:`621`
2+
-- by :user:`cdce8p`.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,5 @@ install-dev: .develop
184184

185185
.PHONY: sync-direct-runtime-deps
186186
sync-direct-runtime-deps:
187-
@echo Updating 'requirements/runtime-deps.in' from 'setup.cfg'... >&2
187+
@echo Updating 'requirements/runtime-deps.in' from 'pyproject.toml'... >&2
188188
@python requirements/sync-direct-runtime-deps.py

pyproject.toml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,27 @@ classifiers = [
3232
"Topic :: Internet :: WWW/HTTP",
3333
]
3434
requires-python = ">= 3.10"
35+
dependencies = [
36+
"aiohappyeyeballs >= 2.5.0",
37+
"aiosignal >= 1.4.0",
38+
"async-timeout >= 4.0, < 6.0 ; python_version < '3.11'",
39+
"frozenlist >= 1.1.1",
40+
"multidict >=4.5, < 7.0",
41+
"propcache >= 0.2.0",
42+
"yarl >= 1.17.0, < 2.0",
43+
]
3544
dynamic = [
36-
"dependencies",
37-
"optional-dependencies",
3845
"version",
3946
]
4047

48+
[project.optional-dependencies]
49+
speedups = [
50+
"aiodns >= 3.3.0",
51+
"Brotli; platform_python_implementation == 'CPython'",
52+
"brotlicffi; platform_python_implementation != 'CPython'",
53+
"backports.zstd; platform_python_implementation == 'CPython' and python_version < '3.14'",
54+
]
55+
4156
[[project.maintainers]]
4257
name = "aiohttp team"
4358

requirements/runtime-deps.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Extracted from `setup.cfg` via `make sync-direct-runtime-deps`
1+
# Extracted from `pyproject.toml` via `make sync-direct-runtime-deps`
22

33
aiodns >= 3.3.0
44
aiohappyeyeballs >= 2.5.0
55
aiosignal >= 1.4.0
6-
async-timeout >= 4.0, < 6.0 ; python_version < "3.11"
7-
backports.zstd; platform_python_implementation == 'CPython' and python_version < "3.14"
6+
async-timeout >= 4.0, < 6.0 ; python_version < '3.11'
7+
backports.zstd; platform_python_implementation == 'CPython' and python_version < '3.14'
88
Brotli; platform_python_implementation == 'CPython'
99
brotlicffi; platform_python_implementation != 'CPython'
1010
frozenlist >= 1.1.1
Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
#!/usr/bin/env python
2-
"""Sync direct runtime dependencies from setup.cfg to runtime-deps.in."""
2+
"""Sync direct runtime dependencies from pyproject.toml to runtime-deps.in."""
33

4-
from configparser import ConfigParser
4+
import sys
55
from pathlib import Path
66

7-
cfg = ConfigParser()
8-
cfg.read(Path("setup.cfg"))
9-
reqs = cfg["options"]["install_requires"] + cfg.items("options.extras_require")[0][1]
10-
reqs = sorted(reqs.split("\n"), key=str.casefold)
11-
reqs.remove("")
7+
if sys.version_info >= (3, 11):
8+
import tomllib
9+
else:
10+
raise RuntimeError("Use Python 3.11+ to run 'make sync-direct-runtime-deps'")
11+
12+
data = tomllib.loads(Path("pyproject.toml").read_text())
13+
reqs = (
14+
data["project"]["dependencies"]
15+
+ data["project"]["optional-dependencies"]["speedups"]
16+
)
17+
reqs = sorted(reqs, key=str.casefold)
1218

1319
with open(Path("requirements", "runtime-deps.in"), "w") as outfile:
14-
header = "# Extracted from `setup.cfg` via `make sync-direct-runtime-deps`\n\n"
20+
header = "# Extracted from `pyproject.toml` via `make sync-direct-runtime-deps`\n\n"
1521
outfile.write(header)
1622
outfile.write("\n".join(reqs) + "\n")

setup.cfg

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
[options]
2-
install_requires =
3-
aiohappyeyeballs >= 2.5.0
4-
aiosignal >= 1.4.0
5-
async-timeout >= 4.0, < 6.0 ; python_version < "3.11"
6-
frozenlist >= 1.1.1
7-
multidict >=4.5, < 7.0
8-
propcache >= 0.2.0
9-
yarl >= 1.17.0, < 2.0
10-
11-
[options.extras_require]
12-
speedups =
13-
aiodns >= 3.3.0
14-
Brotli; platform_python_implementation == 'CPython'
15-
brotlicffi; platform_python_implementation != 'CPython'
16-
backports.zstd; platform_python_implementation == 'CPython' and python_version < "3.14"
17-
181
[pep8]
192
max-line-length=79
203

0 commit comments

Comments
 (0)