From 1adcda37ccaf0961b89207e0a9f0471b27913ed7 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Sat, 16 Mar 2024 00:28:00 +0100 Subject: [PATCH] fix: generate a requirements file with dev dependencies Should stop #121 from breaking --- .circleci/config.yml | 6 +++--- .gitignore | 1 + .maint/update_requirements.py | 10 ++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9c1fc62c..271c8998 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,8 +20,8 @@ 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 @@ -29,7 +29,7 @@ jobs: 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 diff --git a/.gitignore b/.gitignore index 1b721347..a31c2a55 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ _version.py # circleci hash checking requirements.txt min-requirements.txt +dev-requirements.txt # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/.maint/update_requirements.py b/.maint/update_requirements.py index c3b9fcec..bbce29a9 100755 --- a/.maint/update_requirements.py +++ b/.maint/update_requirements.py @@ -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) @@ -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))