Skip to content

Commit 53ae67e

Browse files
authored
Replace poetry with uv (#82)
* Move to uv, make tests pass. * Add uv lock * Remove duplicate dependencies, and add package wheel * Add 3.13 test
1 parent 1aff090 commit 53ae67e

10 files changed

Lines changed: 1382 additions & 1592 deletions

File tree

.github/dependabot.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ updates:
1717
labels:
1818
- "dependencies"
1919
- "python"
20-
- "poetry"
2120

2221
# Optional: Group minor and patch updates together to reduce PR noise
2322
groups:

.github/workflows/ci_tests.yaml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
python-version: [ "3.10", "3.11", "3.12" ]
12-
poetry-version: [ "1.7.0" ]
11+
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
1312
runs-on: ubuntu-latest
1413
steps:
1514
- uses: actions/checkout@v4
@@ -19,20 +18,16 @@ jobs:
1918
python-version: ${{ matrix.python-version }}
2019
# see details (matrix, python-version, python-version-file, etc.)
2120
# https://github.com/actions/setup-python
22-
- name: Install poetry
23-
uses: abatilo/actions-poetry@v4
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v5
2423
with:
25-
poetry-version: ${{ matrix.poetry-version }}
26-
- name: Setup a local virtual environment (if no poetry.toml file)
27-
run: |
28-
poetry config virtualenvs.create true --local
29-
poetry config virtualenvs.in-project true --local
24+
enable-cache: true
3025
- uses: actions/cache@v4
3126
name: Define a cache for the virtual environment based on the dependencies lock file
3227
with:
3328
path: ./.venv
34-
key: venv-${{ hashFiles('poetry.lock') }}
29+
key: venv-${{ hashFiles('uv.lock') }}
3530
- name: Install the project dependencies
36-
run: poetry install
31+
run: uv sync --extra dev
3732
- name: Run the automated tests (for example)
38-
run: poetry run pytest -v
33+
run: uv run pytest -v

.github/workflows/publish-docs-on-master.yaml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
python-version: [ "3.12" ]
15-
poetry-version: [ "1.7.0" ]
1615
runs-on: ubuntu-latest
1716
steps:
1817
- uses: actions/checkout@v4
@@ -30,19 +29,15 @@ jobs:
3029
path: .cache
3130
restore-keys: |
3231
mkdocs-material-
33-
- name: Install poetry
34-
uses: abatilo/actions-poetry@v4
32+
- name: Install uv
33+
uses: astral-sh/setup-uv@v5
3534
with:
36-
poetry-version: ${{ matrix.poetry-version }}
37-
- name: Setup a local virtual environment (if no poetry.toml file)
38-
run: |
39-
poetry config virtualenvs.create true --local
40-
poetry config virtualenvs.in-project true --local
35+
enable-cache: true
4136
- uses: actions/cache@v4
4237
name: Define a cache for the virtual environment based on the dependencies lock file
4338
with:
4439
path: ./.venv
45-
key: venv-${{ hashFiles('poetry.lock') }}
40+
key: venv-${{ hashFiles('uv.lock') }}
4641
- name: Install the project dependencies
47-
run: poetry install
48-
- run: poetry run mkdocs gh-deploy --force
42+
run: uv sync --extra dev
43+
- run: uv run mkdocs gh-deploy --force

.github/workflows/publish-to-pypi.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ jobs:
2020
with:
2121
python-version: '3.x'
2222

23-
- name: Install Poetry
24-
uses: snok/install-poetry@v1.4.1
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v5
2525
with:
26-
virtualenvs-create: false
26+
enable-cache: true
2727

28-
- name: Poetry build
29-
run: |
30-
poetry build
28+
- name: Build package
29+
run: uv build
3130
- name: Publish package distributions to PyPi
3231
uses: pypa/gh-action-pypi-publish@release/v1

Pylette/cmd.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ class ColorSpace(str, Enum):
2525
pylette_app = typer.Typer()
2626

2727

28-
@pylette_app.command(no_args_is_help=True)
28+
@pylette_app.command()
2929
def main(
30+
ctx: typer.Context,
3031
filename: pathlib.Path | None = None,
3132
image_url: str | None = None,
3233
mode: ExtractionMode = ExtractionMode.KM,
@@ -39,9 +40,9 @@ def main(
3940
alpha_mask_threshold: int | None = typer.Option(None, min=0, max=255, help="Alpha threshold for transparent image masking (0-255). Pixels with alpha below this value are excluded."),
4041
):
4142
if filename is None and image_url is None:
42-
typer.echo("Please provide either a filename or an image-url.")
43-
raise typer.Exit(code=1)
44-
43+
typer.echo(ctx.get_help())
44+
raise typer.Exit(code=0)
45+
4546
if filename is not None and image_url is not None:
4647
typer.echo("Please provide either a filename or an image-url, but not both.")
4748
raise typer.Exit(code=1)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ You can easily install Pylette using pip:
4545
pip install Pylette
4646
```
4747

48-
Or if you prefer using Poetry:
48+
Or if you prefer using uv:
4949

5050
```shell
51-
poetry add Pylette
51+
uv add Pylette
5252
```
5353

5454
### Quick Start Guide

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ You can easily install Pylette using pip:
4545
pip install Pylette
4646
```
4747

48-
Or if you prefer using Poetry:
48+
Or if you prefer using uv:
4949

5050
```shell
51-
poetry add Pylette
51+
uv add Pylette
5252
```
5353

5454
### Quick Start Guide

0 commit comments

Comments
 (0)