Skip to content

Commit 624cc99

Browse files
authored
Switch from poetry to uv (#65)
1 parent 95ade20 commit 624cc99

File tree

7 files changed

+2716
-1651
lines changed

7 files changed

+2716
-1651
lines changed

.github/workflows/run-tests.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@ jobs:
2525
with:
2626
python-version: ${{ matrix.python }}
2727

28-
- name: Install Poetry
29-
uses: snok/install-poetry@v1
28+
- name: Set up Uv
29+
uses: astral-sh/setup-uv@v6
3030
with:
31-
version: 1.4.2
31+
version: "0.10.4"
32+
enable-cache: true
3233

3334
- name: Install the package and dependencies
3435
run: |
35-
poetry install
36+
uv sync --all-groups --locked --python ${{ matrix.python }}
3637
3738
- name: Run tests
3839
run: |
39-
poetry run make all-checks
40+
make all-checks

Makefile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
poetry-check:
2-
@echo "🔒 Verifying that poetry.lock is consistent with pyproject.toml..."
3-
poetry lock --check
1+
uv-lock-check:
2+
@echo "🔒 Verifying that uv.lock is consistent with pyproject.toml..."
3+
uv lock --check
44

55
format:
6-
isort .
7-
black .
6+
uv run isort .
7+
uv run black .
88

99
format-check:
1010
@echo "⚫ Checking code format..."
11-
isort --check-only --diff .
12-
black --check .
11+
uv run isort --check-only --diff .
12+
uv run black --check .
1313

1414
type-check:
1515
@echo "👮 Running type checker"
16-
mypy .
16+
uv run mypy .
1717

18-
static-checks: poetry-check format-check type-check
18+
static-checks: uv-lock-check format-check type-check
1919

2020
test:
2121
@echo "🏃 Running tests..."
22-
pytest .
22+
uv run pytest .
2323

2424
all-checks: static-checks test
2525
@echo "✅ Great success!"
@@ -28,4 +28,4 @@ clean:
2828
rm -rf dist
2929

3030
build:
31-
poetry build
31+
uv build

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -464,23 +464,22 @@ We also welcome contributions, please submit a PR.
464464

465465
### Development
466466

467-
The library targets python 3.8 and higher. We use poetry to manage the development environment.
467+
The library targets python 3.8 and higher. We use uv to manage the development environment.
468468

469469
Here is an example development workflow:
470470

471471
```bash
472472
# Create a virtual environment with development dependencies
473-
poetry env use python3.8
474-
poetry install
473+
uv sync --all-groups --python 3.8
475474

476475
# Make changes
477476
...
478477

479478
# Autoformat the code
480-
poetry run make format
479+
make format
481480

482481
# Run tests
483-
poetry run make all-checks
482+
make all-checks
484483
```
485484

486485
## Maintained By

docs/installation.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ Labelformat is available on PyPI and can be installed using various package mana
1616
pip install labelformat
1717
```
1818

19-
=== "Poetry"
19+
=== "uv"
2020
```bash
21-
poetry add labelformat
21+
uv add labelformat
2222
```
2323

2424
=== "Conda"
@@ -41,13 +41,13 @@ If you prefer to install Labelformat from the source code, follow these steps:
4141
cd labelformat
4242
```
4343
2. Install Dependencies:
44-
Labelformat uses Poetry for dependency management. Ensure you have Poetry installed:
44+
Labelformat uses uv for dependency management. Ensure you have uv installed:
4545
```bash
46-
pip install poetry
46+
pip install uv
4747
```
4848
3. Set Up the Development Environment:
4949
```bash
50-
poetry install
50+
uv sync --all-groups
5151
```
5252

5353
## Updating Labelformat

poetry.lock

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

pyproject.toml

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,50 @@
1-
[build-system]
2-
requires = ["poetry-core>=1.0.0"]
3-
build-backend = "poetry.core.masonry.api"
4-
5-
[tool.poetry]
1+
[project]
62
name = "labelformat"
73
version = "0.1.11"
8-
authors = ["Lightly.ai"]
4+
authors = [{ name = "Lightly.ai" }]
95
description = "A tool for converting computer vision label formats."
106
readme = "README.md"
11-
license = "MIT"
7+
license = { text = "MIT" }
8+
requires-python = ">=3.8"
9+
dependencies = [
10+
"tqdm",
11+
"pyyaml",
12+
"pillow",
13+
"pydantic==2.10.6",
14+
"pydantic-xml==2.17.3",
15+
"numpy",
16+
]
17+
18+
[project.scripts]
19+
labelformat = "labelformat.cli.cli:main"
1220

13-
[tool.poetry.dependencies]
14-
python = ">=3.8"
15-
tqdm = "*"
16-
pyyaml = "*"
17-
pillow = "*"
18-
pydantic-xml = "*"
19-
numpy = "*"
21+
[dependency-groups]
22+
dev = [
23+
"mypy==1.14.1",
24+
"black",
25+
"isort",
26+
"flake8",
27+
"pytest<8",
28+
"pytest-mock",
29+
"build",
30+
"twine",
31+
"types-Pillow",
32+
"types-PyYAML",
33+
"opencv-python",
34+
]
2035

21-
[tool.poetry.group.dev.dependencies]
22-
mypy = "*"
23-
black = "*"
24-
isort = "*"
25-
flake8 = "*"
26-
pytest = "*"
27-
pytest-mock = "*"
28-
build = "*"
29-
twine = "*"
30-
types-Pillow = "*"
31-
types-PyYAML = "*"
32-
opencv-python = "*"
36+
[build-system]
37+
requires = ["hatchling"]
38+
build-backend = "hatchling.build"
3339

34-
[tool.poetry.scripts]
35-
labelformat = "labelformat.cli.cli:main"
40+
[tool.hatch.build.targets.sdist]
41+
only-include = ["src/labelformat"]
42+
43+
[tool.hatch.build.targets.wheel]
44+
packages = ["src/labelformat"]
45+
46+
[tool.uv]
47+
required-version = ">=0.10.4"
3648

3749
[tool.pytest.ini_options]
3850
pythonpath = [
@@ -72,4 +84,4 @@ warn_unreachable = true
7284

7385
# Print format
7486
show_error_codes = true
75-
show_error_context = true
87+
show_error_context = true

0 commit comments

Comments
 (0)