Skip to content

Commit 0363c2e

Browse files
Migrate from Poetry to UV (#8083)
* use uv * fix workflow * refactor workflow * add back missing deps * fix litellm
1 parent 7fcc095 commit 0363c2e

File tree

4 files changed

+3283
-8764
lines changed

4 files changed

+3283
-8764
lines changed

.github/workflows/run_tests.yml

Lines changed: 48 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ on:
77
pull_request:
88
types: [opened, synchronize, reopened]
99

10-
env:
11-
POETRY_VERSION: "2.0.0"
12-
1310
jobs:
1411
fix:
1512
name: Check Ruff Fix
@@ -20,6 +17,21 @@ jobs:
2017
steps:
2118
- uses: actions/checkout@v4
2219
- uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.11"
22+
- name: Install uv with caching
23+
uses: astral-sh/setup-uv@v5
24+
with:
25+
enable-cache: true
26+
cache-dependency-glob: |
27+
**/pyproject.toml
28+
**/uv.lock
29+
- name: Create and activate virtual environment
30+
run: |
31+
uv venv .venv
32+
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
33+
- name: Install dependencies
34+
run: uv sync --dev -p .venv
2335
- name: Ruff Fix Attempt
2436
id: ruff_fix
2537
uses: chartboost/ruff-action@v1
@@ -47,75 +59,58 @@ jobs:
4759
- name: Install Deno
4860
run: |
4961
curl -fsSL https://deno.land/install.sh | sh
50-
echo "Deno installed"
51-
52-
- name: Add Deno to PATH
53-
run: echo "${HOME}/.deno/bin" >> $GITHUB_PATH
54-
62+
echo "${HOME}/.deno/bin" >> $GITHUB_PATH
5563
- name: Verify Deno installation
5664
run: deno --version
57-
58-
- name: Load cached Poetry installation
59-
id: cached-poetry
60-
uses: actions/cache@v3
65+
- name: Install uv with caching
66+
uses: astral-sh/setup-uv@v5
6167
with:
62-
path: ~/.local
63-
key: poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
64-
- name: Install Poetry
65-
run: python -m pip install --upgrade "poetry==${{ env.POETRY_VERSION }}"
68+
enable-cache: true
69+
cache-dependency-glob: |
70+
**/pyproject.toml
71+
**/uv.lock
72+
- name: Create and activate virtual environment
73+
run: |
74+
uv venv .venv
75+
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
6676
- name: Install dependencies
6777
run: |
68-
poetry install --no-interaction
78+
uv sync --dev -p .venv --extra dev
79+
uv pip list
6980
- name: Run lint with tests
7081
uses: chartboost/ruff-action@v1
7182
with:
7283
args: check --fix-only
7384
- name: Run tests with pytest
74-
run: poetry run pytest tests/
75-
build_poetry:
76-
name: Build Poetry
85+
run: uv run -p .venv pytest tests/
86+
87+
build_package:
88+
name: Build Package
7789
runs-on: ubuntu-latest
7890
strategy:
7991
matrix:
8092
python-version: ["3.11"]
8193
steps:
8294
- uses: actions/checkout@v4
83-
- name: Load cached Poetry installation
84-
id: cached-poetry
85-
uses: actions/cache@v3
86-
with:
87-
path: ~/.local
88-
key: poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
8995
- uses: actions/setup-python@v5
9096
with:
9197
python-version: ${{ matrix.python-version }}
92-
- name: Install Poetry
93-
run: python -m pip install --upgrade "poetry==${{ env.POETRY_VERSION }}"
98+
- name: Install uv with caching
99+
uses: astral-sh/setup-uv@v5
100+
with:
101+
enable-cache: true
102+
cache-dependency-glob: |
103+
**/pyproject.toml
104+
**/uv.lock
105+
- name: Create and activate virtual environment
106+
run: |
107+
uv venv .venv
108+
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
109+
- name: Install dependencies
110+
run: uv sync --dev -p .venv --extra dev
94111
- name: Build
95-
run: poetry build
112+
run: uv run -p .venv python -m build
96113
- name: Install built package
97-
run: python -m pip install dist/*.whl
114+
run: uv pip install dist/*.whl -p .venv
98115
- name: Test import dspy
99-
run: python -c "import dspy"
100-
101-
build_setup:
102-
name: Build Setup
103-
runs-on: ubuntu-latest
104-
strategy:
105-
matrix:
106-
python-version: ["3.11"]
107-
steps:
108-
- uses: actions/checkout@v4
109-
- name: Load cached Poetry installation
110-
id: cached-poetry
111-
uses: actions/cache@v3
112-
with:
113-
path: ~/.local
114-
key: poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
115-
- uses: actions/setup-python@v5
116-
with:
117-
python-version: ${{ matrix.python-version }}
118-
- name: Install Poetry
119-
run: python -m pip install --upgrade "poetry==${{ env.POETRY_VERSION }}"
120-
- name: Build the wheel
121-
run: python -m build
116+
run: uv run -p .venv python -c "import dspy"

0 commit comments

Comments
 (0)