Skip to content

Commit a37d180

Browse files
build: migrate from poetry to uv
Convert to PEP 621 pyproject with uv_build backend (flat layout, module-root = ""). Library published to PyPI. Re-lock with uv.lock, remove pbr/setuptools_scm setup.py/setup.cfg leftovers, and migrate test/publish CI workflows from poetry to uv. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent bea65a6 commit a37d180

7 files changed

Lines changed: 975 additions & 1425 deletions

File tree

.github/workflows/publish.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,24 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
12-
- name: Set up Python
13-
uses: actions/setup-python@v4
12+
- name: Set up uv
13+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
1414
with:
1515
python-version: "3.12"
16+
enable-cache: true
1617
- name: Install dependencies
17-
run: |
18-
curl -sSL https://install.python-poetry.org | python - --version 1.8.5
19-
poetry install
18+
run: uv sync --locked
2019

2120
- name: Run tests
22-
run: |
23-
poetry run pytest
21+
run: uv run --no-sync pytest
2422

2523
- name: Build wheels
2624
run: |
27-
poetry version $(git tag --points-at HEAD)
28-
poetry build
25+
uv version "$(git tag --points-at HEAD)"
26+
uv build
2927
3028
- name: Upload
3129
env:
32-
USERNAME: __token__
33-
PASSWORD: ${{ secrets.PYPI_TOKEN }}
34-
run: |
35-
poetry publish --username=$USERNAME --password=$PASSWORD
30+
UV_PUBLISH_USERNAME: __token__
31+
UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_TOKEN }}
32+
run: uv publish

.github/workflows/test.yml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,20 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v4
14-
- name: Set up Python ${{ matrix.python-version }}
15-
uses: actions/setup-python@v4
14+
- name: Set up uv
15+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
1616
with:
1717
python-version: ${{ matrix.python-version }}
18-
19-
- name: Cache pip
20-
uses: actions/cache@v4
21-
with:
22-
path: ~/.cache/pip
23-
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}-${ GITHUB_REF }
24-
restore-keys: |
25-
${{ runner.os }}-pip-
26-
${{ runner.os }}-
18+
enable-cache: true
2719

2820
- name: Install dependencies
29-
run: |
30-
curl -sSL https://install.python-poetry.org | python - --version 1.8.5
31-
poetry install
21+
run: uv sync --locked
3222

3323
- name: Run tests
34-
run: |
35-
poetry run pytest
24+
run: uv run --no-sync pytest
3625

3726
- name: Build wheels
38-
run: |
39-
poetry build
27+
run: uv build
4028

4129
build-docs:
4230
runs-on: ubuntu-latest

poetry.lock

Lines changed: 0 additions & 1333 deletions
This file was deleted.

pyproject.toml

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1-
[tool.poetry]
1+
[project]
22
name = "kw6"
33
version = "0.0.0"
44
description = "Minimalistic library for reading files in the kw6 file format"
5-
authors = ["NextML AB"]
6-
license = "Apache 2.0"
5+
authors = [{ name = "NextML AB" }]
6+
requires-python = ">=3.9,<3.13"
7+
license = "Apache-2.0"
8+
dependencies = [
9+
"numpy>=1.21.2,<2",
10+
"Pillow>=10.0,<12",
11+
"pydantic>=2.0.0,<3",
12+
]
713

8-
[tool.poetry.dependencies]
9-
# Floor raised to 3.9 so numpy/Pillow resolve to lines that ship cp312 wheels
10-
# (numpy 1.26 / Pillow 10 dropped 3.8); ceiling <3.13 for Python 3.12.
11-
python = ">=3.9,<3.13"
12-
numpy = "^1.21.2"
13-
# Pillow >=10 is the first line with cp312 wheels; <12 keeps the 3.8 floor
14-
# satisfiable (Pillow 11 dropped 3.8).
15-
Pillow = ">=10.0,<12"
16-
pydantic = "^2.0.0"
17-
18-
[tool.poetry.dev-dependencies]
19-
tqdm = "^4.62.2"
20-
pytest = "^6.2.5"
21-
flake8 = "^3.9.2"
22-
ipykernel = "^6.4.1"
14+
[dependency-groups]
15+
dev = [
16+
"tqdm>=4.62.2,<5",
17+
"pytest>=6.2.5,<7",
18+
"flake8>=3.9.2,<4",
19+
"ipykernel>=6.4.1,<7",
20+
]
2321

2422
[build-system]
25-
requires = ["poetry-core>=1.0.0"]
26-
build-backend = "poetry.core.masonry.api"
23+
requires = ["uv_build>=0.11.25,<0.12"]
24+
build-backend = "uv_build"
25+
26+
[tool.uv.build-backend]
27+
module-root = ""

setup.cfg

Lines changed: 0 additions & 33 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)