From 517b2139ccfe59a4cc486467692a0e62bb9839aa Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 3 May 2024 15:21:40 +0100 Subject: [PATCH 1/9] Update pre-commit --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e57a9c8..40048ea 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,13 +1,13 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-docstring-first - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 24.2.0 + rev: 24.4.2 hooks: - id: black @@ -17,14 +17,14 @@ repos: - id: napari-plugin-checks - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.8.0 + rev: v1.10.0 hooks: - id: mypy additional_dependencies: [numpy, matplotlib] - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.2.2' + rev: 'v0.4.2' hooks: - id: ruff From 9949427de3b7212931e2601baabf2040c7cbfe22 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 3 May 2024 15:36:11 +0100 Subject: [PATCH 2/9] Bump codecov action --- .github/workflows/test_and_deploy.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index 8665e1d..9b24e7f 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -58,7 +58,7 @@ jobs: if: ${{ always() }} - name: Coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 # Don't run coverage on merge queue CI to avoid duplicating reports # to codecov. See https://github.com/matplotlib/napari-matplotlib/issues/155 if: github.event_name != 'merge_group' @@ -66,6 +66,8 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true + + deploy: # this will run when you have tagged a commit, starting with "v*" # and requires that you have put your twine API key in your From ea21e54a0c30ceafb3b7c1bdbf7e9ab77f8629c7 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 3 May 2024 15:47:12 +0100 Subject: [PATCH 3/9] Suppress doc build warning --- docs/conf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 2517a59..5be3c95 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -33,6 +33,7 @@ "sphinx_automodapi.automodapi", "sphinx_automodapi.smart_resolver", "sphinx.ext.intersphinx", + "qtgallery", ] sphinx_gallery_conf = { @@ -40,6 +41,7 @@ "image_scrapers": (qtgallery.qtscraper,), "reset_modules": (qtgallery.reset_qapp,), } +suppress_warnings = ["config.cache"] qtgallery_conf = { "xvfb_size": (640, 480), From 2645f43d139202da084aba3cecaa5b19f762093b Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 3 May 2024 15:54:05 +0100 Subject: [PATCH 4/9] Remove napari hub preview --- .github/workflows/napari_hub_preview.yml | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 .github/workflows/napari_hub_preview.yml diff --git a/.github/workflows/napari_hub_preview.yml b/.github/workflows/napari_hub_preview.yml deleted file mode 100644 index c204ac4..0000000 --- a/.github/workflows/napari_hub_preview.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: napari hub Preview Page # we use this name to find your preview page artifact, so don't change it! -# For more info on this action, see https://github.com/chanzuckerberg/napari-hub-preview-action/blob/main/action.yml - -on: - pull_request: - types: [ labeled ] - -jobs: - preview-page: - if: ${{ github.event.label.name == 'napari hub preview' }} - name: Preview Page Deploy - runs-on: ubuntu-latest - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - - name: napari hub Preview Page Builder - uses: chanzuckerberg/napari-hub-preview-action@v0.1 - with: - hub-ref: main From e5b9bb2b5bf5b00aaf0fcbf5598a235b08fd9c83 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 3 May 2024 15:54:42 +0100 Subject: [PATCH 5/9] Update headless gui version --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5b721d9..39c1ab5 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -32,7 +32,7 @@ jobs: sudo apt install graphviz --yes - name: Build Docs - uses: aganders3/headless-gui@v1 + uses: aganders3/headless-gui@v2 with: run: make html working-directory: ./docs From 8cc74cab748cc0da54e6c08ea52d8d0a119fee79 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 3 May 2024 16:01:03 +0100 Subject: [PATCH 6/9] Try stable release of napari for doc build --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 41e4e34..25aa4cf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -47,7 +47,7 @@ napari.manifest = [options.extras_require] docs = - napari[all]==0.4.19rc3 + napari[all]==0.4.19 numpydoc pydantic<2 pydata-sphinx-theme From 0be3f7b70c60fd8cd44220ab4f1c6bfe24722770 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 3 May 2024 16:10:26 +0100 Subject: [PATCH 7/9] Remoe doc napari pin --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 25aa4cf..cccec1c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -47,7 +47,7 @@ napari.manifest = [options.extras_require] docs = - napari[all]==0.4.19 + napari[all] numpydoc pydantic<2 pydata-sphinx-theme From 797e4605e99e2773f9ebcbe5ddd0f687e316fb6e Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 24 May 2024 14:00:28 +0100 Subject: [PATCH 8/9] Try custom scrapers --- docs/conf.py | 57 +++++++++++++++++++++++++++++++++++++++++++--------- setup.cfg | 1 - 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 5be3c95..3c6ce6f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,7 +13,7 @@ # import os # import sys # sys.path.insert(0, os.path.abspath('.')) -import qtgallery +from sphinx_gallery import scrapers # -- Project information ----------------------------------------------------- @@ -33,22 +33,59 @@ "sphinx_automodapi.automodapi", "sphinx_automodapi.smart_resolver", "sphinx.ext.intersphinx", - "qtgallery", ] + +def reset_napari(gallery_conf, fname): + from napari.settings import get_settings + from qtpy.QtWidgets import QApplication + + settings = get_settings() + settings.appearance.theme = "dark" + + # Disabling `QApplication.exec_` means example scripts can call `exec_` + # (scripts work when run normally) without blocking example execution by + # sphinx-gallery. (from qtgallery) + QApplication.exec_ = lambda _: None + + +def napari_scraper(block, block_vars, gallery_conf): + """Basic napari window scraper. + + Looks for any QtMainWindow instances and takes a screenshot of them. + + `app.processEvents()` allows Qt events to propagateo and prevents hanging. + """ + import napari + + imgpath_iter = block_vars["image_path_iterator"] + + if app := napari.qt.get_app(): + app.processEvents() + else: + return "" + + img_paths = [] + for win, img_path in zip( + reversed(napari._qt.qt_main_window._QtMainWindow._instances), + imgpath_iter, + ): + img_paths.append(img_path) + win._window.screenshot(img_path, canvas_only=False) + + napari.Viewer.close_all() + app.processEvents() + + return scrapers.figure_rst(img_paths, gallery_conf["src_dir"]) + + sphinx_gallery_conf = { "filename_pattern": ".", - "image_scrapers": (qtgallery.qtscraper,), - "reset_modules": (qtgallery.reset_qapp,), + "image_scrapers": (napari_scraper,), + "reset_modules": (reset_napari,), } suppress_warnings = ["config.cache"] -qtgallery_conf = { - "xvfb_size": (640, 480), - "xvfb_color_depth": 24, - "xfvb_use_xauth": False, - "xfvb_extra_args": [], -} numpydoc_show_class_members = False automodapi_inheritance_diagram = True diff --git a/setup.cfg b/setup.cfg index cccec1c..76fc8bf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -51,7 +51,6 @@ docs = numpydoc pydantic<2 pydata-sphinx-theme - qtgallery sphinx sphinx-automodapi sphinx-gallery From 312d50c03bd9e4df775c6baa17d728affe37658b Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 24 May 2024 14:03:57 +0100 Subject: [PATCH 9/9] Add some type ignores --- docs/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 3c6ce6f..2818f02 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -36,7 +36,7 @@ ] -def reset_napari(gallery_conf, fname): +def reset_napari(gallery_conf, fname): # type: ignore[no-untyped-def] from napari.settings import get_settings from qtpy.QtWidgets import QApplication @@ -49,7 +49,7 @@ def reset_napari(gallery_conf, fname): QApplication.exec_ = lambda _: None -def napari_scraper(block, block_vars, gallery_conf): +def napari_scraper(block, block_vars, gallery_conf): # type: ignore[no-untyped-def] """Basic napari window scraper. Looks for any QtMainWindow instances and takes a screenshot of them. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy