Skip to content

Commit 541537c

Browse files
committed
MNT: Build requirements files from pyproject.toml
1 parent a7cd030 commit 541537c

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

min-requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Auto-generated by tools/update_requirements.py
22
numpy ==1.17
3-
packaging ==17.0
3+
packaging ==17
44
setuptools

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Auto-generated by tools/update_requirements.py
22
numpy >=1.17
3-
packaging >=17.0
3+
packaging >=17
44
setuptools

tools/update_requirements.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#!/usr/bin/env python3
22
import sys
3-
from configparser import ConfigParser
3+
import tomli
44
from pathlib import Path
55

66
if sys.version_info < (3, 6):
77
print("This script requires Python 3.6 to work correctly")
88
sys.exit(1)
99

1010
repo_root = Path(__file__).parent.parent
11-
setup_cfg = repo_root / "setup.cfg"
11+
pyproject_toml = repo_root / "pyproject.toml"
1212
reqs = repo_root / "requirements.txt"
1313
min_reqs = repo_root / "min-requirements.txt"
1414

15-
config = ConfigParser()
16-
config.read(setup_cfg)
17-
requirements = config.get("options", "install_requires").strip().splitlines()
15+
with open(pyproject_toml, 'rb') as fobj:
16+
config = tomli.load(fobj)
17+
requirements = config["project"]["dependencies"]
1818

1919
script_name = Path(__file__).relative_to(repo_root)
2020

0 commit comments

Comments
 (0)