Skip to content

Commit 75d2f7e

Browse files
committed
Move dependency metadata from setup.cfg to pyproject.toml
PR aio-libs#11643. This is a follow-up to aio-libs#9951 implementing PEP 621. (cherry picked from commit e1aec0a)
1 parent 91547df commit 75d2f7e

File tree

7 files changed

+39
-33
lines changed

7 files changed

+39
-33
lines changed

.github/workflows/ci-cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
submodules: true
3838
- name: >-
3939
Verify that `requirements/runtime-deps.in`
40-
is in sync with `setup.cfg`
40+
is in sync with `pyproject.toml`
4141
run: |
4242
set -eEuo pipefail
4343
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
@@ -189,5 +189,5 @@ install-dev: .develop
189189

190190
.PHONY: sync-direct-runtime-deps
191191
sync-direct-runtime-deps:
192-
@echo Updating 'requirements/runtime-deps.in' from 'setup.cfg'... >&2
192+
@echo Updating 'requirements/runtime-deps.in' from 'pyproject.toml'... >&2
193193
@python requirements/sync-direct-runtime-deps.py

pyproject.toml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,28 @@ classifiers = [
3333
"Topic :: Internet :: WWW/HTTP",
3434
]
3535
requires-python = ">= 3.9"
36+
dependencies = [
37+
"aiohappyeyeballs >= 2.5.0",
38+
"aiosignal >= 1.4.0",
39+
"async-timeout >= 4.0, < 6.0 ; python_version < '3.11'",
40+
"attrs >= 17.3.0",
41+
"frozenlist >= 1.1.1",
42+
"multidict >=4.5, < 7.0",
43+
"propcache >= 0.2.0",
44+
"yarl >= 1.17.0, < 2.0",
45+
]
3646
dynamic = [
37-
"dependencies",
38-
"optional-dependencies",
3947
"version",
4048
]
4149

50+
[project.optional-dependencies]
51+
speedups = [
52+
"aiodns >= 3.3.0",
53+
"Brotli; platform_python_implementation == 'CPython'",
54+
"brotlicffi; platform_python_implementation != 'CPython'",
55+
"backports.zstd; platform_python_implementation == 'CPython' and python_version < '3.14'",
56+
]
57+
4258
[[project.maintainers]]
4359
name = "aiohttp team"
4460

requirements/runtime-deps.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
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"
6+
async-timeout >= 4.0, < 6.0 ; python_version < '3.11'
77
attrs >= 17.3.0
8-
backports.zstd; platform_python_implementation == 'CPython' and python_version < "3.14"
8+
backports.zstd; platform_python_implementation == 'CPython' and python_version < '3.14'
99
Brotli; platform_python_implementation == 'CPython'
1010
brotlicffi; platform_python_implementation != 'CPython'
1111
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 & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +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-
attrs >= 17.3.0
7-
frozenlist >= 1.1.1
8-
multidict >=4.5, < 7.0
9-
propcache >= 0.2.0
10-
yarl >= 1.17.0, < 2.0
11-
12-
[options.extras_require]
13-
speedups =
14-
aiodns >= 3.3.0
15-
Brotli; platform_python_implementation == 'CPython'
16-
brotlicffi; platform_python_implementation != 'CPython'
17-
backports.zstd; platform_python_implementation == 'CPython' and python_version < "3.14"
18-
191
[pep8]
202
max-line-length=79
213

0 commit comments

Comments
 (0)