Skip to content

Package cp_parallel as an installable library - #11

Merged
jenna-tomkinson merged 7 commits into
WayScience:mainfrom
jenna-tomkinson:add_cp_parallel
Nov 20, 2026
Merged

jenna-tomkinson merged 7 commits into
WayScience:mainfrom
jenna-tomkinson:add_cp_parallel

Conversation

@jenna-tomkinson

Copy link
Copy Markdown
Member

Summary

  • Consolidates the cp_parallel.py/cp_utils.py helper copy-pasted and independently patched across ~15 Way Science repos into one pip/uv-installable package (src/cp_parallel/), covering the union of features those copies accumulated: plate- or well-level grouping, image-directory or LoadData CSV input, batch processing by image-set range, HPC support (CPU-affinity-aware worker counts, Apptainer/Singularity), and per-plate plugin directories.
  • requires-python >=3.8 to match real CellProfiler conda environments — verified installable and importable in several of the actual WayScience CellProfiler conda envs (CellProfiler 4.x on Python 3.8).
  • Adds a full test suite (tests/, 35 tests, 100% coverage, no real CellProfiler/Apptainer binary needed), ruff + pre-commit + GitHub Actions CI (lint, multi-version tests, and a Python 3.8/3.9 install-compat smoke test).
  • Adds a runnable tutorial notebook (examples/cp_parallel_tutorial.ipynb) covering every mode, and a small code-generated SVG logo for the README.
  • README rewritten with installation, usage for every mode, a migration guide for existing repos, and development/linting instructions.

Test plan

  • uv run pytest --cov=cp_parallel — 35 passed, 100% coverage
  • uv run ruff check . / uv run ruff format --check .
  • uv run pre-commit run --all-files
  • Verified pip install + import cp_parallel in real WayScience CellProfiler conda environments (Python 3.8)
  • Tutorial notebook executes end-to-end

🤖 Generated with Claude Code

…mmit, and a tutorial notebook

Consolidates the cp_parallel.py/cp_utils.py helper that has been copy-pasted
and independently patched across ~15 Way Science repos into a single,
pip/uv-installable package covering the union of features those copies
accumulated: plate- or well-level grouping, image-directory or LoadData CSV
input, batch processing by image-set range, HPC support (CPU-affinity-aware
worker counts, Apptainer/Singularity), and per-plate plugin directories.

- src/cp_parallel/: unified run_cellprofiler_parallel implementation,
  packaged with pyproject.toml/uv.lock (requires-python >=3.8 to match real
  CellProfiler conda environments; verified installable and importable there).
- tests/: 35 tests, 100% coverage, no real CellProfiler/Apptainer binary needed.
- .pre-commit-config.yaml + .github/workflows/: ruff lint/format, pytest, and
  a Python 3.8/3.9 install-compat smoke test, all wired into CI.
- examples/cp_parallel_tutorial.ipynb: runnable walkthrough of every mode.
- assets/: a small code-generated SVG logo for the README.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4f7936df-e68a-4b6a-9919-b9202ecb4a23
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Comment thread assets/generate_logo.py Resolved
Comment thread examples/cp_parallel_tutorial.ipynb Resolved

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would avoid the cellprofiler simulation and instead use the real deal. Consider also adding some non-notebook prep for this if needed to help configure for running.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fwiw, I have never been able to get CP to work in anything under python 3.9 - maybe this is the reason for a simulation?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Following up - is there anyway to point to a default/prefered docker image? Or easier to allow for the user to pick?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I made this into an issue so that we can have a new tutorial that shows using CellProfiler in real life, that I can address in a future PR. Thank you both!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Consider showing simply how running in parallel is faster than serial / normal (and by how much) using perhaps simple timing information or a plot.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree with this but I think it needs to be in a separate file/module and is not the goal of a tutorial.

Showing some profiling would be great.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added issue for this to address in another PR, thank you both for this suggestion!

Comment thread src/cp_parallel/cp_parallel.py Resolved
Comment thread pyproject.toml Resolved
Comment thread pyproject.toml Resolved
Comment thread pyproject.toml Resolved
Comment thread pyproject.toml Resolved
Comment thread src/cp_parallel/cp_parallel.py Resolved
Comment thread src/cp_parallel/cp_parallel.py Resolved

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fwiw, I have never been able to get CP to work in anything under python 3.9 - maybe this is the reason for a simulation?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree with this but I think it needs to be in a separate file/module and is not the goal of a tutorial.

Showing some profiling would be great.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Following up - is there anyway to point to a default/prefered docker image? Or easier to allow for the user to pick?

@jenna-tomkinson

Copy link
Copy Markdown
Member Author

@d33bs @MikeLippincott Thank you both for your reviews! I am merging now and hope to address the new issues you both mentioned in a future PR soon!

@jenna-tomkinson
jenna-tomkinson merged commit 50c78b8 into WayScience:main Nov 20, 2026
1 check passed
@jenna-tomkinson
jenna-tomkinson deleted the add_cp_parallel branch November 20, 2026 20:46
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