Skip to content

Conversation

@jhamon
Copy link
Collaborator

@jhamon jhamon commented Nov 15, 2025

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

    • Converted [tool.poetry] to [project]
    • Moved dependencies to [project.dependencies] and [project.optional-dependencies]
    • Updated build system from poetry-core to hatchling
    • Converted Poetry groups (dev, types) and extras (grpc, asyncio) to uv's optional-dependencies format
    • Preserved all version constraints and Python version requirements
  • uv.lock: Generated new lock file (replaces poetry.lock)

Makefile Updates

All Poetry commands replaced with uv equivalents:

  • poetry install -E grpcuv sync --extra grpc
  • poetry run <command>uv run <command>
  • poetry builduv build
  • poetry publishuv publish
  • poetry version → custom script to read version from pyproject.toml

CI/CD Updates

  • New action: .github/actions/setup-uv/action.yml

    • Uses astral-sh/setup-uv@v4 for automatic caching
    • Supports enable_cache parameter (mapped to save-cache) to disable caching for dependency tests
    • Cache suffix includes extras configuration for proper cache isolation
  • Updated workflows:

    • testing-unit.yaml - Updated to use setup-uv action
    • testing-integration.yaml - Updated to use setup-uv action
    • publish-to-pypi.yaml - Updated version bumping logic (replaces poetry version with Python script)
    • on-merge.yaml - Updated package check to use uv build
  • Updated composite actions:

    • run-integration-test/action.yaml - Replaced poetry run pytest with uv run pytest
    • build-docs/action.yml - Updated to use setup-uv and uv run sphinx-build
    • test-dependency-rest/action.yaml - Updated to use uv add and uv run pytest
    • test-dependency-grpc/action.yaml - Updated to use uv add and uv run pytest
    • test-dependency-asyncio-rest/action.yaml - Updated to use uv add and uv run pytest

Scripts

  • codegen/build-oas.sh - Replaced poetry run ruff format with uv run ruff format

Documentation

Updated all documentation to reflect uv usage:

  • docs/maintainers/testing-guide.md - All poetry run commands → uv run
  • docs/maintainers/debugging.md - Updated command examples
  • MAINTAINERS.md - Updated setup instructions and commands
  • CONTRIBUTING.md - Updated development workflow from Poetry to uv
  • README.md - Already had uv instructions, kept Poetry as alternative for users

Benefits

  1. Performance: uv is significantly faster than Poetry for dependency resolution and installation
  2. CI/CD improvements: Faster CI runs due to uv's optimized caching and dependency resolution
  3. Modern tooling: uv is actively maintained and provides a better developer experience
  4. Compatibility: Full backward compatibility with existing workflows and functionality

Migration Notes

For Developers

  1. Install uv: Follow instructions at https://docs.astral.sh/uv/
  2. Install dependencies: Run uv sync --extra grpc --extra asyncio (replaces poetry install -E grpc -E asyncio)
  3. Run commands: Use uv run <command> instead of poetry run <command>
  4. REPL: Use uv run repl instead of poetry run repl

Command Equivalents

Poetry Command uv Equivalent
poetry install uv sync
poetry install -E grpc uv sync --extra grpc
poetry install --with types uv sync --extra types
poetry install --without dev uv sync --no-group dev (or omit --extra dev)
poetry run <cmd> uv run <cmd>
poetry add <pkg> uv add <pkg>
poetry build uv build
poetry publish uv publish

Testing

  • Verified uv sync works with all extras
  • Verified uv run repl works correctly
  • Verified make version works
  • Verified make package works
  • Verified uv run mypy pinecone works
  • Tested locally with all extras: uv sync --extra grpc --extra asyncio --extra types

Breaking Changes

None. All functionality is preserved, only the tooling has changed.

Next Steps

  1. Generate uv.lock by running uv sync locally (already done in this PR)
  2. Test CI workflows in a branch to ensure everything works correctly
  3. Update any team-specific documentation or scripts that reference Poetry

Files Changed

  • pyproject.toml - Converted to uv format
  • Makefile - 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 actions
  • codegen/build-oas.sh - Updated script
  • Documentation files - Updated command examples

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.

Changes

Core Configuration

  • pyproject.toml: Converted from Poetry format to PEP 621 standard format

    • Converted [tool.poetry] to [project]
    • Moved dependencies to [project.dependencies] and [project.optional-dependencies]
    • Updated build system from poetry-core to hatchling
    • Converted Poetry groups (dev, types) and extras (grpc, asyncio) to uv's optional-dependencies format
    • Preserved all version constraints and Python version requirements
  • uv.lock: Generated new lock file (replaces poetry.lock)

Makefile Updates

All Poetry commands replaced with uv equivalents:

  • poetry install -E grpcuv sync --extra grpc
  • poetry run <command>uv run <command>
  • poetry builduv build
  • poetry publishuv publish
  • poetry version → custom script to read version from pyproject.toml

CI/CD Updates

  • New action: .github/actions/setup-uv/action.yml

    • Uses astral-sh/setup-uv@v4 for automatic caching
    • Supports enable_cache parameter (mapped to save-cache) to disable caching for dependency tests
    • Cache suffix includes extras configuration for proper cache isolation
  • Updated workflows:

    • testing-unit.yaml - Updated to use setup-uv action
    • testing-integration.yaml - Updated to use setup-uv action
    • publish-to-pypi.yaml - Updated version bumping logic (replaces poetry version with Python script)
    • on-merge.yaml - Updated package check to use uv build
  • Updated composite actions:

    • run-integration-test/action.yaml - Replaced poetry run pytest with uv run pytest
    • build-docs/action.yml - Updated to use setup-uv and uv run sphinx-build
    • test-dependency-rest/action.yaml - Updated to use uv add and uv run pytest
    • test-dependency-grpc/action.yaml - Updated to use uv add and uv run pytest
    • test-dependency-asyncio-rest/action.yaml - Updated to use uv add and uv run pytest

Scripts

  • codegen/build-oas.sh - Replaced poetry run ruff format with uv run ruff format

Documentation

Updated all documentation to reflect uv usage:

  • docs/maintainers/testing-guide.md - All poetry run commands → uv run
  • docs/maintainers/debugging.md - Updated command examples
  • MAINTAINERS.md - Updated setup instructions and commands
  • CONTRIBUTING.md - Updated development workflow from Poetry to uv
  • README.md - Already had uv instructions, kept Poetry as alternative for users

Benefits

  1. Performance: uv is significantly faster than Poetry for dependency resolution and installation
  2. CI/CD improvements: Faster CI runs due to uv's optimized caching and dependency resolution
  3. Modern tooling: uv is actively maintained and provides a better developer experience
  4. Compatibility: Full backward compatibility with existing workflows and functionality

Migration Notes

For Developers

  1. Install uv: Follow instructions at https://docs.astral.sh/uv/
  2. Install dependencies: Run uv sync --extra grpc --extra asyncio (replaces poetry install -E grpc -E asyncio)
  3. Run commands: Use uv run <command> instead of poetry run <command>
  4. REPL: Use uv run repl instead of poetry run repl

Command Equivalents

Poetry Command uv Equivalent
poetry install uv sync
poetry install -E grpc uv sync --extra grpc
poetry install --with types uv sync --extra types
poetry install --without dev uv sync --no-group dev (or omit --extra dev)
poetry run <cmd> uv run <cmd>
poetry add <pkg> uv add <pkg>
poetry build uv build
poetry publish uv publish

Testing

  • Verified uv sync works with all extras
  • Verified uv run repl works correctly
  • Verified make version works
  • Verified make package works
  • Verified uv run mypy pinecone works
  • Tested locally with all extras: uv sync --extra grpc --extra asyncio --extra types

Breaking Changes

None. All functionality is preserved, only the tooling has changed.

Next Steps

  1. Generate uv.lock by running uv sync locally (already done in this PR)
  2. Test CI workflows in a branch to ensure everything works correctly
  3. Update any team-specific documentation or scripts that reference Poetry

Files Changed

  • pyproject.toml - Converted to uv format
  • Makefile - 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 actions
  • codegen/build-oas.sh - Updated script
  • Documentation files - Updated command examples

@jhamon jhamon marked this pull request as ready for review November 15, 2025 19:44
@jhamon jhamon merged commit f9e4c64 into release-candidate/2025-10 Nov 15, 2025
60 checks passed
@jhamon jhamon deleted the jhamon/uv-migration branch November 15, 2025 19:44
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