Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Generate a requirements file with test dependencies #125

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
Loading