Skip to content

Commit

Permalink
set python version in nox sessions when syncing uv (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuadavidthomas authored Oct 10, 2024
1 parent 0ae72c8 commit 956bb71
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
19 changes: 3 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ concurrency:
env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
PY_MAX_VERSION: "3.13"
PY_MIN_VERSION: "3.9"
UV_VERSION: "0.4.x"

jobs:
Expand All @@ -31,9 +29,6 @@ jobs:
enable-cache: true
version: ${{ env.UV_VERSION }}

- name: Install Python
run: uv python install ${{ env.PY_MIN_VERSION }}

- id: set-matrix
run: |
uv run nox --session "gha_matrix"
Expand All @@ -54,9 +49,6 @@ jobs:
enable-cache: true
version: ${{ env.UV_VERSION }}

- name: Install Python
run: uv python install ${{ matrix.python-version }}

- name: Run tests
run: |
uv run nox --session "tests(python='${{ matrix.python-version }}', django='${{ matrix.django-version }}')"
Expand All @@ -77,16 +69,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
version: ${{ env.UV_VERSION }}

- name: Install Python
run: uv python install ${{ env.PY_MAX_VERSION }}

- name: Run mypy
- name: Run type checks
run: |
uv run nox --session "types"
Expand All @@ -101,9 +91,6 @@ jobs:
enable-cache: true
version: ${{ env.UV_VERSION }}

- name: Install Python
run: uv python install ${{ env.PY_MIN_VERSION }}

- name: Run mypy
- name: Generate code coverage
run: |
uv run nox --session "coverage"
16 changes: 12 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@ def tests(session, django):
session.run_install(
"uv",
"sync",
"--frozen",
"--extra",
"tests",
"--frozen",
"--inexact",
"--no-install-package",
"django",
"--python",
session.python,
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
)

Expand All @@ -98,9 +100,11 @@ def coverage(session):
session.run_install(
"uv",
"sync",
"--frozen",
"--extra",
"tests",
"--frozen",
"--python",
PY_LATEST,
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
)

Expand Down Expand Up @@ -129,9 +133,11 @@ def types(session):
session.run_install(
"uv",
"sync",
"--frozen",
"--extra",
"types",
"--frozen",
"--python",
PY_LATEST,
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
)
command = ["python", "-m", "mypy", "."]
Expand All @@ -145,9 +151,11 @@ def demo(session):
session.run_install(
"uv",
"sync",
"--frozen",
"--extra",
"types",
"--frozen",
"--python",
PY_DEFAULT,
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
)

Expand Down

0 comments on commit 956bb71

Please sign in to comment.