Skip to content

Commit 0453082

Browse files
committed
MNT: Add and propagate minimum requirements following SPEC 0
1 parent 2d5a7b0 commit 0453082

File tree

4 files changed

+44
-11
lines changed

4 files changed

+44
-11
lines changed

min-requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Auto-generated by tools/update_requirements.py
2+
matplotlib==3.5
3+
numpy==1.22
4+
scipy==1.8
5+
networkx==2.7
6+
nibabel==4.0

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ classifiers = [
3434
"Topic :: Scientific/Engineering",
3535
]
3636
dependencies = [
37-
"matplotlib",
38-
"numpy",
39-
"scipy",
37+
"matplotlib>=3.5",
38+
"numpy>=1.22",
39+
"scipy>=1.8",
4040
]
4141

4242
[project.optional-dependencies]
4343
full = [
44-
"networkx",
45-
"nibabel",
44+
"networkx>=2.7",
45+
"nibabel>=4.0",
4646
]
4747

4848
[project.urls]

requirements.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
numpy
2-
cython
3-
scipy
4-
matplotlib
5-
networkx
6-
nibabel
1+
# Auto-generated by tools/update_requirements.py
2+
matplotlib>=3.5
3+
numpy>=1.22
4+
scipy>=1.8
5+
networkx>=2.7
6+
nibabel>=4.0

tools/update_requirements.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env python3
2+
import sys
3+
from pathlib import Path
4+
5+
import tomli
6+
7+
repo_root = Path(__file__).parent.parent
8+
pyproject_toml = repo_root / 'pyproject.toml'
9+
reqs = repo_root / 'requirements.txt'
10+
min_reqs = repo_root / 'min-requirements.txt'
11+
12+
with open(pyproject_toml, 'rb') as fobj:
13+
config = tomli.load(fobj)
14+
project = config['project']
15+
requirements = project['dependencies'] + project['optional-dependencies']['full']
16+
17+
script_name = Path(__file__).relative_to(repo_root)
18+
19+
lines = [f'# Auto-generated by {script_name}', '']
20+
21+
# Write requirements
22+
lines[1:-1] = requirements
23+
reqs.write_text('\n'.join(lines))
24+
25+
# Write minimum requirements
26+
lines[1:-1] = [req.replace('>=', '==').replace('~=', '==') for req in requirements]
27+
min_reqs.write_text('\n'.join(lines))

0 commit comments

Comments
 (0)