Skip to content

Commit 02d55a0

Browse files
authored
Merge pull request #205 from effigies/ci/test-mininimum-versions
CI: Test minimum versions
2 parents 2d5a7b0 + 22ad464 commit 02d55a0

File tree

6 files changed

+56
-15
lines changed

6 files changed

+56
-15
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@ concurrency:
1616

1717

1818
jobs:
19-
build:
19+
test:
2020

2121
runs-on: ubuntu-latest
2222
strategy:
2323
max-parallel: 4
2424
matrix:
25-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
25+
python-version: ['3.8', '3.9', '3.10', '3.11']
26+
requires: ['requirements.txt']
27+
include:
28+
- python-version: '3.8'
29+
requires: 'min-requirements.txt'
2630

2731
steps:
2832
- name: Checkout repo
@@ -34,12 +38,12 @@ jobs:
3438
- name: Install
3539
run: |
3640
python -m pip install --upgrade pip
37-
python -m pip install -r requirements.txt
41+
python -m pip install -r ${{ matrix.requires }}
3842
python -m pip install -r requirements-dev.txt
3943
python -m pip install .
4044
- name: Lint
4145
run: |
4246
pipx run flake8 --ignore N802,N806,W504 --select W503 nitime/ tools/
4347
- name: Test
4448
run: |
45-
cd && mkdir for_test && cd for_test && pytest --pyargs nitime --cov-report term-missing --cov=AFQ
49+
mkdir ~/for_test && cd ~/for_test && pytest --pyargs nitime --cov-report term-missing --cov=nitime

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-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ pytest
33
pytest-cov
44
nibabel
55
networkx
6+
tomli; python_version < '3.11'

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

0 commit comments

Comments
 (0)