Skip to content

Commit 16986c0

Browse files
milothjorenham
andauthored
🔧 use uv as package manager (#174)
* chore: `poetry` env in local `.venv` folder * chore: add `just` as dep * chore: added `just` commands * chore: commands with arguments in `justfile` * chore: move the project to `uv` * chore: `tox` and `pre-commit` can access `uv` envs * chore: `tox` and `pre-commit` config change * ci: move to `uv` and `just` * chore: version bump * feat: add typed marker * fix: lint error on duplicate python version * fix: lint and typecheck run * docs: update to `uv` and `just` * rev: `py.typed` not needed * 🔧 remove `just` * 🔧 fix `uv sync` * 💚 use `typos` for spellchecking * 🔧 PEP 735 dependency groups * 💚 work around mypy not understanding editable stub packages * 👷 use `tox-uv` * 📝 update the contributing guide * 🧑‍💻 use `pre-commit-uv` --------- Co-authored-by: jorenham <[email protected]>
1 parent ab5cf1f commit 16986c0

File tree

6 files changed

+1044
-1237
lines changed

6 files changed

+1044
-1237
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -29,73 +29,58 @@ jobs:
2929
config: ".markdownlint.yaml"
3030
globs: "**/*.md"
3131

32-
- run: |
33-
pipx install poetry poethepoet
34-
poetry config virtualenvs.in-project true --local
32+
- name: typos
33+
uses: crate-ci/typos@master
3534

36-
- uses: actions/setup-python@v5
37-
with:
38-
python-version: "3.13"
39-
cache: poetry
35+
- name: setup uv
36+
uses: astral-sh/setup-uv@v4
4037

4138
- name: install
42-
run: poetry install --with=codegen
39+
run: uv sync --frozen --python 3.13
4340

4441
- name: lint
45-
run: poe lint
42+
run: uv run poe lint
4643

4744
- name: basedmypy
48-
run: poe mypy
45+
run: uv run poe mypy
4946

5047
- name: basedpyright
51-
run: poe pyright
48+
run: uv run poe pyright
5249

5350
typetest:
5451
timeout-minutes: 5
5552
runs-on: ubuntu-latest
5653
steps:
5754
- uses: actions/checkout@v4
5855

59-
- run: |
60-
pipx install poetry poethepoet
61-
poetry config virtualenvs.in-project true --local
62-
63-
- uses: actions/setup-python@v5
64-
with:
65-
python-version: "3.13"
66-
cache: poetry
56+
- name: setup uv
57+
uses: astral-sh/setup-uv@v4
6758

6859
- name: install
69-
run: poetry install
60+
run: uv sync --frozen --python 3.13
7061

7162
- name: typetest
72-
run: poe typetest
63+
run: uv run poe typetest
7364

7465
- name: stubtest
75-
run: poe stubtest
66+
run: uv run poe stubtest
7667

7768
typetest-oldest-supported-numpy:
7869
timeout-minutes: 5
7970
runs-on: ubuntu-latest
8071
steps:
8172
- uses: actions/checkout@v4
8273

83-
- run: |
84-
pipx install poetry poethepoet
85-
poetry config virtualenvs.in-project true --local
86-
87-
- uses: actions/setup-python@v5
88-
with:
89-
python-version: ${{ env.OLDEST_SUPPORTED_PYTHON }}
90-
cache: poetry
74+
- name: setup uv
75+
uses: astral-sh/setup-uv@v4
9176

9277
- name: install
9378
run: |
94-
poetry install
95-
poetry run pip install --upgrade numpy==$OLDEST_SUPPORTED_NUMPY
79+
uv sync --frozen --python=$OLDEST_SUPPORTED_PYTHON
80+
uv pip install --upgrade numpy==$OLDEST_SUPPORTED_NUMPY
9681
9782
- name: typetest
98-
run: poe typetest
83+
run: uv run poe typetest
9984

10085
- name: stubtest
101-
run: poe stubtest
86+
run: uv run poe stubtest

.pre-commit-config.yaml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ci:
44
skip:
55
- markdownlint
66
- mdformat
7-
- codespell
7+
- typos
88
- ruff
99
- ruff-format
1010
- typetest
@@ -57,12 +57,10 @@ repos:
5757
- mdformat-gfm-alerts
5858
- mdformat-pyproject
5959

60-
- repo: https://github.com/codespell-project/codespell
61-
rev: v2.3.0
60+
- repo: https://github.com/crate-ci/typos
61+
rev: v1.28.2
6262
hooks:
63-
- id: codespell
64-
additional_dependencies:
65-
- tomli
63+
- id: typos
6664

6765
- repo: https://github.com/astral-sh/ruff-pre-commit
6866
rev: v0.8.1
@@ -77,20 +75,20 @@ repos:
7775
- repo: local
7876
hooks:
7977
- id: typetest
80-
name: poe typetest
81-
entry: poe typetest
78+
name: typetest
79+
entry: uv run poe typetest
8280
language: system
8381
always_run: true
8482
pass_filenames: false
8583

8684
- id: basedmypy
8785
name: basedmypy
88-
entry: poe mypy
86+
entry: uv run poe mypy
8987
language: system
9088
types_or: [python, pyi]
9189

9290
- id: basedpyright
9391
name: basedpyright
94-
entry: poe pyright
92+
entry: uv run poe pyright
9593
language: system
9694
types_or: [python, pyi]

CONTRIBUTING.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,30 @@ poe pre-commit
205205
206206
### Tox
207207

208-
The pre-commit hooks and `stubtest` can easily be run with [tox](https://github.com/tox-dev/tox):
208+
The pre-commit hooks and `stubtest` can easily be run with [tox](https://github.com/tox-dev/tox).
209+
It can be installed with:
209210

210211
```bash
211-
poe tox
212+
uv tool install tox --with tox-uv
212213
```
213214

214-
This will run `stubtest` in parallel on all supported Python versions, as well as `pre-commit`.
215+
To run all environments in parallel, run:
216+
217+
```shell
218+
$ tox -p all
219+
repo-review: OK ✔ in 0.4 seconds
220+
3.12: OK ✔ in 10.38 seconds
221+
3.10: OK ✔ in 10.62 seconds
222+
3.11: OK ✔ in 11.04 seconds
223+
3.13: OK ✔ in 19.42 seconds
224+
repo-review: OK (0.40=setup[0.04]+cmd[0.36] seconds)
225+
pre-commit: OK (24.91=setup[0.04]+cmd[24.87] seconds)
226+
3.10: OK (10.62=setup[0.11]+cmd[10.51] seconds)
227+
3.11: OK (11.04=setup[0.04]+cmd[11.00] seconds)
228+
3.12: OK (10.38=setup[0.04]+cmd[10.34] seconds)
229+
3.13: OK (19.42=setup[0.04]+cmd[19.38] seconds)
230+
congratulations :) (24.96 seconds)
231+
```
215232

216233
### Improving The Documentation
217234

0 commit comments

Comments
 (0)