Skip to content

Commit 4e61b0d

Browse files
authored
feat: migrate from Poetry/mypy to uv/ty for improved performance (#87)
Replaced Poetry with uv for dependency management and mypy with ty for type checking. Updated build backend to setuptools with uv lockfile support. Modified all development tooling including devbox, lefthook, Dockerfile, README, and CI workflows to use the new Astral ecosystem tools. uv's Rust-based resolver provides significantly faster dependency resolution and installation compared to Poetry. ty offers substantial performance improvements over mypy while maintaining type safety. This migration creates consistency across all Python tooling (ruff, uv, ty) within the Astral ecosystem.
1 parent 1746e01 commit 4e61b0d

19 files changed

Lines changed: 1588 additions & 1933 deletions

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
!README.md
66
!LICENSE
77
!pyproject.toml
8-
!poetry.lock
8+
!uv.lock
99
!zitadel_client/
1010
!zitadel_client/**/*
1111

.github/workflows/integration.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,16 @@ jobs:
4040
ref: ${{ inputs.sanity_ref }}
4141
path: project/sanity
4242

43-
- name: Install poetry
44-
run: |
45-
echo "Installing latest Poetry for Python ${{ matrix.python-version }}"
46-
pipx install poetry
47-
48-
- name: Setup Python
49-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
43+
- name: Setup uv
44+
uses: astral-sh/setup-uv@v4
5045
with:
5146
python-version: ${{ matrix.python-version }}
52-
cache: 'poetry'
5347

5448
- name: Check Installability
5549
working-directory: project/sanity
5650
run: |
57-
poetry add zitadel-client@../library
58-
poetry run python main.py
51+
uv venv --python ${{ matrix.python-version }}
52+
source .venv/bin/activate
53+
if [ -f requirements.txt ]; then uv pip install -r requirements.txt; fi
54+
uv pip install ../library
55+
python main.py

.github/workflows/linting.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,16 @@ jobs:
3636
with:
3737
ref: ${{ inputs.ref }}
3838

39-
- name: Install poetry
40-
run: |
41-
pipx install poetry
42-
43-
- name: Setup Python
44-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
39+
- name: Setup uv
40+
uses: astral-sh/setup-uv@v4
4541
with:
46-
python-version-file: 'pyproject.toml'
47-
cache: 'poetry'
42+
python-version: "3.10"
4843

49-
- name: Install Dependencies
50-
run: poetry install --no-interaction --sync --with dev --all-extras
44+
- name: Install dependencies
45+
run: uv sync --group dev --frozen
5146

5247
- name: Run Formatter
53-
run: poetry run ruff format .
48+
run: uv run ruff format .
5449

5550
- name: Commit Changes
5651
if: ${{ inputs.commit_changes == true }}

.github/workflows/release.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,13 @@ jobs:
3232
with:
3333
fetch-depth: 0
3434

35-
- name: Install poetry
36-
run: |
37-
pipx install poetry
38-
39-
- name: Setup Python
40-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
35+
- name: Setup uv
36+
uses: astral-sh/setup-uv@v4
4137
with:
42-
python-version-file: 'pyproject.toml'
43-
cache: 'poetry'
38+
python-version: "3.10"
39+
40+
- name: Install dependencies
41+
run: uv sync --group dev --frozen
4442

4543
- name: Setup Node.js
4644
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0

.github/workflows/test.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,16 @@ jobs:
2727
with:
2828
ref: ${{ inputs.ref }}
2929

30-
- name: Install poetry
31-
run: |
32-
pipx install poetry
33-
34-
- name: Setup Python
35-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
30+
- name: Setup uv
31+
uses: astral-sh/setup-uv@v4
3632
with:
37-
python-version-file: 'pyproject.toml'
38-
cache: 'poetry'
33+
python-version: "3.10"
3934

40-
- name: Install Dependencies
41-
run: poetry install --no-interaction --sync --with dev --all-extras
35+
- name: Install dependencies
36+
run: uv sync --group dev --frozen
4237

4338
- name: Run Tests
44-
run: poetry run pytest --junitxml=build/reports/junit.xml
39+
run: uv run pytest --junitxml=build/reports/junit.xml
4540

4641
- name: Generate coverage report
4742
uses: mridang/action-test-reporter@v1

.github/workflows/typecheck.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ permissions:
1515
contents: read
1616

1717
jobs:
18-
mypy-check:
18+
ty-check:
1919
runs-on: ubuntu-latest
2020
name: Inspect Code
2121

@@ -30,18 +30,13 @@ jobs:
3030
with:
3131
ref: ${{ inputs.ref }}
3232

33-
- name: Install poetry
34-
run: |
35-
pipx install poetry
36-
37-
- name: Setup Python
38-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
33+
- name: Setup uv
34+
uses: astral-sh/setup-uv@v4
3935
with:
40-
python-version-file: 'pyproject.toml'
41-
cache: 'poetry'
36+
python-version: "3.10"
4237

43-
- name: Install Dependencies
44-
run: poetry install --no-interaction --sync --with dev --all-extras
38+
- name: Install dependencies
39+
run: uv sync --group dev --frozen
4540

46-
- name: Run MyPy
47-
run: poetry run mypy
41+
- name: Run Ty
42+
run: uv run ty check

.github/workflows/unused.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,13 @@ jobs:
2929
with:
3030
ref: ${{ inputs.ref }}
3131

32-
- name: Install poetry
33-
run: |
34-
pipx install poetry
35-
36-
- name: Setup Python
37-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
32+
- name: Setup uv
33+
uses: astral-sh/setup-uv@v4
3834
with:
39-
python-version-file: 'pyproject.toml'
40-
cache: 'poetry'
35+
python-version: "3.10"
4136

42-
- name: Install Dependencies
43-
run: poetry install --no-interaction --sync --with dev --all-extras
37+
- name: Install dependencies
38+
run: uv sync --group dev --frozen
4439

4540
- name: Inspect Dependencies
4641
uses: mridang/action-dependency-insight@v1

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ htmlcov/
4040
.coverage
4141
.coverage.*
4242
.cache
43+
.uv-cache/
4344
nosetests.xml
4445
coverage.xml
4546
*,cover
@@ -71,4 +72,4 @@ devbox.json
7172
devbox.lock
7273
.devbox
7374

74-
.poetry
75+
.uv-cache

.releaserc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
[
2525
"@semantic-release/exec",
2626
{
27-
"prepareCmd": "poetry install --no-interaction --sync --all-extras"
27+
"prepareCmd": "uv sync --group dev --frozen"
2828
}
2929
],
3030
[

Dockerfile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
FROM python:3.13-slim@sha256:5f55cdf0c5d9dc1a415637a5ccc4a9e18663ad203673173b8cda8f8dcacef689
22

3+
ENV UV_COMPILE_BYTECODE=1
4+
ENV UV_LINK_MODE=copy
5+
36
WORKDIR /app
47

5-
RUN pip install --no-cache-dir poetry
8+
RUN apt-get update \
9+
&& apt-get install --yes --no-install-recommends curl ca-certificates \
10+
&& rm -rf /var/lib/apt/lists/* \
11+
&& curl -LsSf https://astral.sh/uv/install.sh | sh \
12+
&& mv /root/.local/bin/uv /usr/local/bin/uv \
13+
&& rm -rf /root/.local
614

7-
COPY pyproject.toml poetry.lock* ./
15+
ENV UV_PROJECT_ENVIRONMENT=/app/.venv
16+
ENV PATH="/app/.venv/bin:/usr/local/bin:${PATH}"
817

9-
RUN poetry install --no-root
18+
COPY pyproject.toml uv.lock ./
19+
RUN uv sync --frozen --no-dev --all-extras
1020

1121
COPY . .
22+
RUN uv sync --frozen --no-dev --all-extras
1223

13-
RUN poetry install
14-
15-
CMD ["poetry", "run", "python"]
24+
CMD ["uv", "run", "python"]

0 commit comments

Comments
 (0)