Skip to content

Migrate Python projects from poetry to uv #532

Migrate Python projects from poetry to uv

Migrate Python projects from poetry to uv #532

Workflow file for this run

on:
push:
branches: [main]
pull_request:
paths:
- "python/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Set up Python environment
shell: bash
run: |
python -m venv .venv
if [ "${{ runner.os }}" = "Windows" ]; then
. .venv/Scripts/activate
else
. .venv/bin/activate
fi
python -m pip install --upgrade pip
uv pip install --system
- name: selfie-lib - install dependencies
shell: bash
working-directory: python/selfie-lib
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
. ../../.venv/Scripts/activate
else
. ../../.venv/bin/activate
fi
python -m pip install -e .
python -m pip install -r requirements.txt -r dev-requirements.txt
- name: selfie-lib - pytest
shell: bash
working-directory: python/selfie-lib
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
. ../../.venv/Scripts/activate
else
. ../../.venv/bin/activate
fi
python -m pytest -vv
- name: selfie-lib - pyright
shell: bash
working-directory: python/selfie-lib
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
. ../../.venv/Scripts/activate
else
. ../../.venv/bin/activate
fi
python -m pyright
- name: selfie-lib - ruff
shell: bash
working-directory: python/selfie-lib
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
. ../../.venv/Scripts/activate
else
. ../../.venv/bin/activate
fi
python -m ruff format --check && python -m ruff check
- name: pytest-selfie - install dependencies
shell: bash
working-directory: python/pytest-selfie
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
. ../../.venv/Scripts/activate
else
. ../../.venv/bin/activate
fi
uv pip install -r requirements.txt -r dev-requirements.txt
- name: pytest-selfie - pyright
shell: bash
working-directory: python/pytest-selfie
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
. ../../.venv/Scripts/activate
else
. ../../.venv/bin/activate
fi
python -m pyright
- name: pytest-selfie - ruff
shell: bash
working-directory: python/pytest-selfie
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
. ../../.venv/Scripts/activate
else
. ../../.venv/bin/activate
fi
python -m ruff format --check && python -m ruff check
- name: example-pytest-selfie - install dependencies
shell: bash
working-directory: python/example-pytest-selfie
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
. ../../.venv/Scripts/activate
else
. ../../.venv/bin/activate
fi
uv pip install -r requirements.txt -r dev-requirements.txt
- name: example-pytest-selfie - pytest
shell: bash
working-directory: python/example-pytest-selfie
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
. ../../.venv/Scripts/activate
else
. ../../.venv/bin/activate
fi
python -m pytest -vv
- name: example-pytest-selfie - pyright
shell: bash
working-directory: python/example-pytest-selfie
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
. ../../.venv/Scripts/activate
else
. ../../.venv/bin/activate
fi
python -m pyright
- name: example-pytest-selfie - ruff
shell: bash
working-directory: python/example-pytest-selfie
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
. ../../.venv/Scripts/activate
else
. ../../.venv/bin/activate
fi
python -m ruff format --check && python -m ruff check