From eb3d93496079265054724ec89e1bbce0695fd13a Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sun, 5 Jan 2025 11:18:04 +0100 Subject: [PATCH] migrate to uv --- .devcontainer/Dockerfile | 8 +- .dockerignore | 2 + .github/workflows/test.yaml | 15 +- .github/workflows/update-dependencies.yaml | 8 +- .idea/watcherTasks.xml | 2 +- .mise.toml | 3 - .pre-commit-config.yaml | 19 +- Dockerfile | 26 +- README.md | 3 +- constraints.txt | 96 -- docker-compose-build.yaml | 2 - docker-compose.yaml | 2 - pyproject.toml | 47 +- requirements-dev.in | 14 - requirements-dev.txt | 219 ---- requirements.in | 15 - requirements.txt | 96 -- tasks.py | 30 +- uv.lock | 1092 ++++++++++++++++++++ 19 files changed, 1180 insertions(+), 519 deletions(-) create mode 100644 .dockerignore delete mode 100644 constraints.txt delete mode 100644 requirements-dev.in delete mode 100644 requirements-dev.txt delete mode 100644 requirements.in delete mode 100644 requirements.txt create mode 100644 uv.lock diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 571db15..e896173 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ -FROM mcr.microsoft.com/devcontainers/python:3.13-bullseye +FROM mcr.microsoft.com/devcontainers/python:3.13-bookworm RUN apt-get update && apt-get upgrade -y -RUN pip install pip-tools invoke -COPY requirements.in requirements.txt requirements-dev.in requirements-dev.txt constraints.txt tasks.py ./ -RUN invoke sync-dependencies +COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ +COPY pyproject.toml uv.lock tasks.py ./ +RUN uv sync --frozen diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c6e02fb --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.venv +node_modules diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 29c3727..165e1f2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,22 +14,21 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v5 - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.13' - cache: pip - - name: Install dependencies - run: | - pip install pip-tools - pip-sync requirements.txt requirements-dev.txt + python-version-file: "pyproject.toml" + - name: Install the project + run: uv sync --all-extras --dev --frozen --no-install-project - name: Setup pre-commit cache uses: actions/cache@v4 with: path: ~/.cache/pre-commit key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} - name: Check pre-commit - run: pre-commit run --show-diff-on-failure --color=always --all-files + run: uv run pre-commit run --show-diff-on-failure --color=always --all-files - name: Test - run: pytest --cov=. --cov-branch --cov-report term-missing:skip-covered + run: uv run pytest --cov=. --cov-branch --cov-report term-missing:skip-covered working-directory: ./src/ diff --git a/.github/workflows/update-dependencies.yaml b/.github/workflows/update-dependencies.yaml index 91b944f..1697e71 100644 --- a/.github/workflows/update-dependencies.yaml +++ b/.github/workflows/update-dependencies.yaml @@ -17,15 +17,15 @@ jobs: uses: actions/checkout@v4 with: ref: master + - name: Install uv + uses: astral-sh/setup-uv@v5 - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.13' - cache: pip + python-version-file: "pyproject.toml" - name: Update dependencies run: | - pip install pip-tools invoke - invoke update-dependencies --no-sync + uv lock --upgrade - name: Generate token uses: tibdex/github-app-token@v2 id: generate-token diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml index e78ac61..939da94 100644 --- a/.idea/watcherTasks.xml +++ b/.idea/watcherTasks.xml @@ -14,7 +14,7 @@