Skip to content

Migrate from poetry to uv #1187

Migrate from poetry to uv

Migrate from poetry to uv #1187

Workflow file for this run

name: Build the package
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
name: Build
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Set up Python ${{ '3.9' }}
uses: actions/setup-python@v5
with:
python-version: ${{ '3.9' }}
- name: Setup environment
id: environment
shell: bash
run: |
PYTHON_USER_BASE="$(python -m site --user-base)"
echo "$PYTHON_USER_BASE/bin" >> $GITHUB_PATH
echo "pip-user-base=$PYTHON_USER_BASE" >> $GITHUB_OUTPUT
- name: Get uv latest version
id: latest-versions
shell: bash
run: |
poetry_version=$(curl -s https://pypi.org/pypi/poetry/json | jq -r .info.version)
echo "poetry=$poetry_version" >> $GITHUB_OUTPUT
uv_version=$(curl -s https://pypi.org/pypi/uv/json | jq -r .info.version)
echo "uv=$uv_version" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Cache uv binary
with:
path: ${{ steps.environment.outputs.pip-user-base }}
key: >
${{ format('pip-user-{0}-{1}-uv-{2}',
runner.os,
'3.9',
steps.latest-versions.outputs.uv
) }}
- name: Install or update uv
id: uv
shell: bash
run: |
pip install --user uv==${{ steps.latest-versions.outputs.uv }}
echo "cache-dir=$(uv cache dir)"
- uses: actions/cache@v4
name: Cache uv dependencies
with:
path: ./.venv
key: deps-${{ runner.os }}-${{ '3.9' }}-${{ hashFiles('uv.lock') }}
restore-keys: |
deps-${{ runner.os }}-${{ '3.9' }}-
- name: Install dependencies with uv
shell: bash
run: |
uv sync
- name: Check if package builds
run: |
uv build