Skip to content

Commit fbfcce0

Browse files
committed
chore: migrate from Poetry to uv for Python package management
Replace Poetry with uv across the entire Python SDK toolchain: - pyproject.toml: poetry-core → hatchling build backend, dependency-groups for dev deps - CI workflows: snok/install-poetry → astral-sh/setup-uv, poetry run → uv run - PyPI publish workflow: pip install poetry → astral-sh/setup-uv, uv build - Makefile: all commands now use uv (sync, run, build, publish) - .goreleaser.yaml: builder poetry → uv - README: simplified dev setup to uv sync - Replaced poetry.lock with uv.lock
1 parent 46ae755 commit fbfcce0

8 files changed

Lines changed: 1430 additions & 1390 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,22 @@ jobs:
2121
with:
2222
python-version: ${{ matrix.python-version }}
2323

24-
- name: Install Poetry
25-
uses: snok/install-poetry@v1
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v5
2626

27-
- name: Install dependencies with dev dependencies for linting and type checking
28-
run: poetry install --with dev
29-
30-
# - name: Install dependencies
31-
# run: |
32-
# python -m pip install --upgrade pip -e ".[dev]"
33-
34-
#- name: Generate client
35-
# run: make generate
27+
- name: Install dependencies
28+
run: uv sync
3629

3730
- name: Run linting
3831
run: |
39-
poetry run ruff check src tests
40-
poetry run ruff format --check src tests
32+
uv run ruff check src tests
33+
uv run ruff format --check src tests
4134
4235
- name: Run type checking
43-
run: poetry run pyright src tests
36+
run: uv run pyright src tests
4437

4538
- name: Run tests
46-
run: poetry run pytest tests --cov=antfly --cov-report=xml
39+
run: uv run pytest tests --cov=antfly --cov-report=xml
4740

4841
- name: Upload coverage
4942
uses: codecov/codecov-action@v3

‎.github/workflows/pypi-publish.yml‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,10 @@ jobs:
2121
uses: actions/setup-python@v5
2222
with:
2323
python-version: "3.x"
24-
- name: Install poetry
25-
run: >-
26-
python3 -m
27-
pip install
28-
poetry
29-
--user
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v5
3026
- name: Build a binary wheel and a source tarball
31-
run: python3 -m poetry build
27+
run: uv build
3228
- name: Store the distribution packages
3329
uses: actions/upload-artifact@v4
3430
with:

‎.goreleaser.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
version: 2
33
builds:
44
- id: wheel
5-
builder: poetry
5+
builder: uv
66
buildmode: wheel
77
- id: sdist
8-
builder: poetry
8+
builder: uv
99
buildmode: sdist

‎Makefile‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: generate clean install test build publish docs fmt
1+
.PHONY: generate clean install test build publish docs fmt check update-deps
22

33
generate:
44
openapi-python-client generate --path ../openapi.yaml --output-path src/antfly --overwrite --config .openapi-generator-config.yaml
@@ -9,24 +9,24 @@ clean:
99
find . -type f -name "*.pyc" -delete
1010

1111
install:
12-
pip install -e ".[dev]"
12+
uv sync
1313

1414
test:
15-
pytest tests --cov=antfly --cov-report=xml
15+
uv run pytest tests --cov=antfly --cov-report=xml
1616

1717
build: clean generate
18-
python -m build
18+
uv build
1919

2020
publish: build
21-
python -m twine upload dist/*
21+
uv publish
2222

2323
docs:
2424
cd docs && make html
2525

2626
check:
27-
ruff check src tests --fix
28-
ruff format src tests --fix
29-
pyright src tests
27+
uv run ruff check src tests --fix
28+
uv run ruff format src tests --fix
29+
uv run pyright src tests
3030

3131
update-deps:
32-
poetry update
32+
uv lock --upgrade && uv sync

‎README.md‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,9 @@ user = client.get(table="users", key="user:1")
8888
2. Install development dependencies:
8989

9090
```bash
91-
python3 -m venv venv
92-
source venv/bin/activate
93-
python3 -m pip install --upgrade pip poetry
94-
poetry install
95-
deactivate
91+
uv sync
9692
```
9793

98-
The development dependencies are listed in `pyproject.toml` under `[project.optional-dependencies.dev]`.
99-
10094

10195
### Generate Client
10296

‎poetry.lock‎

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

‎pyproject.toml‎

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
2-
requires = ["poetry-core>=2.0.0,<3.0.0"]
3-
build-backend = "poetry.core.masonry.api"
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
44

55
[project]
66
name = "antfly-sdk"
@@ -24,35 +24,31 @@ classifiers = [
2424
"Programming Language :: Python :: 3.12",
2525
"Programming Language :: Python :: 3.13",
2626
]
27+
dependencies = [
28+
"httpx>=0.23.0,<0.29.0",
29+
"attrs>=22.2.0",
30+
"python-dateutil>=2.8.0,<3.0.0",
31+
]
2732

2833
[project.urls]
2934
Homepage = "https://github.com/antflydb/antfly-py"
3035
Documentation = "https://antfly-sdk-python.readthedocs.io"
3136
Repository = "https://github.com/antflydb/antfly-py"
3237
Issues = "https://github.com/antflydb/antfly-py/issues"
3338

34-
[tool.poetry]
35-
packages = [
36-
{ include = "antfly", from = "./src" },
39+
[dependency-groups]
40+
dev = [
41+
"pytest>=8.4.2",
42+
"pytest-cov>=7.0.0",
43+
"pytest-asyncio>=1.2.0",
44+
"requests>=2.32.5",
45+
"ruff>=0.13.0",
46+
"openapi-python-client>=0.26.1",
47+
"pyright>=1.1.405",
3748
]
3849

39-
[tool.poetry.dependencies]
40-
python = ">=3.9,<4.0"
41-
httpx = ">=0.23.0,<0.29.0"
42-
attrs = ">=22.2.0"
43-
python-dateutil = ">=2.8.0,<3.0.0"
44-
45-
[tool.poetry.group.dev.dependencies]
46-
pytest = "^8.4.2"
47-
pytest-cov = "^7.0.0"
48-
pytest-asyncio = "^1.2.0"
49-
requests ="^2.32.5"
50-
ruff = "^0.13.0"
51-
openapi-python-client = "^0.26.1"
52-
pyright = "^1.1.405"
53-
build = "^1.3.0"
54-
#sphinx = ">=8.2.3"
55-
#sphinx-rtd-theme = ">=1.0.0"
50+
[tool.hatch.build.targets.wheel]
51+
packages = ["src/antfly"]
5652

5753
[tool.ruff]
5854
line-length = 120

0 commit comments

Comments
 (0)