Skip to content

Commit 5ebda92

Browse files
authored
🧑‍💻 Dev: migrate to uv (#233)
1 parent d37af55 commit 5ebda92

28 files changed

+1782
-4451
lines changed

.devcontainer/devcontainer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
2-
"name": "Default Linux Universal",
3-
"image": "mcr.microsoft.com/devcontainers/universal:2-linux",
2+
"name": "Ubuntu",
3+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
44
"features": {
5-
"ghcr.io/devcontainers-extra/features/poetry:2": {}
5+
"ghcr.io/jsburckhardt/devcontainer-features/uv:1": {},
6+
"ghcr.io/meaningful-ooo/devcontainer-features/fish:2": {}
67
},
78
"postCreateCommand": "./scripts/setup-envs.sh",
89
"customizations": {

.github/actions/setup-poetry/action.yml

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

.github/actions/setup-python/action.yml

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,20 @@ inputs:
55
python-version:
66
description: Python version
77
required: false
8-
default: "3.10"
9-
env-dir:
10-
description: Environment directory
11-
required: true
12-
no-root:
13-
description: Do not install package in the environment
14-
required: false
15-
default: "false"
16-
args:
17-
description: Additional arguments to pass to the install command
8+
default: "3.12"
9+
env-group:
10+
description: Environment group
1811
required: false
12+
default: "pydantic-v2"
1913

2014
runs:
2115
using: "composite"
2216
steps:
23-
- name: Install poetry
24-
uses: ./.github/actions/setup-poetry
25-
26-
- uses: actions/setup-python@v5
17+
- uses: astral-sh/setup-uv@v6
2718
with:
2819
python-version: ${{ inputs.python-version }}
29-
cache: "poetry"
30-
cache-dependency-path: |
31-
./poetry.lock
32-
${{ inputs.env-dir }}/poetry.lock
20+
cache-suffix: ${{ inputs.env-group }}
3321

3422
- run: |
35-
cd ${{ inputs.env-dir }}
36-
if [ "${{ inputs.no-root }}" = "true" ]; then
37-
poetry install --all-extras --no-root ${{ inputs.args }}
38-
else
39-
poetry install --all-extras ${{ inputs.args }}
40-
fi
23+
uv sync --all-extras --locked --group ${{ inputs.env-group }}
4124
shell: bash

.github/dependabot.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@ updates:
99
patterns:
1010
- "*"
1111

12-
- package-ecosystem: github-actions
13-
directory: "/.github/actions/setup-poetry"
14-
schedule:
15-
interval: daily
16-
groups:
17-
actions:
18-
patterns:
19-
- "*"
20-
2112
- package-ecosystem: github-actions
2213
directory: "/.github/actions/setup-python"
2314
schedule:

.github/workflows/codecov.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ on:
66
- master
77
pull_request:
88
paths:
9-
- "envs/**"
109
- "githubkit/**"
1110
- "tests/**"
12-
- ".github/actions/setup-poetry/**"
1311
- ".github/actions/setup-python/**"
1412
- ".github/workflows/codecov.yml"
1513
- "pyproject.toml"
16-
- "poetry.lock"
14+
- "uv.lock"
1715

1816
jobs:
1917
test:
@@ -40,21 +38,29 @@ jobs:
4038
uses: ./.github/actions/setup-python
4139
with:
4240
python-version: ${{ matrix.python-version }}
43-
env-dir: ./envs/${{ matrix.env }}
44-
no-root: true
41+
env-group: ${{ matrix.env }}
4542

4643
- name: Run Pytest
4744
run: |
48-
cd ./envs/${{ matrix.env }}
49-
poetry run bash "../../scripts/run-tests.sh"
45+
uv run --no-sync bash ./scripts/run-tests.sh
5046
env:
5147
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5248

49+
- name: Upload test results
50+
uses: codecov/test-results-action@v1
51+
with:
52+
env_vars: OS,PYTHON_VERSION,PYDANTIC_VERSION
53+
files: ./junit.xml
54+
flags: unittests
55+
env:
56+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
57+
5358
- name: Upload coverage report
5459
uses: codecov/codecov-action@v5
5560
with:
5661
env_vars: OS,PYTHON_VERSION,PYDANTIC_VERSION
5762
files: ./coverage.xml
5863
flags: unittests
64+
fail_ci_if_error: true
5965
env:
6066
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/docs.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,8 @@ jobs:
1515
with:
1616
fetch-depth: 0
1717

18-
- name: Setup Poetry
19-
uses: ./.github/actions/setup-poetry
20-
2118
- name: Setup Python environment
2219
uses: ./.github/actions/setup-python
23-
with:
24-
env-dir: .
25-
args: "--with docs"
2620

2721
- uses: actions/cache@v4
2822
with:
@@ -33,8 +27,8 @@ jobs:
3327
3428
- name: Build Docs
3529
run: |
36-
poetry run mkdocs --version
37-
poetry run mkdocs build --clean
30+
uv run mkdocs --version
31+
uv run mkdocs build --clean
3832
chmod -c -R +rX "site/" | while read line; do
3933
echo "::warning title=Invalid file permissions automatically fixed::$line"
4034
done

.github/workflows/pyright.yml

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ on:
66
- master
77
pull_request:
88
paths:
9-
- "envs/**"
109
- "githubkit/**"
1110
- "tests/**"
1211
- "codegen/**"
1312
- ".github/actions/setup-python/**"
1413
- ".github/workflows/pyright.yml"
15-
- "**/pyproject.toml"
16-
- "**/poetry.lock"
14+
- "pyproject.toml"
15+
- "uv.lock"
1716

1817
jobs:
1918
lint-githubkit:
@@ -33,11 +32,10 @@ jobs:
3332
- name: Setup Python environment
3433
uses: ./.github/actions/setup-python
3534
with:
36-
env-dir: ./envs/${{ matrix.env }}
37-
no-root: true
35+
env-group: ${{ matrix.env }}
3836

3937
- run: |
40-
(cd ./envs/${{ matrix.env }} && echo "$(poetry env info --path)/bin" >> $GITHUB_PATH)
38+
echo "$(dirname $(uv python find))" >> $GITHUB_PATH
4139
if [ "${{ matrix.env }}" = "pydantic-v1" ]; then
4240
sed -i 's/PYDANTIC_V2 = true/PYDANTIC_V2 = false/g' ./pyproject.toml
4341
fi
@@ -47,25 +45,3 @@ jobs:
4745
uses: jakebailey/pyright-action@v2
4846
with:
4947
pylance-version: latest-release
50-
51-
lint-codegen:
52-
name: Codegen Lint
53-
runs-on: ubuntu-latest
54-
55-
steps:
56-
- uses: actions/checkout@v4
57-
58-
- name: Setup Python environment
59-
uses: ./.github/actions/setup-python
60-
with:
61-
env-dir: .
62-
63-
- run: |
64-
echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
65-
shell: bash
66-
67-
- name: Run Pyright
68-
uses: jakebailey/pyright-action@v2
69-
with:
70-
working-directory: ./codegen
71-
pylance-version: latest-release

.github/workflows/release.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,26 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717

18-
- name: Setup Poetry
19-
uses: ./.github/actions/setup-poetry
18+
- name: Setup Python
19+
uses: ./.github/actions/setup-python
2020

2121
- name: Get Version
2222
id: version
2323
run: |
24-
echo "VERSION=$(poetry version -s)" >> $GITHUB_OUTPUT
24+
echo "VERSION=$(uv version --short)" >> $GITHUB_OUTPUT
2525
echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
2626
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
2727
2828
- name: Check Version
2929
if: steps.version.outputs.VERSION != steps.version.outputs.TAG_VERSION
3030
run: exit 1
3131

32-
- name: Build Package
33-
run: poetry build
34-
35-
- name: Publish Package to PyPI
36-
uses: pypa/gh-action-pypi-publish@release/v1
37-
3832
- name: Build and Publish Package
33+
run: |
34+
uv build
35+
uv publish
36+
37+
- name: Publish Package to GitHub
3938
run: gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl
4039
env:
4140
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ruff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ jobs:
1414
- uses: actions/checkout@v4
1515

1616
- name: Run Ruff Lint
17-
uses: chartboost/ruff-action@v1
17+
uses: astral-sh/ruff-action@v3

0 commit comments

Comments
 (0)