Skip to content

Commit

Permalink
Migrate to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
adferrand committed Dec 6, 2024
1 parent 2a5593c commit 6af4757
Show file tree
Hide file tree
Showing 13 changed files with 2,088 additions and 2,671 deletions.
30 changes: 0 additions & 30 deletions .github/actions/setup-python-dev/action.yml

This file was deleted.

28 changes: 15 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.8", "3.12"]
python: ["3.9", "3.13"]
toxenv: [py3]
exclude:
- os: ubuntu-latest
python: "3.12"
python: "3.13"
toxenv: py3
include:
- os: ubuntu-latest
python: "3.12"
python: "3.13"
toxenv: cover
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup dev environment
uses: ./.github/actions/setup-python-dev
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Configure Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Run tox
run: tox
env:
TOXENV: ${{ matrix.toxenv }}
run: uvx --with tox-uv tox -e ${{ matrix.toxenv }}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -70,12 +70,14 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup dev environment
uses: ./.github/actions/setup-python-dev
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Configure Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Run tox
run: tox
env:
TOXENV: ${{ matrix.toxenv }}
run: uvx --with tox-uv tox -e ${{ matrix.toxenv }}
event-file:
runs-on: ubuntu-latest
steps:
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ jobs:
needs: [main]
steps:
- uses: actions/checkout@v4
- name: Setup dev environment
uses: ./.github/actions/setup-python-dev
- run: poetry publish --build --username "${PYPI_USERNAME}" --password "${PYPI_PASSWORD}"
- name: Install uv
uses: astral-sh/setup-uv@v4
- run: |
uv build
uv publish --username "${PYPI_USERNAME}" --password "${PYPI_PASSWORD}"
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
Expand All @@ -23,9 +25,9 @@ jobs:
needs: [main]
steps:
- uses: actions/checkout@v4
- id: setup-dev
name: Setup dev environment
uses: ./.github/actions/setup-python-dev
- name: Get project version
run: |
echo "VERSION=$(cat pyproject.toml | grep '^version = .*' | sed -E 's/version = "(.*)"/\1/g')" >> $GITHUB_ENV
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
Expand All @@ -42,9 +44,11 @@ jobs:
needs: [pypi, docker]
steps:
- uses: actions/checkout@v4
- id: setup-dev
name: Setup dev environment
uses: ./.github/actions/setup-python-dev
- name: Get project version
run: |
echo "VERSION=$(cat pyproject.toml | grep '^version = .*' | sed -E 's/version = "(.*)"/\1/g')" >> $GITHUB_ENV
- name: Configure Python
uses: actions/setup-python@v5
- run: |
python utils/extract_changelog.py ${VERSION} > release_${VERSION}.md
env:
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
9 changes: 4 additions & 5 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
version: 2
build:
os: ubuntu-22.04
os: ubuntu-24.04
tools:
python: "3.12"
python: "3.13"
jobs:
post_create_environment:
- pip install poetry
- poetry config virtualenvs.create false
- curl -LsSf https://astral.sh/uv/install.sh | sh
post_install:
- poetry install --no-root --only docs
- uv sync --only-group doc
sphinx:
configuration: docs/conf.py
18 changes: 6 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
ARG BUILDER_ARCH=amd64
FROM docker.io/${BUILDER_ARCH}/python:3-slim AS constraints
FROM docker.io/ubuntu:24.04 AS constraints

COPY src poetry.lock poetry.toml pyproject.toml README.rst /tmp/dnsrobocert/

RUN apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*

RUN pip install --break-system-packages "poetry==1.7.1"
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
COPY src uv.lock pyproject.toml README.rst /tmp/dnsrobocert/

RUN cd /tmp/dnsrobocert \
&& poetry export --format constraints.txt --without-hashes > /tmp/dnsrobocert/constraints.txt \
&& poetry build -f wheel
&& uv python install \
&& uv export --no-emit-project --no-hashes > /tmp/dnsrobocert/constraints.txt \
&& uv build

FROM docker.io/python:3.11.4-slim

Expand Down
Loading

0 comments on commit 6af4757

Please sign in to comment.