Skip to content

Commit 4676eae

Browse files
authored
Migrate from Poetry to uv (#861)
1 parent 96b0b6c commit 4676eae

13 files changed

Lines changed: 1787 additions & 2767 deletions

File tree

.github/renovate.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
"commitMessagePrefix": "⬆️",
1212
"packageRules": [
1313
{
14-
"matchManagers": ["poetry"],
14+
"matchManagers": ["pep621"],
1515
"addLabels": ["python"]
1616
},
1717
{
18-
"matchManagers": ["poetry"],
18+
"matchManagers": ["pep621"],
1919
"matchDepTypes": ["dev"],
2020
"rangeStrategy": "pin"
2121
},
2222
{
23-
"matchManagers": ["poetry"],
23+
"matchManagers": ["pep621"],
2424
"matchUpdateTypes": ["minor", "patch"],
2525
"automerge": true
2626
},

.github/workflows/linting.yaml

Lines changed: 26 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,31 @@ jobs:
1919
steps:
2020
- name: ⤵️ Check out code from GitHub
2121
uses: actions/checkout@v6.0.2
22-
- name: 🏗 Set up Poetry
23-
run: pipx install poetry
24-
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
25-
id: python
26-
uses: actions/setup-python@v6.2.0
22+
- name: 🏗 Install uv
23+
uses: astral-sh/setup-uv@v8.1.0
2724
with:
2825
python-version: ${{ env.DEFAULT_PYTHON }}
29-
cache: "poetry"
30-
- name: 🏗 Install workflow dependencies
31-
run: |
32-
poetry config virtualenvs.create true
33-
poetry config virtualenvs.in-project true
3426
- name: 🏗 Install Python dependencies
35-
run: poetry install --no-interaction
27+
run: uv sync --all-groups
3628
- name: 🚀 Check code for common misspellings
37-
run: poetry run prek run codespell --all-files
29+
run: uv run prek run codespell --all-files
3830

3931
ruff:
4032
name: Ruff
4133
runs-on: ubuntu-latest
4234
steps:
4335
- name: ⤵️ Check out code from GitHub
4436
uses: actions/checkout@v6.0.2
45-
- name: 🏗 Set up Poetry
46-
run: pipx install poetry
47-
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
48-
id: python
49-
uses: actions/setup-python@v6.2.0
37+
- name: 🏗 Install uv
38+
uses: astral-sh/setup-uv@v8.1.0
5039
with:
5140
python-version: ${{ env.DEFAULT_PYTHON }}
52-
cache: "poetry"
53-
- name: 🏗 Install workflow dependencies
54-
run: |
55-
poetry config virtualenvs.create true
56-
poetry config virtualenvs.in-project true
5741
- name: 🏗 Install Python dependencies
58-
run: poetry install --no-interaction
42+
run: uv sync --all-groups
5943
- name: 🚀 Run ruff linter
60-
run: poetry run ruff check --output-format=github .
44+
run: uv run ruff check --output-format=github .
6145
- name: 🚀 Run ruff formatter
62-
run: poetry run ruff format --check .
46+
run: uv run ruff format --check .
6347

6448
prek-builtin-hooks:
6549
name: prek-builtin-hooks
@@ -98,91 +82,59 @@ jobs:
9882
steps:
9983
- name: ⤵️ Check out code from GitHub
10084
uses: actions/checkout@v6.0.2
101-
- name: 🏗 Set up Poetry
102-
run: pipx install poetry
103-
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
104-
id: python
105-
uses: actions/setup-python@v6.2.0
85+
- name: 🏗 Install uv
86+
uses: astral-sh/setup-uv@v8.1.0
10687
with:
10788
python-version: ${{ env.DEFAULT_PYTHON }}
108-
cache: "poetry"
109-
- name: 🏗 Install workflow dependencies
110-
run: |
111-
poetry config virtualenvs.create true
112-
poetry config virtualenvs.in-project true
11389
- name: 🏗 Install Python dependencies
114-
run: poetry install --no-interaction
90+
run: uv sync --all-groups
11591
- name: 🚀 Check Python AST
116-
run: poetry run prek run check-ast --all-files
92+
run: uv run prek run check-ast --all-files
11793
- name: 🚀 Check docstring is first
118-
run: poetry run prek run check-docstring-first --all-files
94+
run: uv run prek run check-docstring-first --all-files
11995

12096
pylint:
12197
name: pylint
12298
runs-on: ubuntu-latest
12399
steps:
124100
- name: ⤵️ Check out code from GitHub
125101
uses: actions/checkout@v6.0.2
126-
- name: 🏗 Set up Poetry
127-
run: pipx install poetry
128-
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
129-
id: python
130-
uses: actions/setup-python@v6.2.0
102+
- name: 🏗 Install uv
103+
uses: astral-sh/setup-uv@v8.1.0
131104
with:
132105
python-version: ${{ env.DEFAULT_PYTHON }}
133-
cache: "poetry"
134-
- name: 🏗 Install workflow dependencies
135-
run: |
136-
poetry config virtualenvs.create true
137-
poetry config virtualenvs.in-project true
138106
- name: 🏗 Install Python dependencies
139-
run: poetry install --no-interaction
107+
run: uv sync --all-groups
140108
- name: 🚀 Run pylint
141-
run: poetry run prek run pylint --all-files
109+
run: uv run prek run pylint --all-files
142110

143111
yamllint:
144112
name: yamllint
145113
runs-on: ubuntu-latest
146114
steps:
147115
- name: ⤵️ Check out code from GitHub
148116
uses: actions/checkout@v6.0.2
149-
- name: 🏗 Set up Poetry
150-
run: pipx install poetry
151-
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
152-
id: python
153-
uses: actions/setup-python@v6.2.0
117+
- name: 🏗 Install uv
118+
uses: astral-sh/setup-uv@v8.1.0
154119
with:
155120
python-version: ${{ env.DEFAULT_PYTHON }}
156-
cache: "poetry"
157-
- name: 🏗 Install workflow dependencies
158-
run: |
159-
poetry config virtualenvs.create true
160-
poetry config virtualenvs.in-project true
161121
- name: 🏗 Install Python dependencies
162-
run: poetry install --no-interaction
122+
run: uv sync --all-groups
163123
- name: 🚀 Run yamllint
164-
run: poetry run yamllint .
124+
run: uv run yamllint .
165125

166126
prettier:
167127
name: Prettier
168128
runs-on: ubuntu-latest
169129
steps:
170130
- name: ⤵️ Check out code from GitHub
171131
uses: actions/checkout@v6.0.2
172-
- name: 🏗 Set up Poetry
173-
run: pipx install poetry
174-
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
175-
id: python
176-
uses: actions/setup-python@v6.2.0
132+
- name: 🏗 Install uv
133+
uses: astral-sh/setup-uv@v8.1.0
177134
with:
178135
python-version: ${{ env.DEFAULT_PYTHON }}
179-
cache: "poetry"
180-
- name: 🏗 Install workflow dependencies
181-
run: |
182-
poetry config virtualenvs.create true
183-
poetry config virtualenvs.in-project true
184136
- name: 🏗 Install Python dependencies
185-
run: poetry install --no-interaction
137+
run: uv sync --all-groups
186138
- name: 🏗 Set up Node.js
187139
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
188140
with:
@@ -191,4 +143,4 @@ jobs:
191143
- name: 🏗 Install NPM dependencies
192144
run: npm install
193145
- name: 🚀 Run prettier
194-
run: poetry run prek run prettier --all-files
146+
run: uv run prek run prettier --all-files

.github/workflows/release.yaml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,25 @@ jobs:
1414
release:
1515
name: Releasing to PyPi
1616
runs-on: ubuntu-latest
17+
environment: release
18+
permissions:
19+
id-token: write
1720
steps:
1821
- name: ⤵️ Check out code from GitHub
1922
uses: actions/checkout@v6.0.2
20-
- name: 🏗 Set up Poetry
21-
run: pipx install poetry
22-
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
23-
id: python
24-
uses: actions/setup-python@v6.2.0
23+
- name: 🏗 Install uv
24+
uses: astral-sh/setup-uv@v8.1.0
2525
with:
2626
python-version: ${{ env.DEFAULT_PYTHON }}
27-
cache: "poetry"
28-
- name: 🏗 Install workflow dependencies
29-
run: |
30-
poetry config virtualenvs.create true
31-
poetry config virtualenvs.in-project true
3227
- name: 🏗 Install dependencies
33-
run: poetry install --no-interaction
28+
run: uv sync --all-groups
3429
- name: 🏗 Set package version
3530
run: |
3631
version="${{ github.event.release.tag_name }}"
3732
version="${version,,}"
3833
version="${version#v}"
39-
poetry version --no-interaction "${version}"
34+
uv version "${version}"
4035
- name: 🏗 Build package
41-
run: poetry build --no-interaction
42-
- name: 🚀 Publish to PyPi
43-
env:
44-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
45-
run: |
46-
poetry config pypi-token.pypi "${PYPI_TOKEN}"
47-
poetry publish --no-interaction
36+
run: uv build
37+
- name: 🚀 Publish package to PyPi
38+
uses: pypa/gh-action-pypi-publish@v1.13.0

.github/workflows/tests.yaml

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,14 @@ jobs:
2222
steps:
2323
- name: ⤵️ Check out code from GitHub
2424
uses: actions/checkout@v6.0.2
25-
- name: 🏗 Set up Poetry
26-
run: pipx install poetry
27-
- name: 🏗 Set up Python ${{ matrix.python }}
28-
id: python
29-
uses: actions/setup-python@v6.2.0
25+
- name: 🏗 Install uv
26+
uses: astral-sh/setup-uv@v8.1.0
3027
with:
3128
python-version: ${{ matrix.python }}
32-
cache: "poetry"
33-
- name: 🏗 Install workflow dependencies
34-
run: |
35-
poetry config virtualenvs.create true
36-
poetry config virtualenvs.in-project true
3729
- name: 🏗 Install dependencies
38-
run: poetry install --no-interaction
30+
run: uv sync --all-groups
3931
- name: 🚀 Run pytest
40-
run: poetry run pytest --cov src tests
32+
run: uv run pytest --cov src tests
4133
- name: ⬆️ Upload coverage artifact
4234
uses: actions/upload-artifact@v7.0.1
4335
with:
@@ -55,24 +47,16 @@ jobs:
5547
fetch-depth: 0
5648
- name: ⬇️ Download coverage data
5749
uses: actions/download-artifact@v8.0.1
58-
- name: 🏗 Set up Poetry
59-
run: pipx install poetry
60-
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
61-
id: python
62-
uses: actions/setup-python@v6.2.0
50+
- name: 🏗 Install uv
51+
uses: astral-sh/setup-uv@v8.1.0
6352
with:
6453
python-version: ${{ env.DEFAULT_PYTHON }}
65-
cache: "poetry"
66-
- name: 🏗 Install workflow dependencies
67-
run: |
68-
poetry config virtualenvs.create true
69-
poetry config virtualenvs.in-project true
7054
- name: 🏗 Install dependencies
71-
run: poetry install --no-interaction
55+
run: uv sync --all-groups
7256
- name: 🚀 Process coverage results
7357
run: |
74-
poetry run coverage combine coverage*/.coverage*
75-
poetry run coverage xml -i
58+
uv run coverage combine coverage*/.coverage*
59+
uv run coverage xml -i
7660
- name: 🚀 Upload coverage report
7761
uses: codecov/codecov-action@v6.0.1
7862
with:

.github/workflows/typing.yaml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,11 @@ jobs:
1919
steps:
2020
- name: ⤵️ Check out code from GitHub
2121
uses: actions/checkout@v6.0.2
22-
- name: 🏗 Set up Poetry
23-
run: pipx install poetry
24-
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
25-
id: python
26-
uses: actions/setup-python@v6.2.0
22+
- name: 🏗 Install uv
23+
uses: astral-sh/setup-uv@v8.1.0
2724
with:
2825
python-version: ${{ env.DEFAULT_PYTHON }}
29-
cache: "poetry"
30-
- name: 🏗 Install workflow dependencies
31-
run: |
32-
poetry config virtualenvs.create true
33-
poetry config virtualenvs.in-project true
3426
- name: 🏗 Install dependencies
35-
run: poetry install --no-interaction
27+
run: uv sync --all-groups
3628
- name: 🚀 Run mypy
37-
run: poetry run mypy examples src tests
29+
run: uv run mypy examples src tests

.pre-commit-config.yaml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,43 @@ repos:
66
name: 🐶 Ruff
77
language: system
88
types: [python]
9-
entry: poetry run ruff --fix
9+
entry: uv run ruff --fix
1010
require_serial: true
1111
stages: [commit, push, manual]
1212
- id: black
1313
name: ☕️ Format using black
1414
language: system
1515
types: [python]
16-
entry: poetry run black
16+
entry: uv run black
1717
require_serial: true
1818
- id: blacken-docs
1919
name: ☕️ Format documentation examples using black
2020
language: system
2121
files: '\.(rst|md|markdown|py|tex)$'
22-
entry: poetry run blacken-docs
22+
entry: uv run blacken-docs
2323
require_serial: true
2424
- id: check-ast
2525
name: 🐍 Check Python AST
2626
language: system
2727
types: [python]
28-
entry: poetry run check-ast
28+
entry: uv run check-ast
2929
- id: check-docstring-first
3030
name: ℹ️ Check docstring is first
3131
language: system
3232
types: [python]
33-
entry: poetry run check-docstring-first
33+
entry: uv run check-docstring-first
3434
- id: codespell
3535
name: ✅ Check code for common misspellings
3636
language: system
3737
types: [text]
38-
exclude: ^poetry\.lock$
39-
entry: poetry run codespell
38+
exclude: ^uv\.lock$
39+
entry: uv run codespell
4040
- id: mypy
4141
name: 🆎 Static type checking using mypy
4242
language: system
4343
types: [python]
44-
entry: poetry run mypy
44+
entry: uv run mypy
4545
require_serial: true
46-
- id: poetry
47-
name: 📜 Check pyproject with Poetry
48-
language: system
49-
entry: poetry check
50-
pass_filenames: false
51-
always_run: true
5246
- id: prettier
5347
name: 💄 Ensuring files are prettier
5448
language: system
@@ -59,18 +53,18 @@ repos:
5953
name: 🌟 Starring code with pylint
6054
language: system
6155
types: [python]
62-
entry: poetry run pylint
56+
entry: uv run pylint
6357
- id: pytest
6458
name: 🧪 Running tests and test coverage with pytest
6559
language: system
6660
types: [python]
67-
entry: poetry run pytest
61+
entry: uv run pytest
6862
pass_filenames: false
6963
- id: yamllint
7064
name: 🎗 Check YAML files with yamllint
7165
language: system
7266
types: [yaml]
73-
entry: poetry run yamllint
67+
entry: uv run yamllint
7468
- repo: builtin
7569
hooks:
7670
- id: check-case-conflict

0 commit comments

Comments
 (0)