Skip to content

Migrate from Poetry to UV #8083

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

Merged
merged 5 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 48 additions & 53 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ on:
pull_request:
types: [opened, synchronize, reopened]

env:
POETRY_VERSION: "2.0.0"

jobs:
fix:
name: Check Ruff Fix
Expand All @@ -20,6 +17,21 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install uv with caching
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: |
**/pyproject.toml
**/uv.lock
- name: Create and activate virtual environment
run: |
uv venv .venv
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
- name: Install dependencies
run: uv sync --dev -p .venv
- name: Ruff Fix Attempt
id: ruff_fix
uses: chartboost/ruff-action@v1
Expand Down Expand Up @@ -47,75 +59,58 @@ jobs:
- name: Install Deno
run: |
curl -fsSL https://deno.land/install.sh | sh
echo "Deno installed"

- name: Add Deno to PATH
run: echo "${HOME}/.deno/bin" >> $GITHUB_PATH

echo "${HOME}/.deno/bin" >> $GITHUB_PATH
- name: Verify Deno installation
run: deno --version

- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v3
- name: Install uv with caching
uses: astral-sh/setup-uv@v5
with:
path: ~/.local
key: poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry
run: python -m pip install --upgrade "poetry==${{ env.POETRY_VERSION }}"
enable-cache: true
cache-dependency-glob: |
**/pyproject.toml
**/uv.lock
- name: Create and activate virtual environment
run: |
uv venv .venv
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
poetry install --no-interaction
uv sync --dev -p .venv --extra dev
uv pip list
- name: Run lint with tests
uses: chartboost/ruff-action@v1
with:
args: check --fix-only
- name: Run tests with pytest
run: poetry run pytest tests/
build_poetry:
name: Build Poetry
run: uv run -p .venv pytest tests/

build_package:
name: Build Package
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v4
- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: python -m pip install --upgrade "poetry==${{ env.POETRY_VERSION }}"
- name: Install uv with caching
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: |
**/pyproject.toml
**/uv.lock
- name: Create and activate virtual environment
run: |
uv venv .venv
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
- name: Install dependencies
run: uv sync --dev -p .venv --extra dev
- name: Build
run: poetry build
run: uv run -p .venv python -m build
- name: Install built package
run: python -m pip install dist/*.whl
run: uv pip install dist/*.whl -p .venv
- name: Test import dspy
run: python -c "import dspy"

build_setup:
name: Build Setup
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v4
- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: python -m pip install --upgrade "poetry==${{ env.POETRY_VERSION }}"
- name: Build the wheel
run: python -m build
run: uv run -p .venv python -c "import dspy"
Loading