Skip to content

Commit

Permalink
migrate to uv from poetry (#74)
Browse files Browse the repository at this point in the history
* migrate to uv from poetry
  • Loading branch information
lesnik512 authored Aug 31, 2024
1 parent 5b17cd4 commit 032d83b
Show file tree
Hide file tree
Showing 6 changed files with 812 additions and 1,074 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: arduino/setup-task@v1
with:
repo-token: ${{ github.token }}
- run: pip install poetry
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: task install lint-ci

pytest:
Expand All @@ -41,5 +41,5 @@ jobs:
- uses: arduino/setup-task@v1
with:
repo-token: ${{ github.token }}
- run: pip install poetry
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: task install tests
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish Package

on:
release:
types:
- published

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/cache@v4
with:
path: ~/.cache/uv
key: publish-${{ hashFiles('pyproject.toml') }}
- uses: arduino/setup-task@v1
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: task publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
41 changes: 18 additions & 23 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,38 @@
version: "3"

tasks:
lock:
desc: "lock with update"
cmds:
- uv lock --upgrade

install:
desc: "install local dependencies"
cmds:
- poetry install --sync --no-root --all-extras
- uv sync --all-extras --frozen

lint:
desc: "run linters"
cmds:
- poetry run ruff format .
- poetry run ruff check . --fix
- poetry run mypy .
- uv run ruff format .
- uv run ruff check . --fix
- uv run mypy .

lint-ci:
desc: "run linters"
cmds:
- poetry run ruff format . --check
- poetry run ruff check . --no-fix
- poetry run mypy .
- uv run ruff format . --check
- uv run ruff check . --no-fix
- uv run mypy .

tests:
desc: "run pytest (pass args after '--')"
cmds:
- poetry run pytest {{.CLI_ARGS}}
- uv run pytest {{.CLI_ARGS}}

release:
desc: "bump version, create tag and release, publish to PYPI"
publish:
cmds:
- git checkout main
- git pull
- rm -rf ./dist
- poetry version {{.CLI_ARGS}}
- git add pyproject.toml
- git commit -m "bump version to {{.CLI_ARGS}}"
- poetry build
- twine upload dist/*
- git tag {{.CLI_ARGS}}
- git push
- git push --tags
- gh release create --generate-notes {{.CLI_ARGS}}
- gh release upload {{.CLI_ARGS}} ./dist/*
- rm -rf dist/*
- uv tool run --from build python -m build --installer uv
- uv tool run twine check dist/*
- uv tool run twine upload dist/* --username __token__ --password $PYPI_TOKEN
Loading

0 comments on commit 032d83b

Please sign in to comment.