Skip to content

Restructure as Python package with Docker/CI support#20

Merged
kbryanhsu merged 7 commits intomainfrom
refactor-python-package
Jan 16, 2026
Merged

Restructure as Python package with Docker/CI support#20
kbryanhsu merged 7 commits intomainfrom
refactor-python-package

Conversation

@dpark01
Copy link
Copy Markdown
Member

@dpark01 dpark01 commented Jan 16, 2026

Summary

  • Convert standalone scripts to installable Python package with src/ layout
  • Create single CLI entry point qprimer with 7 subcommands (generate, pick-representatives, prepare-input, evaluate, filter, build-output, select-multiplex)
  • Reduce environment.yml from 165 to ~15 packages (top-level dependencies only)
  • Move ML models to package data (src/qprimer_designer/data/)
  • Add external tool wrappers (ViennaRNA, bowtie2, MAFFT) using PATH-based discovery
  • Fix hardcoded paths in training/ to use environment variables
  • Move Snakefiles to workflows/ directory and update to use new CLI syntax
  • Delete 37MB ViennaRNA tarball (use bioconda viennarna package instead)
  • Add Dockerfile with mambaorg/micromamba base for multi-arch builds (linux/amd64, linux/arm64)
  • Add GitHub Actions workflows:
    • Tests: pytest with CodeCov coverage reporting
    • Docker Build: multi-arch builds with GHCR push, merge queue support
    • Snakemake Validation: syntax validation using --list-rules
  • Add README badges for Tests, Docker Build, and CodeCov
  • Add placeholder tests for sequences and params modules
  • Add CLAUDE.md development guide and update README.md

Test plan

  • Verify pip install . works in conda environment (CI tests pass)
  • Run qprimer --help and qprimer generate --help to verify CLI (Docker build verifies this)
  • Run pytest tests/ -v to verify tests pass (CI tests pass)
  • Run docker build -t qprimer:test . to verify Docker build (CI build passes)
  • Run snakemake -s workflows/Snakefile.example --dry-run to validate Snakefile syntax (CI)
  • Verify GitHub Actions workflows pass (all CI actions pass)
  • Verify CodeCov receives coverage reports (codecov/patch and codecov/project pass)

🤖 Generated with Claude Code

dpark01 and others added 6 commits January 16, 2026 11:30
- Convert standalone scripts to installable Python package with src/ layout
- Create single CLI entry point `qprimer` with 7 subcommands:
  - generate, pick-representatives, prepare-input, evaluate,
    filter, build-output, select-multiplex
- Reduce environment.yml from 165 to ~15 packages (top-level only)
- Move ML models to package data (src/qprimer_designer/data/)
- Add external tool wrappers (ViennaRNA, bowtie2, MAFFT) using PATH
- Fix hardcoded paths in training/ to use environment variables
- Move Snakefiles to workflows/ and update to use new CLI syntax
- Delete 37MB ViennaRNA tarball (use bioconda instead)
- Add Dockerfile with mambaorg/micromamba base
- Add GitHub Actions workflows:
  - test.yml: pytest runner
  - docker.yml: multi-arch Docker builds
  - snakemake.yml: workflow dry-run validation
- Add placeholder tests for sequences and params modules
- Add CLAUDE.md development guide and update README.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use mambaorg/micromamba:2.5.0-debian12-slim (2.0.0-ubuntu24.04 doesn't exist)
- Add --cores 1 to snakemake dry-run (required by workflow)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add merge_group trigger to Docker workflow for future merge queue support
- Only push images on push events (not PRs or merge_group)
- Add CMD ["/bin/bash"] as default entrypoint in Dockerfile
- Remove tarball exclusions from .gitignore (keep HUMAN.tar.bz2)
- Fix Docker image path in README (broadinstitute, not kbryanhsu)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 16, 2026 16:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restructures the repository into an installable Python package with modern packaging, Docker support, and CI/CD workflows. The main goal is to improve maintainability and deployment by transitioning from standalone scripts to a unified CLI with subcommands, reducing dependency bloat, and adding automated testing infrastructure.

Changes:

  • Converted standalone scripts to installable package with qprimer CLI entry point and 7 subcommands
  • Streamlined dependencies from ~165 to ~15 top-level packages in environment.yml
  • Added Docker support with multi-arch builds and GitHub Actions workflows for tests, Docker builds, and Snakemake validation

Reviewed changes

Copilot reviewed 40 out of 45 changed files in this pull request and generated no comments.

Show a summary per file
File Description
workflows/params.txt.template New parameter template file for workflow configuration
workflows/Snakefile.template Updated to use new qprimer CLI commands instead of direct script calls
workflows/Snakefile.example Updated to use new qprimer CLI commands instead of direct script calls
training/adapt_pcr_external_tools.py Refactored to use environment variables and PATH-based tool discovery
training/__init__.py Updated matplotlib configuration to use environment variables for font paths
tests/test_sequences.py Added tests for sequence utility functions
tests/test_params.py Added tests for parameter parsing
tests/conftest.py Added pytest fixtures for testing
tests/__init__.py Added test suite initialization
src/qprimer_designer/utils/sequences.py New sequence manipulation utilities module
src/qprimer_designer/utils/params.py New parameter parsing utilities module
src/qprimer_designer/utils/encoding.py New sequence encoding utilities for ML models
src/qprimer_designer/utils/__init__.py Utility module exports
src/qprimer_designer/models/inference.py New model loading and inference utilities
src/qprimer_designer/models/architectures.py ML model architectures for primer evaluation
src/qprimer_designer/models/__init__.py Model module exports
src/qprimer_designer/external/vienna.py ViennaRNA RNAduplex wrapper
src/qprimer_designer/external/mafft.py MAFFT wrapper for sequence alignment
src/qprimer_designer/external/bowtie.py Bowtie2 wrapper for sequence alignment
src/qprimer_designer/external/__init__.py External tool wrapper exports
src/qprimer_designer/commands/select_multiplex.py CLI command for selecting multiplex primer sets
src/qprimer_designer/commands/prepare_input.py CLI command for preparing ML evaluation input
src/qprimer_designer/commands/pick_representatives.py CLI command for selecting representative sequences
src/qprimer_designer/commands/generate.py CLI command for generating primer candidates
src/qprimer_designer/commands/filter_primers.py CLI command for filtering primers based on scores
src/qprimer_designer/commands/evaluate.py CLI command for ML-based primer evaluation
src/qprimer_designer/commands/build_output.py CLI command for building final primer design output
src/qprimer_designer/commands/__init__.py CLI command module exports
src/qprimer_designer/cli.py Main CLI entry point with subcommand registration
src/qprimer_designer/__init__.py Package initialization with version
setup.sh Removed legacy setup script
pyproject.toml New Python package configuration
environment.yml Streamlined conda environment with top-level dependencies only
README.md Updated documentation for new package structure
Dockerfile New Docker image configuration
CLAUDE.md New development guide
.github/workflows/test.yml New GitHub Actions workflow for testing
.github/workflows/snakemake.yml New GitHub Actions workflow for Snakemake validation
.github/workflows/docker.yml New GitHub Actions workflow for Docker builds
.dockerignore Docker build exclusions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 16, 2026

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

- Use --list-rules for Snakemake syntax validation (py_compile does not
  understand Snakemake syntax)
- Add badges for Tests, Docker Build, and CodeCov

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dpark01 dpark01 requested a review from kbryanhsu January 16, 2026 17:01
@kbryanhsu kbryanhsu merged commit 306bd23 into main Jan 16, 2026
8 checks passed
@dpark01 dpark01 deleted the refactor-python-package branch January 16, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants