From 5e828628a2495b868a8bebbe357f2e257f57acbd Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 21 Oct 2024 17:49:13 -0400 Subject: [PATCH] Install uv in CI when available (#11805) --- .github/workflows/ci.yml | 8 ++++---- ci-constraints-requirements.txt | 2 ++ noxfile.py | 2 +- pyproject.toml | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc82a7f23d2a..a6cbde6b3802 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -131,7 +131,7 @@ jobs: # pypy3-3.8 and pypy3-3.9 -- both of them show up as 7.3.11. key: ${{ matrix.PYTHON.VERSION }}-${{ steps.setup-python.outputs.python-version }}-${{ matrix.PYTHON.NOXSESSION }}-${{ env.OPENSSL_HASH }} - - run: python -m pip install -c ci-constraints-requirements.txt 'nox' 'tomli; python_version < "3.11"' + - run: python -m pip install -c ci-constraints-requirements.txt 'nox' 'nox[uv]; python_version >= "3.8"' 'tomli; python_version < "3.11"' - name: Create nox environment run: | nox -v --install-only @@ -205,7 +205,7 @@ jobs: - run: | echo "OPENSSL_FORCE_FIPS_MODE=1" >> $GITHUB_ENV if: matrix.IMAGE.FIPS - - run: /venv/bin/python -m pip install -c ci-constraints-requirements.txt 'nox' 'tomli; python_version < "3.11"' + - run: /venv/bin/python -m pip install -c ci-constraints-requirements.txt 'nox' 'nox[uv]; python_version >= "3.8"' 'tomli; python_version < "3.11"' - run: '/venv/bin/nox -v --install-only' env: CARGO_TARGET_DIR: ${{ format('{0}/src/rust/target/', github.workspace) }} @@ -256,7 +256,7 @@ jobs: timeout-minutes: 3 - run: rustup component add llvm-tools-preview - - run: python -m pip install -c ci-constraints-requirements.txt 'nox' 'tomli; python_version < "3.11"' + - run: python -m pip install -c ci-constraints-requirements.txt 'nox' 'nox[uv]; python_version >= "3.8"' 'tomli; python_version < "3.11"' - name: Clone test vectors timeout-minutes: 2 @@ -321,7 +321,7 @@ jobs: timeout-minutes: 2 with: key: ${{ matrix.PYTHON.NOXSESSION }}-${{ matrix.WINDOWS.ARCH }}-${{ steps.setup-python.outputs.python-version }} - - run: python -m pip install -c ci-constraints-requirements.txt "nox" "tomli; python_version < '3.11'" + - run: python -m pip install -c ci-constraints-requirements.txt "nox" "nox[uv]; python_version >= '3.8'" "tomli; python_version < '3.11'" - uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6 with: diff --git a/ci-constraints-requirements.txt b/ci-constraints-requirements.txt index 76ac497bd09f..b328283889f3 100644 --- a/ci-constraints-requirements.txt +++ b/ci-constraints-requirements.txt @@ -286,6 +286,8 @@ urllib3==2.0.7 ; python_full_version < '3.8' # via requests urllib3==2.2.3 ; python_full_version >= '3.8' # via requests +uv==0.4.24 ; python_full_version >= '3.8' + # via nox virtualenv==20.26.6 ; python_full_version < '3.8' # via nox virtualenv==20.27.0 ; python_full_version >= '3.8' diff --git a/noxfile.py b/noxfile.py index 127ca18071ce..912e79b6b6bb 100644 --- a/noxfile.py +++ b/noxfile.py @@ -107,7 +107,7 @@ def tests(session: nox.Session) -> None: if session.name != "tests-nocoverage": [rust_so] = glob.glob( - f"{session.virtualenv.location}/**/cryptography/hazmat/bindings/_rust.*", + f"{session.virtualenv.location}/lib/**/cryptography/hazmat/bindings/_rust.*", recursive=True, ) process_rust_coverage(session, [rust_so], prof_location) diff --git a/pyproject.toml b/pyproject.toml index e58219cc9f79..28eb931e507f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,7 +63,7 @@ changelog = "https://cryptography.io/en/latest/changelog/" ssh = ["bcrypt >=3.1.5"] # All the following are used for our own testing. -nox = ["nox"] +nox = ["nox", "nox[uv] >=2024.03.02; python_version >= '3.8'"] test = [ "cryptography_vectors", "pytest >=6.2.0",