Skip to content

Commit a0de767

Browse files
committed
build: migrate from poetry to uv
1 parent e660dcf commit a0de767

File tree

8 files changed

+615
-1025
lines changed

8 files changed

+615
-1025
lines changed

.github/workflows/release.yaml

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,31 @@ name: Publish to PyPI
22
on:
33
release:
44
types: [published]
5-
65
jobs:
76
pypi_release:
8-
name: Builds Using Poetry and Publishes to PyPI
7+
name: Builds Using UV and Publishes to PyPI
98
runs-on: ubuntu-latest
109
steps:
11-
- uses: actions/checkout@v2
12-
- uses: actions/setup-python@v2
10+
- uses: actions/checkout@v4
11+
- name: Install uv
12+
uses: astral-sh/setup-uv@v5
13+
- name: "Set up Python"
14+
uses: actions/setup-python@v5
1315
with:
14-
python-version: 3.12
15-
- name: Install Poetry
16-
uses: snok/install-poetry@v1
16+
python-version-file: "pyproject.toml"
17+
- name: Restore uv cache
18+
uses: actions/cache@v4
1719
with:
18-
virtualenvs-create: true
19-
virtualenvs-in-project: true
20-
- name: Load cached venv
21-
id: cached-poetry-dependencies
22-
uses: actions/[email protected]
23-
with:
24-
path: .venv
25-
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
26-
- name: Install dependencies
27-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
28-
run: poetry install --no-interaction --no-root
29-
- name: Install library
30-
run: poetry install --no-interaction
31-
- name: Configure Poetry
32-
run: poetry config pypi-token.pypi "${{ secrets.PYPI_API_TOKEN }}"
20+
path: /tmp/.uv-cache
21+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
22+
restore-keys: |
23+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
24+
uv-${{ runner.os }}
25+
- name: Install the project
26+
run: uv sync --all-extras --dev
27+
- name: Build the project
28+
run: uv build
3329
- name: Publish package
34-
run: poetry publish --build
30+
run: uv publish
31+
- name: Minimize uv cache
32+
run: uv cache prune --ci

.github/workflows/tests.yaml

Lines changed: 16 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,31 @@
11
name: tests
2-
32
on:
43
push:
54
branches:
65
- "main"
76
pull_request:
87
branches:
98
- "main"
10-
119
jobs:
1210
tests:
1311
runs-on: ubuntu-latest
1412
steps:
15-
#----------------------------------------------
16-
# check-out repo and set-up python
17-
#----------------------------------------------
18-
- uses: actions/checkout@v2
19-
- uses: actions/setup-python@v2
13+
- uses: actions/checkout@v4
14+
- name: Install uv
15+
uses: astral-sh/setup-uv@v5
16+
- name: "Set up Python"
17+
uses: actions/setup-python@v5
2018
with:
21-
python-version: 3.12
22-
#----------------------------------------------
23-
# ----- install & configure poetry -----
24-
#----------------------------------------------
25-
- name: Install Poetry
26-
uses: snok/install-poetry@v1
19+
python-version-file: "pyproject.toml"
20+
- name: Restore uv cache
21+
uses: actions/cache@v4
2722
with:
28-
virtualenvs-create: true
29-
virtualenvs-in-project: true
30-
#----------------------------------------------
31-
# load cached venv if cache exists
32-
#----------------------------------------------
33-
- name: Load cached venv
34-
id: cached-poetry-dependencies
35-
uses: actions/cache@v2
36-
with:
37-
path: .venv
38-
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
39-
#----------------------------------------------
40-
# install dependencies if cache does not exist
41-
#----------------------------------------------
42-
- name: Install dependencies
43-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
44-
run: poetry install --no-interaction --no-root
45-
#----------------------------------------------
46-
# install your root project, if required
47-
#----------------------------------------------
48-
- name: Install library
49-
run: poetry install --no-interaction
50-
#----------------------------------------------
51-
# run test suite and output coverage file
52-
#----------------------------------------------
23+
path: /tmp/.uv-cache
24+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
25+
restore-keys: |
26+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
27+
uv-${{ runner.os }}
28+
- name: Install the project
29+
run: uv sync --all-extras --dev
5330
- name: Test with pytest
54-
run: poetry run pytest
31+
run: uv run pytest

.pre-commit-config.yaml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
fail_fast: true
22
repos:
3-
- repo: local
3+
- repo: https://github.com/astral-sh/ruff-pre-commit
4+
# Ruff version.
5+
rev: v0.9.4
46
hooks:
5-
- id: system
6-
name: Black
7-
entry: poetry run black .
8-
pass_filenames: false
9-
language: system
10-
- repo: local
11-
hooks:
12-
- id: system
13-
name: Isort
14-
entry: poetry run isort .
15-
pass_filenames: false
16-
language: system
7+
# Run the linter.
8+
- id: ruff
9+
# Run the formatter.
10+
- id: ruff-format

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,3 @@ epub-image-optimizer --input-dir <folder> --max-image-resolution 1680 1264 --tin
8888
```
8989

9090
Note: This will optimize all epubs inside `input-dir` folder, used my Kobo Libra H2O screen size as example.
91-
92-
## Development
93-
94-
[Poetry](https://github.com/python-poetry/poetry) is used for managing packages, dependencies and building the project.
95-
96-
Poetry can be installed by following the [instructions](https://github.com/python-poetry/poetry). Afterwards you can use `poetry install` within the project folder to install all dependencies.

mise.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[tools]
2-
poetry = "latest"
32
python = "3.12"
3+
uv = "latest"

0 commit comments

Comments
 (0)