Skip to content

Migrate from poetry to uv for env and package management#461

Open
d33bs wants to merge 4 commits into
cytomining:mainfrom
d33bs:migrate-to-uv
Open

Migrate from poetry to uv for env and package management#461
d33bs wants to merge 4 commits into
cytomining:mainfrom
d33bs:migrate-to-uv

Conversation

@d33bs
Copy link
Copy Markdown
Member

@d33bs d33bs commented Jun 3, 2026

Description

This PR migrates from poetry to uv for environment and package management.

What is the nature of your change?

  • Bug fix (fixes an issue).
  • Enhancement (adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).
  • This change requires a documentation update.

Checklist

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

  • I have read the CONTRIBUTING.md guidelines.
  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • New and existing unit tests pass locally with my changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have deleted all non-relevant text in this pull request template.

Summary by CodeRabbit

  • Chores

    • Migrated from Poetry to uv across CI, publishing, testing, and local development workflows
    • Switched versioning to setuptools-scm and updated project metadata to PEP 621 format
    • Removed Poetry-specific CI/pre-commit hooks and related setup steps
  • Bug Fixes

    • Package now resolves its version at import with a safe fallback when metadata is absent
  • Documentation

    • Updated contributing guide and README badges to reflect uv-based workflow; enabled Sphinx doctest support

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ba21bc3c-530b-4405-b00b-fb7bc1a627ef

📥 Commits

Reviewing files that changed from the base of the PR and between e25c2a0 and d8cef56.

📒 Files selected for processing (4)
  • .github/workflows/test.yml
  • docs/source/conf.py
  • docs/source/contributing.md
  • pyproject.toml
✅ Files skipped from review due to trivial changes (2)
  • docs/source/conf.py
  • docs/source/contributing.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/test.yml
  • pyproject.toml

📝 Walkthrough

Walkthrough

This PR migrates the project's package management from Poetry to uv and switches versioning from poetry-dynamic-versioning to setuptools-scm. The build backend in pyproject.toml now uses setuptools with PEP 621 project metadata, dependencies are reorganized into standard sections, CI/CD workflows are updated to use uv instead of Poetry commands, and version resolution is simplified to use runtime metadata lookups.

Changes

Poetry to uv and setuptools-scm Migration

Layer / File(s) Summary
Build system and project configuration
pyproject.toml
build-system switches from Poetry to setuptools.build_meta with setuptools-scm; project metadata migrates to PEP 621 [project]; dependencies consolidate with Python-version markers; optional extras become [project.optional-dependencies]; development and documentation dependencies reorganize into [dependency-groups]; setuptools package discovery and SCM versioning are configured.
Version resolution and generated files
cytotable/__init__.py, cytotable/utils.py, .gitignore
cytotable.__version__ now resolves dynamically via importlib.metadata.version("CytoTable") with fallback to "0.0.0"; _get_cytotable_version() simplifies to return __version__ directly without dunamai VCS lookups; .gitignore excludes the generated cytotable/_version.py file.
CI/CD workflows and tooling configuration
.github/actions/setup-poetry/action.yml, .github/dependabot.yml, .github/workflows/test.yml, .github/workflows/publish-docs.yml, .github/workflows/publish-pypi.yml, .pre-commit-config.yaml
Custom setup-poetry GitHub Action is removed; dependabot.yml switches from pip/Poetry to uv with monthly schedule and cooldown; poetry-check pre-commit hook is removed; all test, publish-docs, and publish-pypi workflows transition from Poetry steps to uv-based installation with frozen environment synchronization and uv run invocations.
Documentation and developer guidance
docs/source/contributing.md, readme.md, tests/data/in-carta/colas-lab/shrink_colas_lab_data_for_tests.py, docs/source/conf.py
Development instructions switch from Poetry to uv, including environment setup and uv run commands for tests/builds; release versioning explanation now references setuptools-scm and git tags; README badge swaps from Poetry to uv; test data script docstring updated to use uv run python; Sphinx doctest extension added.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Poem

🐰 From Poetry's verses to uv's swift stride,
We swap our build tools with scientific pride,
setuptools-scm guides the version bright,
Frozen lockfiles lock in the right,
A migration complete—our package takes flight! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: migrating the project from Poetry to uv for environment and package management, which is the central theme across all modified files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Copy link
Copy Markdown
Member Author

d33bs commented Jun 3, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@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: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/publish-docs.yml:
- Around line 20-23: The workflow currently references the third-party action as
"uses: astral-sh/setup-uv@v6", which is a floating tag; replace this with the
action pinned to a specific full commit SHA (e.g.,
"astral-sh/setup-uv@<full-commit-sha>") so the workflow is reproducible. Locate
the "uses: astral-sh/setup-uv@v6" entry in the publish-docs.yml file and update
it to the full commit SHA for the v6 release (obtain the SHA from the action's
GitHub repo tags or releases) and keep the existing "with:" inputs unchanged.
Ensure the updated line uses the exact 40-character commit SHA string.

In @.github/workflows/publish-pypi.yml:
- Around line 25-28: Replace the floating tag for the third-party action used in
the publish job: change the uses entry "astral-sh/setup-uv@v6" to the specific
commit SHA (e.g. "astral-sh/setup-uv@<full-commit-sha>") so the publish workflow
pins the exact action version; update the YAML in the publish job where the
action is referenced to use the full commit SHA instead of "v6".

In @.github/workflows/test.yml:
- Around line 36-41: The workflow misses the dev dependency group needed for
tests; update the steps that install and run tests (the "Install frozen
environment", "Run sphinx-docs build test", and "Run pytest" steps) to sync and
run with the dev group included (e.g., add --group dev to the uv sync command
and include --group dev or ensure uv run uses the synced env for the pytest and
sphinx-build steps) so pytest and test-only packages from
[dependency-groups].dev are available on a clean runner.
- Around line 30-33: The workflow uses a floating tag for the setup-uv action
("name: Setup uv" with "uses: astral-sh/setup-uv@v6"); replace the floating tag
with a specific commit SHA to pin the action for reproducible CI and
supply-chain safety. Update both occurrences of the step (the ones currently
using "astral-sh/setup-uv@v6") to use the corresponding commit SHA (e.g.,
"astral-sh/setup-uv@<full-commit-sha>") so the workflow references an immutable
revision.

In `@docs/source/contributing.md`:
- Line 165: Replace the incorrect sphinx-build invocation that uses "docs/source
doctest -W" (which treats "doctest" as the output dir) with an explicit builder
flag so doctest is run as the builder; update the command in the contributing
docs to use the builder option (e.g., "-b doctest" or "--builder doctest") with
the same source dir and warning flag so contributors run Sphinx doctest checks
correctly.

In `@pyproject.toml`:
- Around line 2-3: Update the build-system requirement to ensure SPDX parsing
for [project].license by raising the setuptools minimum in the pyproject.toml
build-system.requires entry (currently "setuptools>=64") to at least
"setuptools>=77.0.0" so the project-level license string (e.g., license =
"BSD-3-Clause") is parsed correctly; alternatively revert to the legacy license
table form if you cannot bump setuptools.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 20bf56e9-c219-4bf7-8614-465c62239baf

📥 Commits

Reviewing files that changed from the base of the PR and between 1d364f1 and e25c2a0.

⛔ Files ignored due to path filters (2)
  • poetry.lock is excluded by !**/*.lock
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • .github/actions/setup-poetry/action.yml
  • .github/dependabot.yml
  • .github/workflows/publish-docs.yml
  • .github/workflows/publish-pypi.yml
  • .github/workflows/test.yml
  • .gitignore
  • .pre-commit-config.yaml
  • cytotable/__init__.py
  • cytotable/utils.py
  • docs/source/contributing.md
  • pyproject.toml
  • readme.md
  • tests/data/in-carta/colas-lab/shrink_colas_lab_data_for_tests.py
💤 Files with no reviewable changes (2)
  • .github/actions/setup-poetry/action.yml
  • .pre-commit-config.yaml

Comment thread .github/workflows/publish-docs.yml
Comment thread .github/workflows/publish-pypi.yml
Comment thread .github/workflows/test.yml
Comment thread .github/workflows/test.yml Outdated
Comment thread docs/source/contributing.md Outdated
Comment thread pyproject.toml Outdated
@d33bs d33bs marked this pull request as ready for review June 5, 2026 03:10
@d33bs d33bs requested a review from gwaybio as a code owner June 5, 2026 03:10
Copy link
Copy Markdown
Member

@gwaybio gwaybio left a comment

Choose a reason for hiding this comment

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

🎉

Comment thread cytotable/utils.py
try:
# attempt to gather the development version from dunamai
# for scenarios where cytotable from source is used.
import dunamai
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.

is this a dependency to remove from anywhere?

Comment thread pyproject.toml
numpy = [
{ version = "<=1.24.4", python = "<3.11" },
{ version = ">=1.26.0", python = ">=3.11" },
keywords = [ "cellprofiler", "python", "single-cell-analysis", "way-lab" ]
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.

Suggested change
keywords = [ "cellprofiler", "python", "single-cell-analysis", "way-lab" ]
keywords = [ "cellprofiler", "image-based-profiling", "python", "single-cell-analysis" ]

Good to keep lab agnostic

Comment thread pyproject.toml
typing-extensions = "^4.14.0"
[dependency-groups]
dev = [
"cytominer-database>=0.3.4,<0.4",
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.

ok to drop?

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