Skip to content

Conversation

@owenpearson
Copy link
Member

@owenpearson owenpearson commented Dec 1, 2025

Since we migrated to poetry a few years ago, uv has quickly taken over the python ecosystem. The migration from poetry to uv is very straightforward since they both use pyproject.toml, but uv is much faster and seems to be the preferred build tool of the community moving foward.

Summary by CodeRabbit

  • Chores

    • Switched CI and developer workflows to UV-based tooling and enabled UV-native caching; updated dependency install, test, lint and release steps.
  • Refactor

    • Migrated packaging to modern PEP 621 metadata and updated build backend; added structured project metadata, optional dependency groups, entry points, and an external package index.
  • Documentation

    • Updated contributing and release docs and developer instructions to reflect the new tooling and commands.

✏️ Tip: You can customize this high-level summary in your review settings.

@owenpearson owenpearson requested a review from ttypic December 1, 2025 10:24
@coderabbitai
Copy link

coderabbitai bot commented Dec 1, 2025

Walkthrough

CI, docs, and project config migrated from Poetry to UV: workflows now install/cache UV and use uv sync/uv run; CONTRIBUTING commands updated; pyproject.toml converted to PEP 621 with Hatch build backend and a tool.uv.index entry.

Changes

Cohort / File(s) Summary
CI Workflows
.github/workflows/check.yml, .github/workflows/lint.yml, .github/workflows/release.yml
Replaced Poetry setup with UV (astral-sh/setup-uv@v7), enabled UV caching, changed cache key from poetry.lock to uv.lock, switched dependency install to uv sync --extra ..., replaced poetry run ... with uv run ..., removed local venv/health-check steps, and updated build/publish steps to UV equivalents.
Documentation
CONTRIBUTING.md
Replaced Poetry commands with UV equivalents (poetry install -E cryptouv sync --extra crypto; poetry run pytestuv run pytest; poetry run unasyncuv run unasync; poetry build && poetry publishuv build && uv publish).
Project Configuration
pyproject.toml
Migrated from [tool.poetry] to PEP 621 [project] metadata, added [project.dependencies] and [project.optional-dependencies] (with Python markers), added [project.urls] and [project.scripts] (including unasync), switched build-system to Hatch (hatchling), added tool.hatch wheel target, and added [[tool.uv.index]] named experimental. Removed Poetry-specific sections.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

  • Focus review on:
    • pyproject.toml migration: dependency markers, optional groups, build-system and tool.hatch config, and tool.uv.index syntax.
    • CI workflows: astral-sh/setup-uv usage/flags, uv.lock cache keys, uv sync arguments, and uv run substitutions.
    • CONTRIBUTING.md: accuracy of updated commands and any publish instructions.

Poem

🐇 I nibbled at toml in moonlit code,
Swapped Poetry seeds for UV's road,
Hatch spun wheels and baked the wheel,
CI now hums with a lighter squeal,
A tiny hop — new paths to goad 🥕✨

Pre-merge checks and finishing touches

✅ 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 'build: migrate from poetry to uv' accurately summarizes the primary change across all modified files. It clearly identifies the build tool migration as the core objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch uv

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.

@github-actions github-actions bot temporarily deployed to staging/pull/640/features December 1, 2025 10:25 Inactive
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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d0d15ad and 9ebdbea.

⛔ Files ignored due to path filters (2)
  • poetry.lock is excluded by !**/*.lock
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • .github/workflows/check.yml (1 hunks)
  • .github/workflows/lint.yml (1 hunks)
  • .github/workflows/release.yml (1 hunks)
  • CONTRIBUTING.md (2 hunks)
  • pyproject.toml (2 hunks)
🧰 Additional context used
🪛 LanguageTool
CONTRIBUTING.md

[grammar] ~7-~7: Use a hyphen to join words.
Context: ...uv/getting-started/installation/) for up to date instructions on how to install u...

(QB_NEW_EN_HYPHEN)


[grammar] ~7-~7: Use a hyphen to join words.
Context: ...getting-started/installation/) for up to date instructions on how to install uv. ...

(QB_NEW_EN_HYPHEN)

🔇 Additional comments (11)
CONTRIBUTING.md (1)

15-15: UV command migrations look correct.

The Poetry-to-UV command replacements are semantically equivalent and properly aligned with UV's API. uv sync, uv run, uv build, and uv publish are the correct UV equivalents.

Also applies to: 21-21, 41-41, 42-42

.github/workflows/check.yml (1)

32-49: UV workflow setup looks correct.

The migration from Poetry to UV in the CI workflow is properly implemented: the astral-sh/setup-uv action is used with cache enabled, dependencies are installed via uv sync, and commands are updated to uv run equivalents. The cache key correctly references uv.lock instead of poetry.lock.

Ensure that uv.lock is committed to the repository, or if generated on-demand, verify that the first-time setup for this workflow will generate it correctly.

.github/workflows/lint.yml (1)

22-37: Lint workflow migration is consistent and correct.

The changes align with the check.yml migration pattern. The UV setup and cache configuration are identical, and the lint commands (uv sync and uv run flake8) are properly updated. Note that the --extra crypto dependency is appropriately omitted here since it's not needed for linting.

.github/workflows/release.yml (1)

24-41: Release workflow migration is complete and correct.

The UV setup, caching, and command updates are consistent with other workflows. The crypto extra is appropriately included for the release build, and the uv run unasync step correctly generates the sync code before building. The verification steps for ably/sync/ in the distribution packages are well-designed safeguards.

Confirm that uv build properly respects the Hatch wheel configuration specified in pyproject.toml (lines 73-74), particularly the packages = ["ably"] setting.

pyproject.toml (7)

1-26: PEP 621 metadata migration is correct.

The [project] section properly replaces [tool.poetry] with standard PEP 621 format. Metadata is complete: requires-python, license (SPDX format), authors, and classifiers including Python 3.13. The configuration is well-formed.


27-38: Dependency migration with environment markers is correct.

The conversion to PEP 621 dependencies array with environment markers (python_version) is proper. Version constraints are preserved, and conditional dependencies for different Python versions are maintained. The marker syntax is standard and compatible with UV.


40-60: Optional dependencies properly migrated.

The [project.optional-dependencies] section correctly replaces Poetry extras. All extras (oldcrypto, crypto, vcdiff, dev) are properly defined with their dependencies and conditional markers. The structure is compatible with UV's dependency resolution.


69-74: Build system migration to Hatch is appropriate.

The switch from Poetry to Hatch (hatchling) as the build backend is correct for PEP 517/518 compliance. The wheel target configuration with packages = ["ably"] is correct. Verify that this configuration will properly include generated sync code from unasync during the build process.

Confirm that the Hatch build configuration will correctly include the dynamically generated ably/sync/ directory in the wheel. You may need to verify the pyproject.toml for any additional Hatch build directives or check if an existing hatch.toml file specifies the build behavior for the async→sync code generation.


79-82: UV index configuration looks correct for test PyPI.

The [[tool.uv.index]] entry defines an experimental PyPI source. The explicit = true setting means this index is used only for explicitly selected packages. This configuration is standard for UV and allows accessing pre-release or experimental packages from test.pypi.org.


62-63: Verify the unasync script entry point exists and is correctly configured.

The new [project.scripts] entry creates an entrypoint that allows uv run unasync to invoke the unasync code generator. This is essential for the migration to work, as the workflows call uv run unasync (lines 47 in check.yml, line 39 in release.yml). The file ably/scripts/unasync.py exists and contains the run() function at line 237, and ably/scripts/__init__.py is present. The entrypoint is correctly configured.


1-82: pyproject.toml migration to PEP 621 + Hatch is complete and valid.

No remaining Poetry configuration sections found, TOML syntax is valid, and all required PEP 621 fields are present.

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: 0

♻️ Duplicate comments (3)
CONTRIBUTING.md (1)

7-7: Fix hyphenation in compound adjective.

This was already flagged in a previous review. When used before a noun, "up to date" should be hyphenated as "up-to-date".

-ably-python uses [uv](https://docs.astral.sh/uv/) for packaging and dependency management. Please refer to the [uv documentation](https://docs.astral.sh/uv/getting-started/installation/) for up to date instructions on how to install uv.
+ably-python uses [uv](https://docs.astral.sh/uv/) for packaging and dependency management. Please refer to the [uv documentation](https://docs.astral.sh/uv/getting-started/installation/) for up-to-date instructions on how to install uv.
.github/workflows/lint.yml (1)

22-25: Update astral-sh/setup-uv to v7 (consistent with check.yml).

This workflow uses v4 like the others. See the review comment on check.yml for the recommended update to v7 across all workflows.

-      - name: Install uv
-        uses: astral-sh/setup-uv@v4
+      - name: Install uv
+        uses: astral-sh/setup-uv@v7
         with:
           enable-cache: true
.github/workflows/release.yml (1)

24-27: Update astral-sh/setup-uv to v7 (consistent with check.yml).

See the review comment on check.yml for the recommended update to v7 across all workflows.

-      - name: Install uv
-        uses: astral-sh/setup-uv@v4
+      - name: Install uv
+        uses: astral-sh/setup-uv@v7
         with:
           enable-cache: true
🧹 Nitpick comments (1)
.github/workflows/check.yml (1)

32-35: Update astral-sh/setup-uv to the latest version.

The current documentation examples show astral-sh/setup-uv@v7, but this workflow uses v4. Consider updating all workflows to v7 to benefit from recent improvements and fixes.

-      - name: Install uv
-        uses: astral-sh/setup-uv@v4
+      - name: Install uv
+        uses: astral-sh/setup-uv@v7
         with:
           enable-cache: true

This update should also be applied to .github/workflows/lint.yml and .github/workflows/release.yml for consistency.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9ebdbea and 1d09cee.

⛔ Files ignored due to path filters (2)
  • poetry.lock is excluded by !**/*.lock
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • .github/workflows/check.yml (1 hunks)
  • .github/workflows/lint.yml (1 hunks)
  • .github/workflows/release.yml (1 hunks)
  • CONTRIBUTING.md (2 hunks)
  • pyproject.toml (2 hunks)
🧰 Additional context used
🪛 LanguageTool
CONTRIBUTING.md

[grammar] ~7-~7: Use a hyphen to join words.
Context: ...uv/getting-started/installation/) for up to date instructions on how to install u...

(QB_NEW_EN_HYPHEN)


[grammar] ~7-~7: Use a hyphen to join words.
Context: ...getting-started/installation/) for up to date instructions on how to install uv. ...

(QB_NEW_EN_HYPHEN)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: check (3.7)
  • GitHub Check: check (3.9)
  • GitHub Check: check (3.13)
  • GitHub Check: check (3.11)
  • GitHub Check: check (3.10)
  • GitHub Check: check (3.8)
  • GitHub Check: check (3.12)
🔇 Additional comments (3)
.github/workflows/release.yml (1)

48-67: Good validation logic for build artifacts.

The checks that verify ably/sync/ is present in both wheel and tarball are excellent safeguards to prevent shipping incomplete builds. This is solid defensive programming.

pyproject.toml (2)

79-82: Clarify the purpose of the experimental UV index.

The configuration points to test.pypi.org with explicit = true, which means it's only used for dependencies that explicitly request it. Verify this is intentional—are there dependencies that require packages from test.pypi.org, or is this a remnant from an earlier configuration?

If this index is no longer needed, consider removing it to simplify the configuration:

-[[tool.uv.index]]
-name = "experimental"
-url = "https://test.pypi.org/simple/"
-explicit = true

1-82: Migration to PEP 621 and hatchling is comprehensive and well-executed.

The [project] table format is the standard used by most modern build backends, and hatchling is a standards-compliant build backend. The dependency specifications with Python version guards are correct, and the migration from Poetry's proprietary format appears complete.

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: 0

♻️ Duplicate comments (1)
CONTRIBUTING.md (1)

7-7: Fix hyphenation: "up to date" → "up-to-date"

When used as a compound adjective before a noun, "up to date" should be hyphenated.

Apply this diff:

-ably-python uses [uv](https://docs.astral.sh/uv/) for packaging and dependency management. Please refer to the [uv documentation](https://docs.astral.sh/uv/getting-started/installation/) for up to date instructions on how to install uv.
+ably-python uses [uv](https://docs.astral.sh/uv/) for packaging and dependency management. Please refer to the [uv documentation](https://docs.astral.sh/uv/getting-started/installation/) for up-to-date instructions on how to install uv.
🧹 Nitpick comments (1)
pyproject.toml (1)

62-82: Remove unused TestPyPI experimental index or document its purpose.

The Hatchling build configuration is correctly set up for this project. The unasync code generation runs as a pre-build step in CI/CD (before uv build), and Hatchling simply packages the generated code—no build hooks are needed. However, the [[tool.uv.index]] entry pointing to TestPyPI has zero references in uv.lock and is not used in any workflows. Either remove this configuration if it's no longer needed, or add a comment explaining its purpose.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1d09cee and 776a1af.

⛔ Files ignored due to path filters (2)
  • poetry.lock is excluded by !**/*.lock
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • .github/workflows/check.yml (1 hunks)
  • .github/workflows/lint.yml (1 hunks)
  • .github/workflows/release.yml (2 hunks)
  • CONTRIBUTING.md (2 hunks)
  • pyproject.toml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/lint.yml
  • .github/workflows/check.yml
🧰 Additional context used
🪛 LanguageTool
CONTRIBUTING.md

[grammar] ~7-~7: Use a hyphen to join words.
Context: ...uv/getting-started/installation/) for up to date instructions on how to install u...

(QB_NEW_EN_HYPHEN)


[grammar] ~7-~7: Use a hyphen to join words.
Context: ...getting-started/installation/) for up to date instructions on how to install uv. ...

(QB_NEW_EN_HYPHEN)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: check (3.13)
  • GitHub Check: check (3.9)
  • GitHub Check: check (3.11)
  • GitHub Check: check (3.7)
  • GitHub Check: check (3.12)
  • GitHub Check: check (3.8)
  • GitHub Check: check (3.10)
🔇 Additional comments (6)
CONTRIBUTING.md (1)

15-15: Command migration to uv looks good.

The updates correctly translate Poetry workflow commands to their uv equivalents. The --extra flag usage, uv run delegation, and build/publish commands are all properly formed.

Also applies to: 21-21, 41-42

.github/workflows/release.yml (2)

24-27: Verify uv venv caching strategy.

The cache key transition from poetry.lock to uv.lock is correct. However, confirm that caching ./.venv is compatible with uv's default behavior. By default, uv may use a system-wide cache directory rather than a project-local .venv. Verify one of the following:

  • Whether uv sync in line 37 is configured to populate ./.venv (may require UV_PYTHON_PREFERENCE or env setup)
  • Whether the cache path should instead target uv's system cache directory
  • Whether .github/workflows/check.yml and .github/workflows/lint.yml (if they exist) use a consistent caching approach

Also applies to: 34-34, 37-37


39-41: Build and codegen commands are properly updated.

The transitions from poetry run unasync and poetry build to their uv run and uv build equivalents are correct.

pyproject.toml (3)

1-26: Project metadata migration to PEP 621 is correct.

The transition from Poetry-style metadata to PEP 621 is properly formatted. Python version constraint (>=3.7) aligns with classifiers, and required fields are present.


40-60: Optional dependencies are properly structured.

The [project.optional-dependencies] groups (oldcrypto, crypto, vcdiff, dev) are correctly defined with appropriate version constraints and Python version guards (e.g., respx). Verify that these extras match the original Poetry configuration and that no extras have been inadvertently omitted.


27-38: Dependency constraints are correctly migrated from Poetry to PEP 621 format.

All Python version-specific constraints for httpx, websockets, and pyee have been accurately converted and match the original Poetry configuration. The version ranges and PEP 508 environment markers (e.g., python_version=='3.7') are syntactically correct and support Python 3.7–3.13 as specified in the project classifiers.

Copy link
Contributor

@ttypic ttypic left a comment

Choose a reason for hiding this comment

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

LGTM

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: 1

♻️ Duplicate comments (1)
CONTRIBUTING.md (1)

7-7: Fix hyphenation in compound adjective.

The phrase "up to date" should be hyphenated when used as a compound adjective before a noun.

-ably-python uses [uv](https://docs.astral.sh/uv/) for packaging and dependency management. Please refer to the [uv documentation](https://docs.astral.sh/uv/getting-started/installation/) for up to date instructions on how to install uv.
+ably-python uses [uv](https://docs.astral.sh/uv/) for packaging and dependency management. Please refer to the [uv documentation](https://docs.astral.sh/uv/getting-started/installation/) for up-to-date instructions on how to install uv.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 776a1af and 9335676.

⛔ Files ignored due to path filters (2)
  • poetry.lock is excluded by !**/*.lock
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • .github/workflows/check.yml (1 hunks)
  • .github/workflows/lint.yml (1 hunks)
  • .github/workflows/release.yml (2 hunks)
  • CONTRIBUTING.md (1 hunks)
  • pyproject.toml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/check.yml
  • .github/workflows/release.yml
🧰 Additional context used
🪛 LanguageTool
CONTRIBUTING.md

[grammar] ~7-~7: Use a hyphen to join words.
Context: ...uv/getting-started/installation/) for up to date instructions on how to install u...

(QB_NEW_EN_HYPHEN)


[grammar] ~7-~7: Use a hyphen to join words.
Context: ...getting-started/installation/) for up to date instructions on how to install uv. ...

(QB_NEW_EN_HYPHEN)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: check (3.11)
  • GitHub Check: check (3.9)
  • GitHub Check: check (3.8)
  • GitHub Check: check (3.13)
  • GitHub Check: check (3.12)
  • GitHub Check: check (3.10)
  • GitHub Check: check (3.7)
🔇 Additional comments (5)
CONTRIBUTING.md (1)

15-15: LGTM!

The uv command equivalents are correct: uv sync --extra crypto for dependency installation and uv run pytest for test execution. The migration from Poetry is straightforward here.

Also applies to: 21-21

pyproject.toml (3)

1-37: LGTM! PEP 621 migration looks correct.

The [project] section properly mirrors the Poetry metadata with appropriate version constraints and environment markers. Python version guards for httpx, websockets, and pyee are correctly formatted.


39-59: LGTM! Optional dependencies properly preserved.

All optional dependency groups (oldcrypto, crypto, vcdiff, dev) are correctly migrated with their version constraints and environment markers intact.


61-73: LGTM! Build system and scripts configured correctly.

The Hatch build backend is properly configured with the wheel package specification, and the unasync script entrypoint is correctly defined. Project URLs are also properly set.

.github/workflows/lint.yml (1)

22-25: LGTM! Clean migration to uv.

The workflow correctly uses the official astral-sh/setup-uv@v7 action with caching enabled, and all commands are proper uv equivalents. Cache key correctly references uv.lock for reproducibility. The uv.lock file is properly committed to version control, ensuring reproducible builds across CI environments.

@owenpearson owenpearson merged commit 101e2b5 into main Dec 1, 2025
9 of 10 checks passed
@owenpearson owenpearson deleted the uv branch December 1, 2025 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants