Skip to content

Migrate from poetry to uv#191

Merged
d33bs merged 11 commits intocytomining:mainfrom
d33bs:move-to-uv
Mar 3, 2026
Merged

Migrate from poetry to uv#191
d33bs merged 11 commits intocytomining:mainfrom
d33bs:move-to-uv

Conversation

@d33bs
Copy link
Member

@d33bs d33bs commented Feb 13, 2026

Description

This PR migrates from poetry to uv for environment management in the project.

What kind of change(s) are included?

  • Documentation (changes docs or other related content)
  • Bug fix (fixes an issue).
  • Enhancement (adds functionality).
  • Breaking change (these changes would cause existing functionality to not work as expected).

Checklist

Please ensure that all boxes are checked before indicating that this pull request is ready for review.

  • I have read and followed the CONTRIBUTING.md guidelines.
  • I have searched for existing content to ensure this is not a duplicate.
  • I have performed a self-review of these additions (including spelling, grammar, and related).
  • These changes pass all pre-commit checks.
  • I have added comments to my code to help provide understanding
  • I have added a test which covers the code changes found within this PR
  • I have deleted all non-relevant text in this pull request template.

Summary by CodeRabbit

  • Chores

    • Switched primary tooling from Poetry to UV and migrated packaging/versioning to setuptools/PEP 621.
    • Updated CI/CD workflows and pre-commit hooks to use the UV-based flow and adjusted ignore rules for build artifacts.
  • Documentation

    • Revised README, contribution guide, docs, examples, and badges to reference UV and the new workflow.

@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Replaces Poetry-based tooling with uv across CI, docs, and local commands; switches packaging/versioning to setuptools + setuptools-scm and moves metadata to PEP 621 ([project]) in pyproject.toml. Updates pre-commit hooks, CI steps, README badges, and example commands to use uv.

Changes

Cohort / File(s) Summary
GitHub Workflows
.github/workflows/dependabot.yml, .github/workflows/publish-docs.yml, .github/workflows/publish-pypi.yml, .github/workflows/run-tests.yml
Replaced Poetry setup/install/build/test steps with astral-sh/setup-uv@v7 and uv commands. Switched test and build commands to uv run --frozen .... Replaced pre-commit action with j178/prek-action@v1. Removed Poetry version simulation/reset steps.
Project Metadata & Packaging
pyproject.toml
Migrated from Poetry metadata to PEP 621 [project]; changed build backend to setuptools.build_meta and enabled setuptools-scm for versioning. Added [tool.setuptools], [tool.setuptools_scm], [tool.uv], dependency-groups, and updated tooling configs (pytest, coverage, ruff, etc.). Significant restructuring of packaging/config.
Pre-commit & Ignore
.pre-commit-config.yaml, .gitignore
Removed Poetry-specific pre-commit hooks and repo block; updated hook revisions (pyproject-fmt, ruff). Adjusted code-cov-gen to use uv run --frozen. Added _version.py and a build-version comment to .gitignore.
Documentation & READMEs
README.md, docs/src/contributing.md, docs/presentations/2025-sbi2/readme.md
Replaced Poetry badges and example commands with uv equivalents. Revised contributing documentation to reference uv, uv sync, new versioning via setuptools-scm, and updated local/dev/test/build instructions.
Source & Test Scripts (headers/notes only)
src/cytodataframe/__init__.py, tests/data/cytotable/.../gather_and_create_data.py, tests/data/cytotable/.../create_image_data.py, tests/data/cytotable/.../create_mask_data.py
Minor comment/header updates replacing poetry invocation examples with uv. One-line doc tweak in __init__.py. No functional changes to code.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 I hopped from Poetry to uv today,
Swapped badges, builds, and docs along the way,
setuptools-scm hums a tidy tune,
CI steps now dance beneath the moon,
A rabbit's cheer for a cleaner play ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Migrate from poetry to uv' clearly and concisely summarizes the main change across all modified files in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 @coderabbitai help to get the list of available commands and usage tips.

@d33bs d33bs marked this pull request as ready for review February 13, 2026 21:50
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
docs/src/contributing.md (2)

90-112: ⚠️ Potential issue | 🟡 Minor

Update versioning documentation to reflect current tooling.

The documentation references poetry-dynamic-versioning but the project configuration (pyproject.toml) explicitly requires setuptools-scm>=8 and uv-dynamic-versioning. Update lines 92, 95, and 111 to reflect the actual versioning tools used to avoid misleading contributors.

Suggested changes
-We use [`poetry-dynamic-versioning`](https://github.com/mtkennerly/poetry-dynamic-versioning) to help version this software through [`PEP 440`](https://peps.python.org/pep-0440/) standards.
+We use `setuptools-scm` with `uv-dynamic-versioning` to produce `PEP 440` versions.
@@
-`poetry-dynamic-versioning` uses `git` tags to help distinguish version data.
+Versioning uses `git` tags to help distinguish version data.
@@
-CytoDataFrame version specifications are controlled through [`poetry-dynamic-versioning`](https://github.com/mtkennerly/poetry-dynamic-versioning) which leverages [`dunamai`](https://github.com/mtkennerly/dunamai)
+CytoDataFrame version specifications are controlled through `setuptools-scm` and `uv-dynamic-versioning`

18-28: ⚠️ Potential issue | 🟡 Minor

uv sync --all-groups command is correct.

Confirmed per current uv documentation: this is the recommended approach for local development/contributors who want all tooling (lint, test, docs, etc.) installed without listing each group individually.

However, the versioning section (lines 90-96) still references poetry-dynamic-versioning and should be updated to align with the migration to uv. Review whether versioning tooling has been migrated or if this reference is now stale.

🤖 Fix all issues with AI agents
In @.github/dependabot.yml:
- Around line 15-16: Update the misleading comment text that says "every week"
to match the configured interval "monthly" for the Dependabot schedule entries;
locate the comment lines adjacent to the interval: "monthly" (the two
occurrences where the comment currently reads "Check for updates to GitHub
Actions every week") and change the wording to reflect "monthly" so the comment
matches interval: "monthly".

In @.github/workflows/dependabot.yml:
- Around line 31-34: Update the workflow to pin the astral-sh/setup-uv and
j178/prek-action actions to immutable commit SHAs and provide an explicit uv
version via the setup-uv `version` input: replace uses: astral-sh/setup-uv@v7
with uses: astral-sh/setup-uv@<commit-sha> and add a with: version: "0.10.0" (or
project-configured version), and replace uses: j178/prek-action@v1 with uses:
j178/prek-action@<commit-sha> so both actions are tied to full commit SHAs to
prevent CI drift and supply-chain risk.

In @.pre-commit-config.yaml:
- Line 18: The pre-commit hook for pyproject-fmt is pinned to a non-existent
release "v2.16.0"; update the rev value in .pre-commit-config.yaml (the
pyproject-fmt hook's rev) to a real PyPI release such as "v2.12.1" (or the
latest available), then run pre-commit autoupdate / pre-commit install to verify
hooks install correctly; retain the existing hook args and uv.lock usage as-is.

In `@pyproject.toml`:
- Around line 1-3: The pyproject build configuration is incompatible because
uv-dynamic-versioning is a Hatchling-only plugin but build-backend is set to
setuptools.build_meta; either remove "uv-dynamic-versioning" from the requires
list and keep build-backend = "setuptools.build_meta" (relying on
"setuptools-scm" only), or change build-backend to "hatchling.build" and keep
"uv-dynamic-versioning" in requires; update the [build-system] section
accordingly referencing build-backend, requires, and the uv-dynamic-versioning
and setuptools-scm symbols.

In `@tests/data/cytotable/NF1_cellpainting_data_shrunken/create_image_data.py`:
- Around line 5-7: The docstring command references the wrong filename: update
the usage example so it matches the actual script name (create_image_data.py) or
rename the file to create.py to match the docstring; specifically, edit the
top-level comment in create_image_data.py to either change the example command
to `uv run python
tests/data/cytotable/NF1_cellpainting_data_shrunken/create_image_data.py` or
rename the file and update any imports/CI references so they point to
`create.py`.
🧹 Nitpick comments (2)
pyproject.toml (2)

22-43: Remove redundant <3.9 dependency markers.

With requires-python >=3.11, the python_full_version<'3.9' branches are unreachable. Consolidating these reduces confusion and lock churn.

Suggested cleanup
-  "pandas<2.2.2; python_full_version<'3.9'",
-  "pandas>=2.2.2,<3; python_full_version>='3.9'",
+  "pandas>=2.2.2,<3",
@@
-  "pywavelets>=1.4.1,<2; python_full_version<'3.9'",
-  "pywavelets>1.4.1; python_full_version>='3.9'",
+  "pywavelets>1.4.1",
@@
-  "scikit-image>=0.19.3,<0.20; python_full_version<'3.9'",
-  "scikit-image>0.19.3; python_full_version>='3.9'",
+  "scikit-image>0.19.3",

5-21: Align Ruff target-version with the project's Python floor.

requires-python is >=3.11, but tool.ruff.target-version is set to py38 (line 87). Since target-version takes precedence over requires-python, Ruff will only enforce compatibility checks for Python 3.8+, not 3.11+. Update it to py311 to match the actual minimum supported version.

Suggested update
 [tool.ruff]
-target-version = "py38"
+target-version = "py311"

Copy link
Member

@jenna-tomkinson jenna-tomkinson left a comment

Choose a reason for hiding this comment

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

LGTM! I had two general questions but seems like a super easy port over.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
pyproject.toml (1)

32-39: Remove unreachable Python-version dependency branches.

Lines 32–39 contain conditional branches for python_full_version<'3.9', but Line 14 restricts the project to Python >=3.11. These branches are unreachable and should be simplified by keeping only the >=3.9 variants.

♻️ Suggested simplification
-  "pandas<2.2.2; python_full_version<'3.9'",
-  "pandas>=2.2.2,<3; python_full_version>='3.9'",
+  "pandas>=2.2.2,<3",
...
-  "pywavelets>=1.4.1,<2; python_full_version<'3.9'",
-  "pywavelets>1.4.1; python_full_version>='3.9'",
+  "pywavelets>1.4.1",
...
-  "scikit-image>=0.19.3,<0.20; python_full_version<'3.9'",
-  "scikit-image>0.19.3; python_full_version>='3.9'",
+  "scikit-image>0.19.3",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pyproject.toml` around lines 32 - 39, Remove the unreachable
python_full_version<'3.9' conditional branches and keep only the >=3.9 variants:
replace lines like "pandas<2.2.2; python_full_version<'3.9'",
"pywavelets>=1.4.1,<2; python_full_version<'3.9'", and
"scikit-image>=0.19.3,<0.20; python_full_version<'3.9'" with their corresponding
>=3.9 forms (the lines already present: "pandas>=2.2.2,<3;
python_full_version>='3.9'", "pywavelets>1.4.1; python_full_version>='3.9'",
"scikit-image>0.19.3; python_full_version>='3.9'"), removing the conditional
suffixes entirely if you prefer a single unconditional requirement list since
the project requires Python >=3.11.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@pyproject.toml`:
- Around line 32-39: Remove the unreachable python_full_version<'3.9'
conditional branches and keep only the >=3.9 variants: replace lines like
"pandas<2.2.2; python_full_version<'3.9'", "pywavelets>=1.4.1,<2;
python_full_version<'3.9'", and "scikit-image>=0.19.3,<0.20;
python_full_version<'3.9'" with their corresponding >=3.9 forms (the lines
already present: "pandas>=2.2.2,<3; python_full_version>='3.9'",
"pywavelets>1.4.1; python_full_version>='3.9'", "scikit-image>0.19.3;
python_full_version>='3.9'"), removing the conditional suffixes entirely if you
prefer a single unconditional requirement list since the project requires Python
>=3.11.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 074a7eb and 9dc6d7d.

📒 Files selected for processing (2)
  • .pre-commit-config.yaml
  • pyproject.toml

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pyproject.toml`:
- Line 14: The pyproject.toml sets requires-python = ">=3.11,<3.14" so any
dependency entries guarded with the marker "python_full_version<'3.9'" (and
their paired ">=3.9" variants) are unreachable; remove those conditional
dependency branches and collapse each pair into a single unconditional
dependency entry (i.e., delete the "python_full_version<'3.9'" markers and the
redundant >=3.9 alternatives), leaving only the single dependency specification
for each affected package so the TOML contains no dead conditional branches.
- Line 3: Update the setuptools minimum in the pyproject.toml requires array
from "setuptools>=64" to "setuptools>=77.0.0" so the SPDX-style project.license
= "BSD-3-Clause" (PEP 639) is supported; locate the requires = [
"setuptools>=64", "setuptools-scm>=8" ] entry and bump the setuptools version
constraint to "setuptools>=77.0.0".

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9dc6d7d and d3bdc6d.

📒 Files selected for processing (1)
  • pyproject.toml

@d33bs
Copy link
Member Author

d33bs commented Mar 3, 2026

Thank you @jenna-tomkinson for the review! Merging this in now.

@d33bs d33bs merged commit 576fd7d into cytomining:main Mar 3, 2026
9 checks passed
@d33bs d33bs deleted the move-to-uv branch March 3, 2026 22:31
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.

2 participants