Skip to content

Commit

Permalink
feat: migrate from poetry to uv (#169)
Browse files Browse the repository at this point in the history
Signed-off-by: Ludovic Ortega <[email protected]>
  • Loading branch information
M0NsTeRRR authored Oct 18, 2024
1 parent 6743d76 commit c3b603e
Show file tree
Hide file tree
Showing 21 changed files with 1,513 additions and 1,800 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Python release
on:
push:
tags:
- '*'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- name: Install the project
run: uv sync --all-extras
- name: Publish package
run: |
sed -i -e "s/0.0.0/${GITHUB_REF#refs/*/}/" pyproject.toml
uv build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Deploy documentation
run: |
git fetch origin gh-pages --depth=1
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
uv run mike deploy --push --update-aliases $(git describe --tags --abbrev=0) latest
uv run mike set-default --push latest
36 changes: 0 additions & 36 deletions .github/workflows/releases.yml

This file was deleted.

40 changes: 12 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,18 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
run: pipx install poetry

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'

- name: Install poetry dependencies
run: |
export PATH="$PATH:$HOME/.local/bin"
poetry install --with=dev
- name: Run ruff
run: |
export PATH="$PATH:$HOME/.local/bin"
source `poetry env info --path`/bin/activate
poetry run ruff format --check .
poetry run ruff check .
- name: Run test
run: |
export PATH="$PATH:$HOME/.local/bin"
source `poetry env info --path`/bin/activate
poetry run pytest --cov
run: uv python install ${{ matrix.python-version }}
- name: Install the project
run: uv sync --all-extras
- name: Run ruff format
run: uv run ruff format --check .
- name: Run ruff check
run: uv run ruff check .
- name: Run tests
run: uv run pytest --cov
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,19 @@ This client has been tested with awtrix-light v0.90 use with caution as official
[https://M0NsTeRRR.github.io/awtrix-light-client](https://M0NsTeRRR.github.io/awtrix-light-client)

# Dev
Install [Poetry](https://python-poetry.org/docs/master/#installing-with-the-official-installer)
Install [uv](https://docs.astral.sh/uv/getting-started/installation/)

Install and setup dependencies
```
poetry install
poetry shell
```
Install and setup dependencies with `uv sync`

### Run unit test
```
poetry run pytest --cov
uv run pytest --cov
```

### Run ruff
```
poetry run ruff format .
poetry run ruff check .
uv run ruff format .
uv run ruff check .
```

## Contributing
Expand Down
Loading

0 comments on commit c3b603e

Please sign in to comment.