Skip to content

Infrastructure and tooling improvements - #8

Merged
juliendrapeau merged 7 commits into
devfrom
click
May 10, 2026
Merged

juliendrapeau merged 7 commits into
devfrom
click

Conversation

@juliendrapeau

Copy link
Copy Markdown
Owner

Summary

This PR migrates the project CLIs to click, fixes container output-path binding for HPC runs, and
adds architecture documentation assets.

Changes

feat: migrate CLI and HPC lifecycle from argparse to click

  • Reworked src/simulation_project_template/cli.py and hpc/lifecycle.py to use click command
    groups and decorators.
  • Replaced argparse-style/exception patterns with click.ClickException for cleaner CLI errors.
  • Removed integer return-code plumbing now that click manages command exits.
  • Added _PROJECT_ROOT_DEFAULT in hpc/lifecycle.py to centralize project-root resolution.
  • Added --test to hpc/lifecycle.py submit, forwarding
    --config test_mode=true num_instances=1 to Snakemake.
  • Updated dependency/config files for click usage and type-checking compatibility:
    pyproject.toml, requirements.txt, and uv.lock.
  • Updated CLI tests in tests/test_cli.py to use click.testing.CliRunner.

fix: bind project root into Apptainer container

  • Updated hpc/snakemake/run_snakemake.sh to set:
    • APPTAINER_BIND="${PWD}:${PWD}"
    • SINGULARITY_BIND="${PWD}:${PWD}"
  • This ensures relative output paths (for example data/ and results/) resolve to writable host
    paths instead of the container image layer.

docs: add architecture overview documentation

  • Added docs/architecture.md and docs/architecture.png.
  • Updated README.md and docs/hpc-workflow.md with related documentation clarifications.

chore: repository housekeeping and release bump

  • Updated .gitignore to ignore root-level bin/ and local-only CLAUDE.md.
  • Bumped version from 0.2.1 to 0.3.0.

Propagated from sgcode/dev PR #40. click provides better help text,
type-coerced options, and cleaner error messages than argparse.

- Add click>=8.0 to core dependencies (used by both spt CLI and lifecycle.py)
- Add [tool.ty.rules] unresolved-import = "ignore" to suppress ty false
  positives on optional deps in type-checked files
- Migrate src/.../cli.py: replace argparse with @click.group()/@main.command()
  decorators; raise ClickException on error
- Migrate hpc/lifecycle.py: same pattern; add _PROJECT_ROOT_DEFAULT constant;
  replace raise FileNotFoundError/RuntimeError with raise click.ClickException;
  remove integer return codes (void commands); add --test flag to submit command
- Rewrite tests/test_cli.py to use click.testing.CliRunner
Propagated from sgcode/dev PR #40. Without this, relative output paths
(data/, results/) inside the container resolve to the read-only image
layer rather than the writable host filesystem, causing write failures.

Sets both APPTAINER_BIND and SINGULARITY_BIND for compatibility with
older Apptainer/Singularity installations.
Ignores any bin/ directory at the repo root and CLAUDE.md (kept
local-only, not tracked in version control).
@github-actions

github-actions Bot commented May 10, 2026 •

Copy link
Copy Markdown

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
59 55 93% 90% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/simulation_project_template/cli.py 96% 🟢
TOTAL 96% 🟢

updated for commit: 3a4f074 by action🐍

@juliendrapeau
juliendrapeau merged commit a27ebee into dev May 10, 2026
2 checks passed
@juliendrapeau
juliendrapeau deleted the click branch May 10, 2026 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant