Migrate from poetry to uv #542
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Migrate from Poetry to uv
Summary
This PR migrates the project from Poetry to uv, a fast Python package and project manager written in Rust. This migration improves CI/CD performance and provides a more modern dependency management experience while maintaining full compatibility with existing workflows.
This change should shave about 90 seconds off our total CI runtime since the setup-poetry action being replaced took about 25 seconds longer to run each time.
Changes
Core Configuration
pyproject.toml: Converted from Poetry format to PEP 621 standard format[tool.poetry]to[project][project.dependencies]and[project.optional-dependencies]poetry-coretohatchlingdev,types) and extras (grpc,asyncio) to uv's optional-dependencies formatuv.lock: Generated new lock file (replacespoetry.lock)Makefile Updates
All Poetry commands replaced with uv equivalents:
poetry install -E grpc→uv sync --extra grpcpoetry run <command>→uv run <command>poetry build→uv buildpoetry publish→uv publishpoetry version→ custom script to read version from pyproject.tomlCI/CD Updates
New action:
.github/actions/setup-uv/action.ymlastral-sh/setup-uv@v4for automatic cachingenable_cacheparameter (mapped tosave-cache) to disable caching for dependency testsUpdated workflows:
testing-unit.yaml- Updated to use setup-uv actiontesting-integration.yaml- Updated to use setup-uv actionpublish-to-pypi.yaml- Updated version bumping logic (replacespoetry versionwith Python script)on-merge.yaml- Updated package check to useuv buildUpdated composite actions:
run-integration-test/action.yaml- Replacedpoetry run pytestwithuv run pytestbuild-docs/action.yml- Updated to use setup-uv anduv run sphinx-buildtest-dependency-rest/action.yaml- Updated to useuv addanduv run pytesttest-dependency-grpc/action.yaml- Updated to useuv addanduv run pytesttest-dependency-asyncio-rest/action.yaml- Updated to useuv addanduv run pytestScripts
codegen/build-oas.sh- Replacedpoetry run ruff formatwithuv run ruff formatDocumentation
Updated all documentation to reflect uv usage:
docs/maintainers/testing-guide.md- Allpoetry runcommands →uv rundocs/maintainers/debugging.md- Updated command examplesMAINTAINERS.md- Updated setup instructions and commandsCONTRIBUTING.md- Updated development workflow from Poetry to uvREADME.md- Already had uv instructions, kept Poetry as alternative for usersBenefits
Migration Notes
For Developers
uv sync --extra grpc --extra asyncio(replacespoetry install -E grpc -E asyncio)uv run <command>instead ofpoetry run <command>uv run replinstead ofpoetry run replCommand Equivalents
poetry installuv syncpoetry install -E grpcuv sync --extra grpcpoetry install --with typesuv sync --extra typespoetry install --without devuv sync --no-group dev(or omit--extra dev)poetry run <cmd>uv run <cmd>poetry add <pkg>uv add <pkg>poetry builduv buildpoetry publishuv publishTesting
uv syncworks with all extrasuv run replworks correctlymake versionworksmake packageworksuv run mypy pineconeworksuv sync --extra grpc --extra asyncio --extra typesBreaking Changes
None. All functionality is preserved, only the tooling has changed.
Next Steps
uv.lockby runninguv synclocally (already done in this PR)Files Changed
pyproject.toml- Converted to uv formatMakefile- Updated all commands.github/actions/setup-uv/action.yml- New action (replaces setup-poetry).github/workflows/*.yaml- Updated workflows.github/actions/*/action.yaml- Updated composite actionscodegen/build-oas.sh- Updated scriptMigrate from Poetry to uv
Summary
This PR migrates the project from Poetry to uv, a fast Python package and project manager written in Rust. This migration improves CI/CD performance and provides a more modern dependency management experience while maintaining full compatibility with existing workflows.
Changes
Core Configuration
pyproject.toml: Converted from Poetry format to PEP 621 standard format[tool.poetry]to[project][project.dependencies]and[project.optional-dependencies]poetry-coretohatchlingdev,types) and extras (grpc,asyncio) to uv's optional-dependencies formatuv.lock: Generated new lock file (replacespoetry.lock)Makefile Updates
All Poetry commands replaced with uv equivalents:
poetry install -E grpc→uv sync --extra grpcpoetry run <command>→uv run <command>poetry build→uv buildpoetry publish→uv publishpoetry version→ custom script to read version from pyproject.tomlCI/CD Updates
New action:
.github/actions/setup-uv/action.ymlastral-sh/setup-uv@v4for automatic cachingenable_cacheparameter (mapped tosave-cache) to disable caching for dependency testsUpdated workflows:
testing-unit.yaml- Updated to use setup-uv actiontesting-integration.yaml- Updated to use setup-uv actionpublish-to-pypi.yaml- Updated version bumping logic (replacespoetry versionwith Python script)on-merge.yaml- Updated package check to useuv buildUpdated composite actions:
run-integration-test/action.yaml- Replacedpoetry run pytestwithuv run pytestbuild-docs/action.yml- Updated to use setup-uv anduv run sphinx-buildtest-dependency-rest/action.yaml- Updated to useuv addanduv run pytesttest-dependency-grpc/action.yaml- Updated to useuv addanduv run pytesttest-dependency-asyncio-rest/action.yaml- Updated to useuv addanduv run pytestScripts
codegen/build-oas.sh- Replacedpoetry run ruff formatwithuv run ruff formatDocumentation
Updated all documentation to reflect uv usage:
docs/maintainers/testing-guide.md- Allpoetry runcommands →uv rundocs/maintainers/debugging.md- Updated command examplesMAINTAINERS.md- Updated setup instructions and commandsCONTRIBUTING.md- Updated development workflow from Poetry to uvREADME.md- Already had uv instructions, kept Poetry as alternative for usersBenefits
Migration Notes
For Developers
uv sync --extra grpc --extra asyncio(replacespoetry install -E grpc -E asyncio)uv run <command>instead ofpoetry run <command>uv run replinstead ofpoetry run replCommand Equivalents
poetry installuv syncpoetry install -E grpcuv sync --extra grpcpoetry install --with typesuv sync --extra typespoetry install --without devuv sync --no-group dev(or omit--extra dev)poetry run <cmd>uv run <cmd>poetry add <pkg>uv add <pkg>poetry builduv buildpoetry publishuv publishTesting
uv syncworks with all extrasuv run replworks correctlymake versionworksmake packageworksuv run mypy pineconeworksuv sync --extra grpc --extra asyncio --extra typesBreaking Changes
None. All functionality is preserved, only the tooling has changed.
Next Steps
uv.lockby runninguv synclocally (already done in this PR)Files Changed
pyproject.toml- Converted to uv formatMakefile- Updated all commands.github/actions/setup-uv/action.yml- New action (replaces setup-poetry).github/workflows/*.yaml- Updated workflows.github/actions/*/action.yaml- Updated composite actionscodegen/build-oas.sh- Updated script