Skip to content

Migrate project from Poetry to Astral's UV #31

@mridang

Description

@mridang

Migrate Project from Poetry to uv for Dependency Management

This initiative aims to replace Poetry with uv for all dependency management within the Python project. This includes updating the project's dependency definition, ensuring a smooth transition for local development, and crucially, updating our GitHub Actions workflows to leverage astral-sh/setup-uv for streamlined setup.

Problem

Currently, our Python project uses Poetry for dependency management. While functional, this setup presents several challenges, particularly within our CI/CD pipelines:

  • Manual Poetry Installation in CI: Our GitHub Actions workflows currently require a manual pipx install poetry step.
  • setup-python Limitations: The actions/setup-python action doesn't natively support installing package managers like Poetry.
  • Performance: uv offers significantly faster dependency resolution and installation.
  • Simplified Workflows: Transitioning to astral-sh/setup-uv will provide a single, optimized action for setup.

Impact

Migrating to uv will result in:

  • Faster Dependency Operations: Reduced installation and resolution times for both local development and CI/CD.
  • Simplified CI/CD Workflows: Elimination of manual Poetry installation steps.
  • Improved Maintainability: A more modern and efficient dependency management tool.
  • Consistent Environment Setup: A more reliable and predictable environment across development and CI.

Solution / Tasks

  • Convert pyproject.toml: Adjust pyproject.toml for uv compatibility and generate uv.lock using uv sync.
  • Update Local Development: Document and instruct developers to use uv for dependency management.
  • Migrate GitHub Actions: Replace actions/setup-python and manual Poetry installs with astral-sh/setup-uv@v1. Configure it to install dependencies.
  • Update CI/CD Scripts: Adjust any custom scripts to use uv run or executables within the uv-managed virtual environment.
  • Testing: Thoroughly test local dependency management and all CI/CD pipelines to ensure correct functionality and caching.

Expected Outcomes

  • All project dependencies are managed by uv.
  • Local development setup is streamlined with uv.
  • GitHub Actions workflows are simplified, faster, and more robust by using astral-sh/setup-uv.
  • Reduced CI/CD build times.
  • Removal of manual Poetry installation steps in CI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions