Skip to content

Commit a4871cc

Browse files
ci: switch to using uv for python package management. Runs from 6 min down to 1.5 min
1 parent c47186b commit a4871cc

File tree

2 files changed

+28
-25
lines changed

2 files changed

+28
-25
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ jobs:
2121
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
2222
steps:
2323
- uses: actions/checkout@v4
24-
- uses: actions/setup-python@v5
24+
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v4
2527
with:
2628
python-version: ${{ matrix.python }}
27-
cache: 'pip'
28-
cache-dependency-path: |
29-
'../**/requirements*.txt'
30-
'../**/setup.py'
31-
- run: python -m pip install --upgrade setuptools pip tox virtualenv
29+
enable-cache: true
30+
cache-dependency-glob: |
31+
**/setup.py
32+
**/requirements*.txt
33+
- run: uv tool install tox --with tox-uv
3234
# Run tox only for the installed py version on the runner as outlined in the python matrix
3335
# Ensures the correct py version is installed and tested as opposed to 'tox' which attempts to run for all py versions in tox.ini
34-
- run: tox -e py
35-
- run: tox -e mypy
36+
- run: uv run tox -e py
37+
- run: uv run tox -e mypy

.github/workflows/pypi.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,38 @@ jobs:
1717
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
1818
steps:
1919
- uses: actions/checkout@v4
20-
- uses: actions/setup-python@v5
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v4
2122
with:
2223
python-version: ${{ matrix.python }}
23-
cache: 'pip'
24-
cache-dependency-path: |
25-
'../**/requirements*.txt'
26-
'../**/setup.py'
27-
- run: python -m pip install --upgrade setuptools pip tox virtualenv
24+
enable-cache: true
25+
cache-dependency-glob: |
26+
**/setup.py
27+
**/requirements*.txt
28+
- run: uv tool install tox --with tox-uv
2829
# Run tox only for the installed py version on the runner as outlined in the python matrix
2930
# Ensures the correct py version is installed and tested as opposed to 'tox' which attempts to run for all py versions in tox.ini
30-
- run: tox -e py
31-
- run: tox -e mypy
31+
- run: uv run tox -e py
32+
- run: uv run tox -e mypy
3233

3334
deploy:
3435
# Run tests beforing deploying to pypi
3536
needs: tox
3637
runs-on: ubuntu-latest
3738
steps:
3839
- uses: actions/checkout@v4
39-
- name: Set up Python
40-
uses: actions/setup-python@v5
40+
- name: Install uv
41+
uses: astral-sh/setup-uv@v4
4142
with:
42-
python-version: 3.13
43-
cache: 'pip'
44-
cache-dependency-path: |
45-
'../**/requirements*.txt'
46-
'../**/setup.py'
43+
python-version: '3.13'
44+
enable-cache: true
45+
cache-dependency-glob: |
46+
**/setup.py
47+
**/requirements*.txt
4748
- name: Install dependencies
48-
run: pip install wheel
49+
run: uv pip --system --upgrade install wheel
4950
- name: Build package
50-
run: python setup.py sdist bdist_wheel
51+
run: uv run python setup.py sdist bdist_wheel
5152
- name: Publish package
5253
uses: pypa/gh-action-pypi-publish@release/v1
5354
with:

0 commit comments

Comments
 (0)