Skip to content

Commit e20291a

Browse files
committed
chore(main): migrate to uv
Also: - remove not required pyproject.toml/requirement.txt/setup.py files -> everything is kept in one pyproject.toml and common lock file - remove not required Dockerfile for docs. uv run just works fine here - keep license file in release (it is good) closes #957
1 parent 45d17d4 commit e20291a

File tree

30 files changed

+6242
-9817
lines changed

30 files changed

+6242
-9817
lines changed

.devcontainer/Dockerfile

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
1-
FROM mcr.microsoft.com/devcontainers/python:1-3.11-bookworm
1+
ARG UV_VERSION=latest
22

33

4-
RUN \
5-
apt update && apt install bash-completion -y && \
6-
pip install pre-commit && \
7-
curl -sSL https://install.python-poetry.org | POETRY_HOME=/home/vscode/.local python3 -
4+
FROM ghcr.io/astral-sh/uv:$UV_VERSION AS uv
85

96

10-
RUN \
11-
echo >> /home/vscode/.bashrc && \
12-
# add completions to bashrc
13-
# see how ubuntu does it for reference:
14-
# https://git.launchpad.net/ubuntu/+source/base-files/tree/share/dot.bashrc
15-
# https://stackoverflow.com/a/68566555
16-
echo 'if [ -f /etc/bash_completion ] && ! shopt -oq posix; then' >> /home/vscode/.bashrc && \
17-
echo ' . /etc/bash_completion' >> /home/vscode/.bashrc && \
18-
echo 'fi' >> /home/vscode/.bashrc && \
19-
echo >> /home/vscode/.bashrc && \
20-
echo '. <(poetry completions)' >> /home/vscode/.bashrc
7+
FROM mcr.microsoft.com/vscode/devcontainers/base:debian
8+
9+
ENV PYTHONDONTWRITEBYTECODE=True \
10+
PYTHONUNBUFFERED=True \
11+
UV_LINK_MODE=copy
12+
13+
COPY --from=uv --chown=vscode: /uv /uvx /bin/
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
echo "Running post-create-command.sh"
22

33
pre-commit install
4-
poetry install --all-extras
4+
uv sync --all-extras

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
66
"build": {
77
// Path is relative to the devcontainer.json file.
8-
// We prebuild the image to get poetry into the image
8+
// We prebuild the image to get uv into the image
99
// This saves the user a bit of time, when re-opening containers
1010
"dockerfile": "Dockerfile"
1111
},

.github/ISSUE_TEMPLATE/question.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ uname -a
3131
echo "------"
3232
docker info
3333
echo "------"
34-
poetry run python --version
34+
uv run python --version
3535
echo "------"
36-
poetry show --tree
36+
uv tree
3737
```
3838

3939
```bash

.github/PULL_REQUEST_TEMPLATE/new_container.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ It helps reduce unnecessary work for you and the maintainers!
2929
- Your module has a `README.rst` and hooks in the `.. auto-class` and `.. title` of your container
3030
- Implement the new feature (typically in `__init__.py`) and corresponding tests.
3131
- [ ] Your module is added in `pyproject.toml`
32-
- it is declared under `tool.poetry.packages` - see other community modules
33-
- it is declared under `tool.poetry.extras` with the same name as your module name,
32+
- it is declared under `tool.hatch.build.targets.wheel` - see other community modules
33+
- it is declared under `project.optional-dependencies` with the same name as your module name,
3434
we still prefer adding _NO EXTRA DEPENDENCIES_, meaning `mymodule = []` is the preferred addition
3535
(see the notes at the bottom)
3636
- [ ] Your branch is up-to-date (or your branch will be rebased with `git rebase`)

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ inputs:
1010
runs:
1111
using: composite
1212
steps:
13-
- name: Setup Poetry
14-
run: pipx install poetry
15-
shell: bash
16-
- name: Setup python ${{ inputs.python-version }}
17-
uses: actions/setup-python@v5
13+
- name: Install uv
14+
uses: astral-sh/setup-uv@v7
1815
with:
1916
python-version: ${{ inputs.python-version }}
20-
cache: poetry

.github/workflows/ci-community.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
name: modules
44

5+
env:
6+
UV_FROZEN: "1" # use lock file as is
7+
UV_NO_EDITABLE: "1" # test the build package, not the dev installation
8+
59
on:
610
push:
711
branches: [ main ]
@@ -54,7 +58,7 @@ jobs:
5458
with:
5559
python-version: ${{ matrix.python-version }}
5660
- name: Install Python dependencies
57-
run: poetry install -E ${{ matrix.module }}
61+
run: uv sync --extra ${{ matrix.module }}
5862
- name: Run tests
5963
run: make modules/${{ matrix.module }}/tests
6064
- name: Run doctests

.github/workflows/ci-core.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
name: core
44

5+
env:
6+
UV_FROZEN: "1" # use lock file as is
7+
UV_NO_EDITABLE: "1" # test the build package, not the dev installation
8+
59
on:
610
push:
711
branches: [main]
@@ -22,9 +26,9 @@ jobs:
2226
with:
2327
python-version: ${{ matrix.python-version }}
2428
- name: Install Python dependencies
25-
run: poetry install --all-extras
29+
run: uv sync --all-extras
2630
- name: Run twine check
27-
run: rm -f LICENSE.txt && poetry build && poetry run twine check dist/*.tar.gz
31+
run: uv build && uv run twine check dist/*
2832
- name: Run tests
2933
run: make core/tests
3034
- name: Rename coverage file
@@ -47,7 +51,7 @@ jobs:
4751
- name: Set up Python
4852
uses: ./.github/actions/setup-env
4953
- name: Install Python dependencies
50-
run: poetry install --all-extras
54+
run: uv sync --all-extras
5155
- name: "Download coverage artifacts"
5256
uses: actions/download-artifact@v4
5357
with:

.github/workflows/ci-lint.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
name: lint
44

5+
env:
6+
UV_FROZEN: "1" # use lock file as is
7+
UV_NO_EDITABLE: "1" # test the build package, not the dev installation
8+
59
on:
610
push:
711
branches: [main]
@@ -15,18 +19,14 @@ jobs:
1519
- uses: actions/checkout@v4
1620
- name: Setup Env
1721
uses: ./.github/actions/setup-env
18-
with:
19-
python-version: "3.13"
20-
- name: Install Python dependencies
21-
run: poetry install --with dev --no-interaction
2222
- name: Execute pre-commit handler
2323
continue-on-error: true
2424
run: |
25-
poetry run pre-commit run check-toml
26-
poetry run pre-commit run trailing-whitespace
27-
poetry run pre-commit run end-of-file-fixer
28-
poetry run pre-commit run ruff
29-
poetry run pre-commit run ruff-format
25+
uv run pre-commit run check-toml
26+
uv run pre-commit run trailing-whitespace
27+
uv run pre-commit run end-of-file-fixer
28+
uv run pre-commit run ruff
29+
uv run pre-commit run ruff-format
3030
- name: Execute mypy
3131
run: |
3232
make mypy-core-report

.github/workflows/release-please.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Release Please
22

3+
env:
4+
UV_FROZEN: "1" # use lock file as is
5+
UV_NO_EDITABLE: "1" # test the build package, not the dev installation
6+
37
on:
48
push:
59
branches: [ main ]
@@ -28,8 +32,8 @@ jobs:
2832
- name: Set up Python
2933
uses: ./.github/actions/setup-env
3034
- name: build package
31-
run: poetry build
32-
# this action uploads packages from the `dist/` directory, which poetry has built in the previous step
35+
run: uv build
36+
# this action uploads packages from the `dist/` directory, which uv has built in the previous step
3337
# usable once we set up trusted publishing, see https://docs.pypi.org/trusted-publishers/using-a-publisher/
3438
- name: push package
3539
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)