Skip to content

Commit

Permalink
chore: Require uv be used with Nox (#2866)
Browse files Browse the repository at this point in the history
* chore: Require uv be used with Nox

* Use uv more broadly

* Move `UV_CONSTRAINT` to the top

* Remove redundant installation of griffe
  • Loading branch information
edgarrmondragon authored Jan 31, 2025
1 parent df11728 commit 1d00bfc
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 44 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/api-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
FORCE_COLOR: 1
UV_CONSTRAINT: ${{ github.workspace }}/.github/workflows/resources/requirements.txt
UV_VERSION: 0.5.26

permissions: # added using https://github.com/step-security/secure-repo
contents: read

Expand All @@ -32,13 +37,14 @@ jobs:
with:
python-version: 3.x

- uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}

- name: Install tools
env:
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/resources/requirements.txt
run: |
python -Im pip install -U pip
pipx install griffe nox
pipx list
uv tool install nox
uv tool list
- name: Set REF
id: set-ref
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/cookiecutter-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ concurrency:

env:
FORCE_COLOR: "1"
UV_CONSTRAINT: ${{ github.workspace }}/.github/workflows/resources/requirements.txt

jobs:
lint:
Expand All @@ -44,15 +45,11 @@ jobs:
python-version: 3.x

- name: Install Nox
env:
UV_CONSTRAINT: ${{ github.workspace }}/.github/workflows/resources/requirements.txt
run: |
uv tool install nox
nox --version
- name: Run Nox
env:
UV_CONSTRAINT: ${{ github.workspace }}/.github/workflows/resources/requirements.txt
run: |
nox --session=test_cookiecutter
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/resources/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
griffe~=1.5
nox==2024.10.9
pip==25.0
pre-commit==4.1.0
twine==6.1.0
49 changes: 17 additions & 32 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ concurrency:

env:
FORCE_COLOR: "1"
UV_CONSTRAINT: ${{ github.workspace }}/.github/workflows/resources/requirements.txt
UV_VERSION: 0.5.26

jobs:
tests:
Expand Down Expand Up @@ -69,29 +71,23 @@ jobs:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Upgrade pip
env:
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/resources/requirements.txt
run: |
pip install pip
pip --version
- uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}

- name: Install Nox
env:
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/resources/requirements.txt
run: |
pipx install 'nox[uv]'
uv tool install 'nox[uv]'
nox --version
- uses: actions/cache@v4
if: matrix.session == 'tests'
with:
path: http_cache.sqlite
key: http_cache-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.sqlalchemy }}
key: http_cache-${{ runner.os }}-${{ matrix.python-version }}

- name: Run Nox
env:
PIP_PRE: "1"
UV_PRERELEASE: allow
run: |
nox --verbose
Expand All @@ -100,7 +96,7 @@ jobs:
if: always() && (matrix.session == 'tests')
with:
include-hidden-files: true
name: coverage-data-nox_-${{ matrix.os }}-py${{ matrix.python-version }}_sqlalchemy_${{ matrix.sqlalchemy }}
name: coverage-data-nox_-${{ matrix.os }}-py${{ matrix.python-version }}
path: ".coverage.*"

tests-external:
Expand All @@ -124,23 +120,17 @@ jobs:
with:
python-version: ${{ env.NOXPYTHON }}

- name: Upgrade pip
env:
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/resources/requirements.txt
run: |
pip install pip
pip --version
- uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}

- name: Install Nox
env:
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/resources/requirements.txt
run: |
pipx install 'nox[uv]'
uv tool install 'nox[uv]'
nox --version
- name: Run Nox
env:
PIP_PRE: "1"
UV_PRERELEASE: allow
run: |
nox -- -m "external"
Expand All @@ -157,23 +147,18 @@ jobs:
with:
python-version: '3.x'

- name: Upgrade pip
env:
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/resources/requirements.txt
run: |
pip install pip
pip --version
- uses: actions/download-artifact@v4
with:
pattern: coverage-data-*
merge-multiple: true

- uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}

- name: Install Nox
env:
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/resources/requirements.txt
run: |
pipx install 'nox[uv]'
uv tool install 'nox[uv]'
nox --version
- run: nox --install-only
Expand Down
4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import nox

nox.needs_version = ">=2024.4.15"
nox.options.default_venv_backend = "uv|virtualenv"
nox.options.default_venv_backend = "uv"

RUFF_OVERRIDES = """\
extend = "./pyproject.toml"
Expand Down Expand Up @@ -287,4 +287,4 @@ def api_changes(session: nox.Session) -> None:
if "GITHUB_ACTIONS" in os.environ:
args.append("-f=github")

session.run(*args, external=True)
session.run("uv", "tool", "run", *args, external=True)

0 comments on commit 1d00bfc

Please sign in to comment.