Skip to content

Commit

Permalink
Try replacing pip with uv pip in main tox test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
ajjackson committed Dec 13, 2024
1 parent fb4549d commit 7030fe6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 34 deletions.
38 changes: 25 additions & 13 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -63,26 +76,25 @@ 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'
env:
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()
Expand Down
42 changes: 21 additions & 21 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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]'
Expand All @@ -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)"

Expand All @@ -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"

Expand All @@ -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"

Expand All @@ -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"

Expand All @@ -78,47 +78,47 @@ 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

[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}

0 comments on commit 7030fe6

Please sign in to comment.