-
Notifications
You must be signed in to change notification settings - Fork 27
build: migrate from poetry to uv #640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughCI, docs, and project config migrated from Poetry to UV: workflows now install/cache UV and use Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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.
⛔ Files ignored due to path filters (2)
poetry.lockis excluded by!**/*.lockuv.lockis 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, anduv publishare 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-uvaction is used with cache enabled, dependencies are installed viauv sync, and commands are updated touv runequivalents. The cache key correctly referencesuv.lockinstead ofpoetry.lock.Ensure that
uv.lockis 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 syncanduv run flake8) are properly updated. Note that the--extra cryptodependency 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
cryptoextra is appropriately included for the release build, and theuv run unasyncstep correctly generates the sync code before building. The verification steps forably/sync/in the distribution packages are well-designed safeguards.Confirm that
uv buildproperly respects the Hatch wheel configuration specified inpyproject.toml(lines 73-74), particularly thepackages = ["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 thepyproject.tomlfor any additional Hatch build directives or check if an existinghatch.tomlfile 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 = truesetting 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 unasyncto invoke the unasync code generator. This is essential for the migration to work, as the workflows calluv run unasync(lines 47 in check.yml, line 39 in release.yml). The fileably/scripts/unasync.pyexists and contains therun()function at line 237, andably/scripts/__init__.pyis 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.
There was a problem hiding this 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: Updateastral-sh/setup-uvto v7 (consistent with check.yml).This workflow uses
v4like the others. See the review comment oncheck.ymlfor 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: Updateastral-sh/setup-uvto v7 (consistent with check.yml).See the review comment on
check.ymlfor 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: Updateastral-sh/setup-uvto the latest version.The current documentation examples show
astral-sh/setup-uv@v7, but this workflow usesv4. 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: trueThis update should also be applied to
.github/workflows/lint.ymland.github/workflows/release.ymlfor 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.
⛔ Files ignored due to path filters (2)
poetry.lockis excluded by!**/*.lockuv.lockis 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.
There was a problem hiding this 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
unasynccode generation runs as a pre-build step in CI/CD (beforeuv 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 inuv.lockand 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.
⛔ Files ignored due to path filters (2)
poetry.lockis excluded by!**/*.lockuv.lockis 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
--extraflag usage,uv rundelegation, 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.locktouv.lockis correct. However, confirm that caching./.venvis 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 syncin line 37 is configured to populate./.venv(may requireUV_PYTHON_PREFERENCEor env setup)- Whether the cache path should instead target uv's system cache directory
- Whether
.github/workflows/check.ymland.github/workflows/lint.yml(if they exist) use a consistent caching approachAlso applies to: 34-34, 37-37
39-41: Build and codegen commands are properly updated.The transitions from
poetry run unasyncandpoetry buildto theiruv runanduv buildequivalents 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.
ttypic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this 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.
⛔ Files ignored due to path filters (2)
poetry.lockis excluded by!**/*.lockuv.lockis 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 cryptofor dependency installation anduv run pytestfor 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, andpyeeare 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
unasyncscript 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@v7action with caching enabled, and all commands are proper uv equivalents. Cache key correctly referencesuv.lockfor reproducibility. Theuv.lockfile is properly committed to version control, ensuring reproducible builds across CI environments.
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
Refactor
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.