Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,14 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v6
with:
python-version: "3.x"
- run: |
python -m pip install --upgrade pip
python -m pip install -e .[docs]
enable-cache: true

- name: Deploy docs to GitHub Pages
if: github.event_name == 'push'
run: mkdocs gh-deploy --strict --force
run: uv run --group docs mkdocs gh-deploy --strict --force

- name: Test that docs build without error
if: github.event_name == 'pull_request'
run: mkdocs build --strict
run: uv run --group docs mkdocs build --strict
156 changes: 84 additions & 72 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,79 +15,93 @@ on:

jobs:
test:
name: Test
uses: pyapp-kit/workflows/.github/workflows/test-pyrepo.yml@v2
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
qt: ${{ matrix.qt }}
pip-install-pre-release: ${{ github.event_name == 'schedule' }}
coverage-upload: artifact
name: ${{ matrix.os }} (${{ matrix.python-version }}) ${{ matrix.add-group || '' }} ${{ matrix.resolution || ''}}
runs-on: ${{ matrix.os }}
env:
UV_PRERELEASE: ${{ github.event_name == 'schedule' && 'allow' || 'if-necessary-or-explicit' }}
UV_NO_SYNC: 1
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11"]
os: [ubuntu-latest, macos-latest, windows-latest]
qt: [pyqt6, pyside6]
add-group: [pyqt6, pyside6]
include:
- os: windows-latest
python-version: "3.11"
resolution: "lowest-direct"
add-group: pyside6
- python-version: "3.9"
os: ubuntu-latest
qt: pyqt5
add-group: pyqt5
- python-version: "3.9"
os: ubuntu-latest
qt: pyside2
- python-version: "3.9"
os: macos-13
qt: pyside2
- python-version: "3.9"
os: macos-13
qt: pyqt5
- python-version: "3.9"
add-group: pyside2
- python-version: "3.11"
os: windows-latest
qt: pyqt5
add-group: pyqt5
- python-version: "3.10"
os: ubuntu-latest
qt: pyside2
add-group: pyside2
- python-version: "3.12"
os: ubuntu-latest
qt: pyqt6
add-group: pyqt6
- python-version: "3.12"
os: ubuntu-latest
qt: pyside6
add-group: pyside6
- python-version: "3.13"
os: ubuntu-latest
qt: pyside6
add-group: pyside6
- python-version: "3.13"
os: windows-latest
qt: pyqt6
add-group: pyqt6
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

test-min-reqs:
name: Test min reqs
uses: pyapp-kit/workflows/.github/workflows/test-pyrepo.yml@v2
with:
os: ubuntu-latest
python-version: ${{ matrix.python-version }}
qt: pyqt5
pip-install-min-reqs: true
coverage-upload: artifact
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"

test-pydantic1:
name: Test pydantic 1
uses: pyapp-kit/workflows/.github/workflows/test-pyrepo.yml@v2
with:
os: ubuntu-latest
python-version: 3.11
qt: pyqt6
pip-post-installs: '"pydantic<2"'
coverage-upload: artifact
- uses: pyvista/setup-headless-display-action@v4
with:
qt: true

- name: Install Dependencies
run: uv sync --no-dev --group test --group ${{ matrix.add-group || 'test' }} --resolution ${{ matrix.resolution || 'highest'}}

- name: 🧪 Run Tests
run: uv run coverage run -p -m pytest -v

# If something goes wrong with --pre tests, we can open an issue in the repo
- name: 📝 Report --pre Failures
if: failure() && github.event_name == 'schedule'
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
RUN_ID: ${{ github.run_id }}
TITLE: "[test-bot] pip install --pre is failing"
with:
filename: .github/TEST_FAIL_TEMPLATE.md
update_existing: true

- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: covreport-${{ matrix.os }}-py${{ matrix.python-version }}-${{ matrix.add-group }}-${{ matrix.resolution }}
path: ./.coverage*
include-hidden-files: true

upload_coverage:
if: always()
needs: [test, test-min-reqs, test-pydantic1]
needs: [test]
uses: pyapp-kit/workflows/.github/workflows/upload-coverage.yml@v2
secrets: inherit

Expand All @@ -97,7 +111,6 @@ jobs:
dependency-repo: ${{ matrix.package }}
dependency-ref: ${{ matrix.package-version }}
dependency-extras: ${{ matrix.package-extras || 'testing' }}
host-extras: "testing"
qt: pyqt5
python-version: "3.10"
post-install-cmd: "python -m pip install pytest-pretty lxml_html_clean" # just for napari
Expand All @@ -107,7 +120,7 @@ jobs:
matrix:
include:
- package: napari/napari
pytest-args: napari/_tests/test_magicgui.py
pytest-args: src/napari/_tests/test_magicgui.py --import-mode=importlib
- package: napari/napari
package-version: "v0.4.19.post1"
pytest-args: napari/_tests/test_magicgui.py
Expand All @@ -116,34 +129,33 @@ jobs:
package-extras: test
pytest-args: package/tests/test_PartSeg/test_napari_widgets.py

deploy:
build-and-inspect-package:
name: Build & inspect package.
needs: test
runs-on: ubuntu-latest
if: ${{ github.repository == 'pyapp-kit/magicgui' && contains(github.ref, 'tags') }}
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools setuptools_scm wheel twine build
- name: Build
run: |
git tag
python -m build
twine check dist/*
- name: Create Release
uses: softprops/action-gh-release@v2
- uses: hynek/build-and-inspect-python-package@v2

upload-to-pypi:
if: success() && startsWith(github.ref, 'refs/tags/') && github.event_name != 'schedule' && github.repository == 'pyapp-kit/magicgui'
name: Upload package to PyPI
needs: build-and-inspect-package
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Download built artifact to dist/
uses: actions/download-artifact@v4
with:
files: dist/*
body_path: ${{ github.workspace }}/CHANGELOG.md
- name: Publish to PyPI
name: Packages
path: dist
- name: 🚢 Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: './dist/*'
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ ci:

repos:
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.23
rev: v0.24.1
hooks:
- id: validate-pyproject

- repo: https://github.com/crate-ci/typos
rev: v1.30.0
rev: v1.33.1
hooks:
- id: typos

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.9
rev: v0.11.12
hooks:
- id: ruff
- id: ruff-check
args: ["--fix", "--unsafe-fixes"]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
rev: v1.16.0
hooks:
- id: mypy
files: "^src/"
Expand Down
Loading