Skip to content

Commit

Permalink
[.github] - refactor: switch from Poetry to uv for Python dependency …
Browse files Browse the repository at this point in the history
…management

 - Replace the use of Poetry with uv in GitHub Actions workflows for various tasks like installing dependencies and publishing packages
 - Enable caching in the GitHub Actions for the uv setup to improve workflow efficiency
 - Modify commands for checking formatting, running lint, and running tests to use uv instead of Poetry
 - Update the PyPI publishing step to use uv with the new environment variable for the PyPI token configuration
  • Loading branch information
JulesBelveze committed Nov 3, 2024
1 parent 063291b commit 6dcdac6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 44 deletions.
36 changes: 11 additions & 25 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,34 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install Poetry
run: pipx install poetry

- name: Setup Python
uses: actions/setup-python@v4
- name: Setup uv
uses: astral-sh/setup-uv@v1
with:
python-version: "3.9"
cache: "poetry"
cache-dependency-path: poetry.lock

- name: Set Poetry environment
run: poetry env use 3.9
cache: true # enable caching

- name: Install dev dependencies
run: poetry install --only dev --no-root
run: uv sync --extras dev

- name: Check formatting
run: poetry run task check-formatting
run: uv run task check-formatting

- name: Run lint
run: poetry run task lint
run: uv run task lint

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Poetry
run: pipx install poetry

- name: Setup Python
uses: actions/setup-python@v4
- name: Setup uv
uses: astral-sh/setup-uv@v1
with:
python-version: "3.9"
cache: "poetry"
cache-dependency-path: poetry.lock

- name: Set Poetry environment
run: poetry env use 3.9
cache: true # enable caching

- name: Install dependencies
run: poetry install --with dev --no-root
run: uv sync --extras dev

- name: Run tests
run: poetry run task test
run: uv run task test
30 changes: 11 additions & 19 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,19 @@ on:

jobs:
pypi_release:
name: Poetry Build and PyPI Publish
runs-on: ubuntu-20.04
name: Build and PyPI Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Cache poetry install
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-1.3.1
- uses: actions/checkout@v4

- uses: snok/install-poetry@v1
- name: Setup uv
uses: astral-sh/setup-uv@v1
with:
version: 1.3.1
virtualenvs-create: true
virtualenvs-in-project: true
python-version: "3.9"
cache: true

- name: Publish package
- name: Build and publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi "${{ secrets.PYPI_TOKEN }}"
poetry publish --build
uv publish --token $PYPI_TOKEN

0 comments on commit 6dcdac6

Please sign in to comment.