Skip to content

Commit

Permalink
Merge pull request #125 from templateflow/fix/circleci-pytest-error
Browse files Browse the repository at this point in the history
FIX: Generate a requirements file with ``test`` dependencies
  • Loading branch information
oesteban authored Mar 15, 2024
2 parents 5c3b769 + 1adcda3 commit 5d8a23c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ jobs:
- restore_cache:
keys:
- deps-v10-{{ checksum "/tmp/src/templateflow/requirements.txt"}}-{{ epoch }}
- deps-v10-{{ checksum "/tmp/src/templateflow/requirements.txt"}}-
- deps-v10-{{ checksum "/tmp/src/templateflow/dev-requirements.txt"}}-{{ epoch }}
- deps-v10-{{ checksum "/tmp/src/templateflow/dev-requirements.txt"}}-
- deps-v10-
- run:
name: Prepare environment
command: |
python -m venv /tmp/venv
source /tmp/venv/bin/activate
pip install -U pip
pip install -r /tmp/src/templateflow/requirements.txt
pip install -r /tmp/src/templateflow/dev-requirements.txt
pip install datalad
pip install -U build hatch hatchling nipreps-versions build twine codecov
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ _version.py
# circleci hash checking
requirements.txt
min-requirements.txt
dev-requirements.txt

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
10 changes: 10 additions & 0 deletions .maint/update_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@
pyproject = repo_root / 'pyproject.toml'
reqs = repo_root / 'requirements.txt'
min_reqs = repo_root / 'min-requirements.txt'
reqs_dev = repo_root / 'dev-requirements.txt'

requirements = [
Requirement(req)
for req in loads(pyproject.read_text())['project']['dependencies']
]

requirements_dev = [
Requirement(req)
for req in loads(pyproject.read_text())['project']['optional-dependencies']['test']
]

script_name = Path(__file__).relative_to(repo_root)


Expand All @@ -40,6 +46,10 @@ def to_min(req):
lines[1:-1] = [str(req) for req in requirements]
reqs.write_text('\n'.join(lines))

# Write dev-requirements
lines[1:-1] = [str(req) for req in (requirements + requirements_dev)]
reqs_dev.write_text('\n'.join(lines))

# Write minimum requirements
lines[1:-1] = [str(to_min(req)) for req in requirements]
min_reqs.write_text('\n'.join(lines))

0 comments on commit 5d8a23c

Please sign in to comment.