From 7030fe6e1191a099a6c144d14f022043fb40a0fb Mon Sep 17 00:00:00 2001 From: "Adam J. Jackson" Date: Fri, 13 Dec 2024 10:10:32 +0000 Subject: [PATCH] Try replacing pip with uv pip in main tox test suite --- .github/workflows/run_tests.yml | 38 +++++++++++++++++++---------- tox.ini | 42 ++++++++++++++++----------------- 2 files changed, 46 insertions(+), 34 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index d668cbd1d..d14384f50 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -27,12 +27,25 @@ jobs: with: fetch-depth: 0 # Ensure tags are fetched for versioning fetch-tags: true - - uses: actions/setup-python@v5 - with: - python-version: | - 3.10 - 3.11 - 3.12 + # - uses: actions/setup-python@v5 + # with: + # python-version: | + # 3.10 + # 3.11 + # 3.12 + - uses: astral-sh/setup-uv@v4 + + - name: Install uv python 3.10, 3.12 + shell: bash -l {0} + run: | + uv python install 3.10 3.11 3.12 + + - name: Install uv python 3.11 (workflow dispatch) + if: github.event_name == 'workflow_dispatch' + shell: bash -l {0} + run: | + uv python install 3.11 + - name: Install llvm on MacOS if: startsWith(matrix.os, 'macos') shell: bash -l {0} @@ -63,11 +76,10 @@ jobs: echo "CC_LD: $CC_LD" echo "CC_LD=$CC_LD" >> $GITHUB_ENV - - name: Update pip and install dependencies - shell: bash -l {0} - run: | - python -m pip install --upgrade pip - python -m pip install -r tests_and_analysis/ci_requirements.txt + # - name: Update pip and install dependencies + # shell: bash -l {0} + # run: | + # uv pip install -r tests_and_analysis/ci_requirements.txt - name: Run tests, skip Python 3.11 unless workflow dispatch if: github.event_name != 'workflow_dispatch' @@ -75,14 +87,14 @@ jobs: TOX_SKIP_ENV: '.*?(py311).*?' TOX_PARALLEL_NO_SPINNER: 1 shell: bash -l {0} - run: python -m tox --parallel + run: uvx tox==3.28.0 --parallel - name: Run tests, workflow dispatch so test all Python versions if: github.event_name == 'workflow_dispatch' env: TOX_PARALLEL_NO_SPINNER: 1 shell: bash -l {0} - run: python -m tox --parallel + run: uvx tox==3.28.0 --parallel - name: Upload test results if: always() diff --git a/tox.ini b/tox.ini index 1892f9cf5..855c4ded4 100644 --- a/tox.ini +++ b/tox.ini @@ -12,17 +12,17 @@ passenv = CC CC_LD LDFLAGS CPPFLAGS [testenv:{py310,py311,py312}] install_command = - python -m pip install \ + uv pip install \ --force-reinstall \ --upgrade \ - --upgrade-strategy eager \ + # --upgrade-strategy eager \ {opts} \ {packages} deps = numpy -r{toxinidir}/tests_and_analysis/tox_requirements.txt commands_pre = - python -m pip install \ + uv pip install \ --upgrade \ --upgrade-strategy eager \ '{toxinidir}[matplotlib,phonopy_reader,brille]' @@ -34,9 +34,9 @@ commands = install_command = {[testenv:py310]install_command} deps = {[testenv:py310]deps} commands_pre = - python -m pip install \ + uv pip install \ --upgrade \ - --upgrade-strategy eager \ + # --upgrade-strategy eager \ '{toxinidir}' commands = {[testenv]test_command} --cov -m "not (phonopy_reader or matplotlib or brille)" @@ -45,9 +45,9 @@ commands = {[testenv]test_command} --cov -m "not (phonopy_reader or matplotlib o install_command = {[testenv:py310]install_command} deps = {[testenv:py310]deps} commands_pre = - python -m pip install \ + uv pip install \ --upgrade \ - --upgrade-strategy eager \ + #--upgrade-strategy eager \ '{toxinidir}[matplotlib]' commands = {[testenv]test_command} --cov -m "matplotlib and not multiple_extras" @@ -56,9 +56,9 @@ commands = {[testenv]test_command} --cov -m "matplotlib and not multiple_extras" install_command = {[testenv:py310]install_command} deps = {[testenv:py310]deps} commands_pre = - python -m pip install \ + uv pip install \ --upgrade \ - --upgrade-strategy eager \ + #--upgrade-strategy eager \ '{toxinidir}[phonopy_reader]' commands = {[testenv]test_command} --cov -m "phonopy_reader and not multiple_extras" @@ -67,9 +67,9 @@ commands = {[testenv]test_command} --cov -m "phonopy_reader and not multiple_ext install_command = {[testenv:py310]install_command} deps = {[testenv:py310]deps} commands_pre = - python -m pip install \ + uv pip install \ --upgrade \ - --upgrade-strategy eager \ + #--upgrade-strategy eager \ '{toxinidir}[brille]' commands = {[testenv]test_command} --cov -m "brille and not multiple_extras" @@ -78,9 +78,9 @@ commands = {[testenv]test_command} --cov -m "brille and not multiple_extras" install_command = {[testenv:py310]install_command} deps = {[testenv:py310]deps} commands_pre = - python -m pip install \ + uv pip install \ --upgrade \ - --upgrade-strategy eager \ + #--upgrade-strategy eager \ '{toxinidir}[phonopy_reader,matplotlib,brille]' commands = {[testenv]test_command} --cov -m multiple_extras @@ -88,37 +88,37 @@ commands = [testenv:py310-minrequirements-linux] whitelist_externals = rm install_command = - python -m pip install --force-reinstall {opts} {packages} + uv pip install --force-reinstall {opts} {packages} platform = linux: linux deps = numpy==1.24.0 {[testenv:py310]deps} commands_pre = - python -m pip install --force-reinstall \ + uv pip install --force-reinstall \ -r{toxinidir}/tests_and_analysis/minimum_euphonic_requirements.txt - python -m pip install --force-reinstall \ + uv pip install --force-reinstall \ -r{toxinidir}/tests_and_analysis/tox_requirements.txt # Force rebuild of euphonic extension to avoid Numpy clash rm -rf {toxinidir}/build - python -m pip install '{toxinidir}[matplotlib,phonopy_reader,brille]' + uv pip install '{toxinidir}[matplotlib,phonopy_reader,brille]' commands = {[testenv]test_command} [testenv:py310-minrequirements-mac] whitelist_externals = rm install_command = - python -m pip install --force-reinstall {opts} {packages} + uv pip install --force-reinstall {opts} {packages} platform = macos: darwin deps = numpy==1.24.0 {[testenv:py310]deps} commands_pre = - python -m pip install --force-reinstall \ + uv pip install --force-reinstall \ -r{toxinidir}/tests_and_analysis/minimum_euphonic_requirements_mac.txt - python -m pip install --force-reinstall \ + uv pip install --force-reinstall \ -r{toxinidir}/tests_and_analysis/tox_requirements.txt # Force rebuild of euphonic extension to avoid Numpy clash rm -rf {toxinidir}/build - python -m pip install '{toxinidir}[matplotlib,phonopy_reader,brille]' + uv pip install '{toxinidir}[matplotlib,phonopy_reader,brille]' commands = {[testenv]test_command}