Skip to content

Commit

Permalink
ci: switch to using uv for python package management. Runs from 6 min…
Browse files Browse the repository at this point in the history
… down to 1.5 min
  • Loading branch information
clintonsteiner committed Jan 18, 2025
1 parent c47186b commit a4871cc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ jobs:
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: |
'../**/requirements*.txt'
'../**/setup.py'
- run: python -m pip install --upgrade setuptools pip tox virtualenv
enable-cache: true
cache-dependency-glob: |
**/setup.py
**/requirements*.txt
- run: uv tool install tox --with tox-uv
# Run tox only for the installed py version on the runner as outlined in the python matrix
# Ensures the correct py version is installed and tested as opposed to 'tox' which attempts to run for all py versions in tox.ini
- run: tox -e py
- run: tox -e mypy
- run: uv run tox -e py
- run: uv run tox -e mypy
35 changes: 18 additions & 17 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,38 @@ jobs:
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: |
'../**/requirements*.txt'
'../**/setup.py'
- run: python -m pip install --upgrade setuptools pip tox virtualenv
enable-cache: true
cache-dependency-glob: |
**/setup.py
**/requirements*.txt
- run: uv tool install tox --with tox-uv
# Run tox only for the installed py version on the runner as outlined in the python matrix
# Ensures the correct py version is installed and tested as opposed to 'tox' which attempts to run for all py versions in tox.ini
- run: tox -e py
- run: tox -e mypy
- run: uv run tox -e py
- run: uv run tox -e mypy

deploy:
# Run tests beforing deploying to pypi
needs: tox
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: 3.13
cache: 'pip'
cache-dependency-path: |
'../**/requirements*.txt'
'../**/setup.py'
python-version: '3.13'
enable-cache: true
cache-dependency-glob: |
**/setup.py
**/requirements*.txt
- name: Install dependencies
run: pip install wheel
run: uv pip --system --upgrade install wheel
- name: Build package
run: python setup.py sdist bdist_wheel
run: uv run python setup.py sdist bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down

0 comments on commit a4871cc

Please sign in to comment.