diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index a58d761..ec88441 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:bookworm-slim as builder +FROM debian:bookworm-slim AS builder WORKDIR /opt @@ -26,7 +26,7 @@ COPY --from=builder /opt/rye /opt/rye ENV RYE_HOME="/opt/rye" ENV PATH="$RYE_HOME/shims:$PATH" -ENV PYTHONUNBUFFERED True +ENV PYTHONUNBUFFERED=True RUN rye config --set-bool behavior.global-python=true && \ rye config --set-bool behavior.use-uv=true diff --git a/.github/actions/setup-python-with-rye/action.yml b/.github/actions/setup-python-with-rye/action.yml new file mode 100644 index 0000000..840d338 --- /dev/null +++ b/.github/actions/setup-python-with-rye/action.yml @@ -0,0 +1,35 @@ +name: Install Python with Rye + +inputs: + python-version: + description: Python version + required: true + rye-version: + description: Rye version + required: false + default: "latest" + +runs: + using: composite + steps: + - name: Install Rye + uses: eifinger/setup-rye@v3 + with: + enable-cache: true + version: ${{ inputs.rye-version }} + + - name: Set Rye Config + run: | + rye config --set-bool behavior.global-python=true + rye config --set-bool behavior.use-uv=true + shell: bash + + - name: Set up Python ${{ inputs.python-version }} + run: | + export PYTHONUNBUFFERED=True + rye pin ${{ inputs.python-version }} + shell: bash + + - name: Install Dependencies + run: rye sync + shell: bash diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index b37463c..316e66e 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -18,21 +18,10 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Install Rye - uses: eifinger/setup-rye@v3 + - name: Setup Python ${{ matrix.python-version }} with Rye + uses: ./.github/actions/setup-python-with-rye with: - enable-cache: true - - - name: Set Rye Config - run: | - rye config --set-bool behavior.global-python=true - rye config --set-bool behavior.use-uv=true - - - name: Set up Python ${{ matrix.python-version }} - run: | - export PYTHONUNBUFFERED=1 - rye pin ${{ matrix.python-version }} - rye sync + python-version: ${{ matrix.python-version }} - name: Lint run: rye run ruff check --output-format=github . @@ -48,21 +37,10 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Install Rye - uses: eifinger/setup-rye@v3 + - name: Setup Python ${{ matrix.python-version }} with Rye + uses: ./.github/actions/setup-python-with-rye with: - enable-cache: true - - - name: Set Rye Config - run: | - rye config --set-bool behavior.global-python=true - rye config --set-bool behavior.use-uv=true - - - name: Set up Python ${{ matrix.python-version }} - run: | - export PYTHONUNBUFFERED=1 - rye pin ${{ matrix.python-version }} - rye sync + python-version: ${{ matrix.python-version }} - name: Format run: rye run ruff format . --check --diff diff --git a/Dockerfile b/Dockerfile index 47c4c75..a548c22 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ARG VARIANT=3.12 -FROM python:${VARIANT} as builder +FROM python:${VARIANT} AS builder -ENV PYTHONDONTWRITEBYTECODE True +ENV PYTHONDONTWRITEBYTECODE=True WORKDIR /opt COPY pyproject.toml requirements.lock ./ @@ -14,6 +14,6 @@ RUN pip install --upgrade pip && \ FROM python:${VARIANT}-slim COPY --from=builder /usr/local/lib/python*/site-packages /usr/local/lib/python*/site-packages -ENV PYTHONUNBUFFERED True +ENV PYTHONUNBUFFERED=True WORKDIR /