From a4a82173417185d803a406d6401150a55abc0ca7 Mon Sep 17 00:00:00 2001 From: CJ Steiner Date: Wed, 18 Dec 2024 00:59:31 -0600 Subject: [PATCH 1/6] ci: update checkout to v4 and setup python to v5 - enable caching --- .github/workflows/ci.yml | 5 +++-- .github/workflows/pypi.yml | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23a5cc9ca..3fdf190be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,10 +19,11 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] python: ['3.9', '3.10', '3.11', '3.12'] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} + cache: 'pip' - run: python -m pip install --upgrade setuptools pip tox virtualenv # 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 diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 4b2291e39..3912acb82 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -17,10 +17,11 @@ jobs: os: [ubuntu-latest, macos-latest] python: ['3.9', '3.10', '3.11', '3.12'] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} + cache: 'pip' - run: python -m pip install --upgrade setuptools pip tox virtualenv # 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 @@ -32,11 +33,12 @@ jobs: needs: tox runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: 3.8 + cache: 'pip' - name: Install dependencies run: pip install wheel - name: Build package From 17a53fb3a15c954955e02565c46752ee86a687e0 Mon Sep 17 00:00:00 2001 From: CJ Steiner Date: Fri, 20 Dec 2024 12:44:44 -0600 Subject: [PATCH 2/6] ci: fix cache to work with requirements-dev.txt files --- .github/workflows/ci.yml | 4 ++++ .github/workflows/pypi.yml | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3fdf190be..f4fdddeb5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,10 @@ jobs: with: python-version: ${{ matrix.python }} cache: 'pip' + cache-dependency-path: | + '**/requirements-dev.txt' + '**/requirements-dev-minimal.txt' + '**/setup.py' - run: python -m pip install --upgrade setuptools pip tox virtualenv # 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 diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 3912acb82..671fa5be3 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -22,6 +22,10 @@ jobs: with: python-version: ${{ matrix.python }} cache: 'pip' + cache-dependency-path: | + '**/requirements-dev.txt' + '**/requirements-dev-minimal.txt' + '**/setup.py' - run: python -m pip install --upgrade setuptools pip tox virtualenv # 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 @@ -39,6 +43,10 @@ jobs: with: python-version: 3.8 cache: 'pip' + cache-dependency-path: | + '**/requirements-dev.txt' + '**/requirements-dev-minimal.txt' + '**/setup.py' - name: Install dependencies run: pip install wheel - name: Build package From 291c70febbaf70d32fd27842b466cc4fe839c784 Mon Sep 17 00:00:00 2001 From: CJ Steiner Date: Fri, 20 Dec 2024 12:49:22 -0600 Subject: [PATCH 3/6] ci: cleanup implementation --- .github/workflows/ci.yml | 3 +-- .github/workflows/pypi.yml | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4fdddeb5..47087e3dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,8 +25,7 @@ jobs: python-version: ${{ matrix.python }} cache: 'pip' cache-dependency-path: | - '**/requirements-dev.txt' - '**/requirements-dev-minimal.txt' + '**/requirements*.txt' '**/setup.py' - run: python -m pip install --upgrade setuptools pip tox virtualenv # Run tox only for the installed py version on the runner as outlined in the python matrix diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 671fa5be3..22db6c8ba 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -23,8 +23,7 @@ jobs: python-version: ${{ matrix.python }} cache: 'pip' cache-dependency-path: | - '**/requirements-dev.txt' - '**/requirements-dev-minimal.txt' + '**/requirements*.txt' '**/setup.py' - run: python -m pip install --upgrade setuptools pip tox virtualenv # Run tox only for the installed py version on the runner as outlined in the python matrix @@ -44,8 +43,7 @@ jobs: python-version: 3.8 cache: 'pip' cache-dependency-path: | - '**/requirements-dev.txt' - '**/requirements-dev-minimal.txt' + '**/requirements*.txt' '**/setup.py' - name: Install dependencies run: pip install wheel From 13d9744a818a4effbb5077322a0789df2afc4570 Mon Sep 17 00:00:00 2001 From: CJ Steiner Date: Fri, 20 Dec 2024 13:07:25 -0600 Subject: [PATCH 4/6] ci: add branch to ci on pr actions --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47087e3dc..99c53ec41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,7 @@ on: push: branches: [ master ] pull_request: + branches: [ master ] workflow_dispatch: schedule: - cron: '0 0 1 * *' From 5a47c68fa53ad6875efc4425c33c61fea19d4eff Mon Sep 17 00:00:00 2001 From: CJ Steiner Date: Fri, 20 Dec 2024 13:09:51 -0600 Subject: [PATCH 5/6] ci: go up a dir first --- .github/workflows/ci.yml | 4 ++-- .github/workflows/pypi.yml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99c53ec41..96bc4744d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,8 +26,8 @@ jobs: python-version: ${{ matrix.python }} cache: 'pip' cache-dependency-path: | - '**/requirements*.txt' - '**/setup.py' + '../**/requirements*.txt' + '../**/setup.py' - run: python -m pip install --upgrade setuptools pip tox virtualenv # 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 diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 22db6c8ba..ae7ee2036 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -23,8 +23,8 @@ jobs: python-version: ${{ matrix.python }} cache: 'pip' cache-dependency-path: | - '**/requirements*.txt' - '**/setup.py' + '../**/requirements*.txt' + '../**/setup.py' - run: python -m pip install --upgrade setuptools pip tox virtualenv # 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 @@ -43,8 +43,8 @@ jobs: python-version: 3.8 cache: 'pip' cache-dependency-path: | - '**/requirements*.txt' - '**/setup.py' + '../**/requirements*.txt' + '../**/setup.py' - name: Install dependencies run: pip install wheel - name: Build package From a4871cc28c48e777ee54374611efcb33ace7ad2c Mon Sep 17 00:00:00 2001 From: CJ Steiner Date: Sat, 18 Jan 2025 04:30:09 -0600 Subject: [PATCH 6/6] ci: switch to using uv for python package management. Runs from 6 min down to 1.5 min --- .github/workflows/ci.yml | 18 ++++++++++-------- .github/workflows/pypi.yml | 35 ++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 404ff986c..3c93f3424 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index d66744b6f..f4e9036c9 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -17,18 +17,19 @@ 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 @@ -36,18 +37,18 @@ jobs: 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: