From 28184fb8c8fca3f22a7dc98c7008a1453ff3a6f1 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 27 Jul 2023 16:02:50 +1000 Subject: [PATCH 01/41] Mayavi example for mkdocs-gallery documentation --- docs/examples/plot_10_mayavi.py | 24 ++++++++++++++++++++++++ mkdocs.yml | 4 +++- src/mkdocs_gallery/scrapers.py | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 docs/examples/plot_10_mayavi.py diff --git a/docs/examples/plot_10_mayavi.py b/docs/examples/plot_10_mayavi.py new file mode 100644 index 00000000..768bb4cd --- /dev/null +++ b/docs/examples/plot_10_mayavi.py @@ -0,0 +1,24 @@ +""" +Example with the mayavi graphing library +======================================== + +Mkdocs-Gallery supports examples made with the +[mayavi library](http://docs.enthought.com/mayavi/mayavi/). + +This mayavi demo is from the +[mayavi documentation](https://docs.enthought.com/mayavi/mayavi/mlab.html#a-demo). +""" + +# Create the data. +from numpy import pi, sin, cos, mgrid +dphi, dtheta = pi/250.0, pi/250.0 +[phi,theta] = mgrid[0:pi+dphi*1.5:dphi,0:2*pi+dtheta*1.5:dtheta] +m0 = 4; m1 = 3; m2 = 2; m3 = 3; m4 = 6; m5 = 2; m6 = 6; m7 = 4; +r = sin(m0*phi)**m1 + cos(m2*phi)**m3 + sin(m4*theta)**m5 + cos(m6*theta)**m7 +x = r*sin(phi)*cos(theta) +y = r*cos(phi) +z = r*sin(phi)*sin(theta) + +# View it. +from mayavi import mlab +s = mlab.mesh(x, y, z) diff --git a/mkdocs.yml b/mkdocs.yml index 8d2926c9..ec7ba043 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -33,7 +33,9 @@ plugins: backreferences_dir: docs/generated/backreferences # where to generate the back references summary doc_module: ['mkdocs_gallery', 'numpy'] # reference_url: {sphinx_gallery: None}, - image_scrapers: matplotlib + image_scrapers: + - matplotlib + - mayavi compress_images: ['images', 'thumbnails'] # specify the order of examples to be according to filename within_subsection_order: FileNameSortKey diff --git a/src/mkdocs_gallery/scrapers.py b/src/mkdocs_gallery/scrapers.py index 2017dc19..bd985832 100644 --- a/src/mkdocs_gallery/scrapers.py +++ b/src/mkdocs_gallery/scrapers.py @@ -310,7 +310,7 @@ def mayavi_scraper(block, script: GalleryScript): e = mlab.get_engine() for scene, image_path in zip(e.scenes, image_path_iterator): try: - mlab.savefig(image_path, figure=scene) + mlab.savefig(str(image_path), figure=scene) except Exception: mlab.close(all=True) raise From 9d95acd8c323ebe8c7f5c3f05c78c07eb8477e63 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 27 Jul 2023 16:07:35 +1000 Subject: [PATCH 02/41] Include leading zeros in example filenames --- docs/examples/{plot_0_sin.py => plot_00_sin.py} | 0 docs/examples/{plot_1_exp.py => plot_01_exp.py} | 0 docs/examples/{plot_2_seaborn.py => plot_02_seaborn.py} | 0 docs/examples/{plot_3_capture_repr.py => plot_03_capture_repr.py} | 0 .../{plot_4_choose_thumbnail.py => plot_04_choose_thumbnail.py} | 0 ...plot_4b_provide_thumbnail.py => plot_04b_provide_thumbnail.py} | 0 ...plot_5_unicode_everywhere.py => plot_05_unicode_everywhere.py} | 0 ...ot_6_function_identifier.py => plot_06_function_identifier.py} | 0 docs/examples/{plot_7_sys_argv.py => plot_07_sys_argv.py} | 0 docs/examples/{plot_8_animations.py => plot_08_animations.py} | 0 docs/examples/{plot_9_plotly.py => plot_09_plotly.py} | 0 11 files changed, 0 insertions(+), 0 deletions(-) rename docs/examples/{plot_0_sin.py => plot_00_sin.py} (100%) rename docs/examples/{plot_1_exp.py => plot_01_exp.py} (100%) rename docs/examples/{plot_2_seaborn.py => plot_02_seaborn.py} (100%) rename docs/examples/{plot_3_capture_repr.py => plot_03_capture_repr.py} (100%) rename docs/examples/{plot_4_choose_thumbnail.py => plot_04_choose_thumbnail.py} (100%) rename docs/examples/{plot_4b_provide_thumbnail.py => plot_04b_provide_thumbnail.py} (100%) rename docs/examples/{plot_5_unicode_everywhere.py => plot_05_unicode_everywhere.py} (100%) rename docs/examples/{plot_6_function_identifier.py => plot_06_function_identifier.py} (100%) rename docs/examples/{plot_7_sys_argv.py => plot_07_sys_argv.py} (100%) rename docs/examples/{plot_8_animations.py => plot_08_animations.py} (100%) rename docs/examples/{plot_9_plotly.py => plot_09_plotly.py} (100%) diff --git a/docs/examples/plot_0_sin.py b/docs/examples/plot_00_sin.py similarity index 100% rename from docs/examples/plot_0_sin.py rename to docs/examples/plot_00_sin.py diff --git a/docs/examples/plot_1_exp.py b/docs/examples/plot_01_exp.py similarity index 100% rename from docs/examples/plot_1_exp.py rename to docs/examples/plot_01_exp.py diff --git a/docs/examples/plot_2_seaborn.py b/docs/examples/plot_02_seaborn.py similarity index 100% rename from docs/examples/plot_2_seaborn.py rename to docs/examples/plot_02_seaborn.py diff --git a/docs/examples/plot_3_capture_repr.py b/docs/examples/plot_03_capture_repr.py similarity index 100% rename from docs/examples/plot_3_capture_repr.py rename to docs/examples/plot_03_capture_repr.py diff --git a/docs/examples/plot_4_choose_thumbnail.py b/docs/examples/plot_04_choose_thumbnail.py similarity index 100% rename from docs/examples/plot_4_choose_thumbnail.py rename to docs/examples/plot_04_choose_thumbnail.py diff --git a/docs/examples/plot_4b_provide_thumbnail.py b/docs/examples/plot_04b_provide_thumbnail.py similarity index 100% rename from docs/examples/plot_4b_provide_thumbnail.py rename to docs/examples/plot_04b_provide_thumbnail.py diff --git a/docs/examples/plot_5_unicode_everywhere.py b/docs/examples/plot_05_unicode_everywhere.py similarity index 100% rename from docs/examples/plot_5_unicode_everywhere.py rename to docs/examples/plot_05_unicode_everywhere.py diff --git a/docs/examples/plot_6_function_identifier.py b/docs/examples/plot_06_function_identifier.py similarity index 100% rename from docs/examples/plot_6_function_identifier.py rename to docs/examples/plot_06_function_identifier.py diff --git a/docs/examples/plot_7_sys_argv.py b/docs/examples/plot_07_sys_argv.py similarity index 100% rename from docs/examples/plot_7_sys_argv.py rename to docs/examples/plot_07_sys_argv.py diff --git a/docs/examples/plot_8_animations.py b/docs/examples/plot_08_animations.py similarity index 100% rename from docs/examples/plot_8_animations.py rename to docs/examples/plot_08_animations.py diff --git a/docs/examples/plot_9_plotly.py b/docs/examples/plot_09_plotly.py similarity index 100% rename from docs/examples/plot_9_plotly.py rename to docs/examples/plot_09_plotly.py From ffe536e93f41fdb066b93a7e1bd9de03ede50b1a Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 27 Jul 2023 16:09:50 +1000 Subject: [PATCH 03/41] Remove TODO notes about mayavi examples --- mkdocs.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index ec7ba043..6ed423fe 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -24,11 +24,9 @@ plugins: examples_dirs: - docs/examples # path to your example scripts, relative to mkdocs.yml - docs/tutorials - # TODO mayavi_examples gallery_dirs: - docs/generated/gallery # where to save gallery generated output. Note that you may or may not include them in - docs/generated/tutorials - # TODO tutorials and mayavi_examples backreferences_dir: docs/generated/backreferences # where to generate the back references summary doc_module: ['mkdocs_gallery', 'numpy'] From c020b0d177b3760753348f3775df2fe786bf0902 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 21 Nov 2023 11:22:34 +1100 Subject: [PATCH 04/41] Add mayavi dependency for CI tests with nox --- noxfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 0b566a4d..98837eee 100644 --- a/noxfile.py +++ b/noxfile.py @@ -179,7 +179,8 @@ def flake8(session: PowerSession): "statsmodels", "plotly", # "memory_profiler", - "pillow" # PIL, required for image rescaling + "pillow", # PIL, required for image rescaling + "mayavi", ] From d4de1283814b7a994e0660031c4452b38bd28828 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 21 Nov 2023 11:36:18 +1100 Subject: [PATCH 05/41] Try mayavi installed from master branch, since mayavi release 4.7.4 with bugfix PR 1272 is not yet available --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 98837eee..e57ab877 100644 --- a/noxfile.py +++ b/noxfile.py @@ -180,7 +180,7 @@ def flake8(session: PowerSession): "plotly", # "memory_profiler", "pillow", # PIL, required for image rescaling - "mayavi", + "git+https://github.com/enthought/mayavi.git", # We need mayavi>=4.7.4 due to https://github.com/enthought/mayavi/pull/1272 ] From aeea56ad59c1382a5a2c7b2caf562850ca1e958d Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 21 Nov 2023 11:43:08 +1100 Subject: [PATCH 06/41] Pin mayavi and dependencies vtk, pyqt5, to avoid installation problems --- noxfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index e57ab877..576ac88c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -180,7 +180,10 @@ def flake8(session: PowerSession): "plotly", # "memory_profiler", "pillow", # PIL, required for image rescaling - "git+https://github.com/enthought/mayavi.git", # We need mayavi>=4.7.4 due to https://github.com/enthought/mayavi/pull/1272 + # mayavi dependency for tests requires mayavi, vtk, and pyqt + "vtk==9.2.6", # vtk dependency can be removed after mayavi>=4.7.4 is released. + "mayavi==4.7.3", # we want mayavi>=4.7.4 when available due to https://github.com/enthought/mayavi/pull/1272 + "PyQt5", ] From dd0e6f5d61e5435e031cbbcd34c5436e52c2c426 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 21 Nov 2023 11:46:19 +1100 Subject: [PATCH 07/41] Mayavi test time dependencies, still trying to fix pip wheel build problems --- noxfile.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/noxfile.py b/noxfile.py index 576ac88c..eeaf2b49 100644 --- a/noxfile.py +++ b/noxfile.py @@ -181,9 +181,8 @@ def flake8(session: PowerSession): # "memory_profiler", "pillow", # PIL, required for image rescaling # mayavi dependency for tests requires mayavi, vtk, and pyqt - "vtk==9.2.6", # vtk dependency can be removed after mayavi>=4.7.4 is released. - "mayavi==4.7.3", # we want mayavi>=4.7.4 when available due to https://github.com/enthought/mayavi/pull/1272 "PyQt5", + "https://github.com/enthought/mayavi.git", # we want mayavi>=4.7.4 when available due to https://github.com/enthought/mayavi/pull/1272 ] From 79d3366b291f3f809f607cfc321577b37b3ccc7f Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 21 Nov 2023 11:47:30 +1100 Subject: [PATCH 08/41] Fix mayavi dependencies typos --- noxfile.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index eeaf2b49..475c5dd9 100644 --- a/noxfile.py +++ b/noxfile.py @@ -180,9 +180,8 @@ def flake8(session: PowerSession): "plotly", # "memory_profiler", "pillow", # PIL, required for image rescaling - # mayavi dependency for tests requires mayavi, vtk, and pyqt - "PyQt5", - "https://github.com/enthought/mayavi.git", # we want mayavi>=4.7.4 when available due to https://github.com/enthought/mayavi/pull/1272 + "PyQt5", # PyQt is required for the mayavi backend + "git+https://github.com/enthought/mayavi.git", # we want mayavi>=4.7.4 when available due to https://github.com/enthought/mayavi/pull/1272 ] From 3b590bb28b58a8fea60fb061c801fbee6bb66982 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 21 Nov 2023 11:54:30 +1100 Subject: [PATCH 09/41] Setup Qt libraries in github actions with tlambert03/setup-qt-libs@v1 --- .github/workflows/base.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 0bdb2cb8..1f4914f4 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -31,6 +31,9 @@ jobs: python-version: 3.9 architecture: x64 + # Setup Qt libraries for mayavi pyqt backend used in demo example + - uses: tlambert03/setup-qt-libs@v1 + - name: Install noxfile requirements run: pip install -r noxfile-requirements.txt From c5f72ea24e2a301be807e731b7a237c220a2464f Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 21 Nov 2023 12:19:08 +1100 Subject: [PATCH 10/41] Try aganders/headless-gui github action to resolve pyqt xfb errors --- .github/workflows/base.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 1f4914f4..41121a0b 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -39,7 +39,9 @@ jobs: - name: List 'tests' nox sessions and required python versions id: set-matrix - run: echo "::set-output name=matrix::$(nox -s gha_list -- -s tests -v)" + uses: aganders3/headless-gui@v1 + with: + run: echo "::set-output name=matrix::$(nox -s gha_list -- -s tests -v)" outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} # save nox sessions list to outputs From 729be0ee31c3145b8451aa081f18f779b08db578 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 21 Nov 2023 12:24:32 +1100 Subject: [PATCH 11/41] Github actions set-output command deprecated, see https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ --- .github/workflows/base.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 41121a0b..4e11546f 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -41,7 +41,7 @@ jobs: id: set-matrix uses: aganders3/headless-gui@v1 with: - run: echo "::set-output name=matrix::$(nox -s gha_list -- -s tests -v)" + run: echo "matrix=$(nox -s gha_list -- -s tests -v)" >> $GITHUB_OUTPUT outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} # save nox sessions list to outputs From 4bd2fe80e3cc509360eb8e4059745e4f9477ceb2 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 21 Nov 2023 12:43:26 +1100 Subject: [PATCH 12/41] Setup Qt libraries in run all tests github action --- .github/workflows/base.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 4e11546f..851dba46 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -31,17 +31,12 @@ jobs: python-version: 3.9 architecture: x64 - # Setup Qt libraries for mayavi pyqt backend used in demo example - - uses: tlambert03/setup-qt-libs@v1 - - name: Install noxfile requirements run: pip install -r noxfile-requirements.txt - name: List 'tests' nox sessions and required python versions id: set-matrix - uses: aganders3/headless-gui@v1 - with: - run: echo "matrix=$(nox -s gha_list -- -s tests -v)" >> $GITHUB_OUTPUT + run: echo "::set-output name=matrix::$(nox -s gha_list -- -s tests -v)" outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} # save nox sessions list to outputs @@ -74,6 +69,9 @@ jobs: python-version: 3.9 architecture: x64 + # Setup Qt libraries for mayavi pyqt backend used in demo example + - uses: tlambert03/setup-qt-libs@v1 + - name: Install noxfile requirements run: pip install -r noxfile-requirements.txt From 44f3ecaa83e7ec905de924aa13baad3068eb240f Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 21 Nov 2023 12:47:40 +1100 Subject: [PATCH 13/41] Try to fix github actions pyqt xfb error, for mayavi demo example --- .github/workflows/base.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 851dba46..1f54b818 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -76,7 +76,9 @@ jobs: run: pip install -r noxfile-requirements.txt - name: Run nox session ${{ matrix.nox_session.session }} - run: nox -s "${{ matrix.nox_session.session }}" + uses: aganders3/headless-gui@v1 + with: + run: nox -s "${{ matrix.nox_session.session }}" # Share ./docs/reports so that they can be deployed with doc in next job - name: Share reports with other jobs From 1414d97971622bbaf2efcc821ede75c0a6d08a3b Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 21 Nov 2023 13:00:35 +1100 Subject: [PATCH 14/41] Add PyOpenGL to test dependencies, try to resolve Windows CI error --- noxfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/noxfile.py b/noxfile.py index 475c5dd9..190d86e0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -181,6 +181,7 @@ def flake8(session: PowerSession): # "memory_profiler", "pillow", # PIL, required for image rescaling "PyQt5", # PyQt is required for the mayavi backend + "PyOpenGL", # PyOpenGL is required for mayavi backend on Windows OS "git+https://github.com/enthought/mayavi.git", # we want mayavi>=4.7.4 when available due to https://github.com/enthought/mayavi/pull/1272 ] From 21ac5b15aa6abdb377659a25d2d0dfccd99dbf41 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 21 Nov 2023 13:13:12 +1100 Subject: [PATCH 15/41] Try OpenGL_Actions github action to potentially resolve Windows OpenGL error in test CI --- .github/workflows/base.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 1f54b818..0da8ec48 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -69,8 +69,12 @@ jobs: python-version: 3.9 architecture: x64 - # Setup Qt libraries for mayavi pyqt backend used in demo example - - uses: tlambert03/setup-qt-libs@v1 + # Setup Qt libraries and OpenGL for mayavi pyqt backend used in demo example + - name: Setup Qt libraries + uses: tlambert03/setup-qt-libs@v1 + + - name: OpenGL Actions + uses: NishkarshRaj/OpenGL_Actions@1.0 - name: Install noxfile requirements run: pip install -r noxfile-requirements.txt From 7332dfd43b84f7e909ee35e3477e4fe135d1950b Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 21 Nov 2023 13:25:52 +1100 Subject: [PATCH 16/41] Revert, openGL github action did not work --- .github/workflows/base.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 0da8ec48..555478db 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -69,13 +69,10 @@ jobs: python-version: 3.9 architecture: x64 - # Setup Qt libraries and OpenGL for mayavi pyqt backend used in demo example + # Setup Qt libraries for mayavi pyqt backend used in demo example - name: Setup Qt libraries uses: tlambert03/setup-qt-libs@v1 - - name: OpenGL Actions - uses: NishkarshRaj/OpenGL_Actions@1.0 - - name: Install noxfile requirements run: pip install -r noxfile-requirements.txt From 8ae45a9ade8c8e53eef2815e19fef47dbbca0bab Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Wed, 22 Nov 2023 10:34:53 +1100 Subject: [PATCH 17/41] mayavi not supported on python 3.7, exclude from these tests --- noxfile.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index 190d86e0..6386c43f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -10,7 +10,7 @@ # add parent folder to python path so that we can import noxfile_utils.py # note that you need to "pip install -r noxfile-requiterements.txt" for this file to work. sys.path.append(str(Path(__file__).parent / "ci_tools")) -from nox_utils import PY27, PY37, PY36, PY35, PY38, PY39, PY310, PY311, power_session, rm_folder, rm_file, PowerSession # noqa +from nox_utils import PY37, PY38, PY39, PY310, PY311, power_session, rm_folder, rm_file, PowerSession # noqa pkg_name = "mkdocs_gallery" @@ -88,6 +88,10 @@ def tests(session: PowerSession, coverage, pkg_specs): # install all requirements session.install_reqs(setup=True, install=True, tests=True, versions_dct=pkg_specs) + if sys.platform is "linux" and session.python >=3.8: + MKDOCS_GALLERY_EXAMPLES_REQS = MKDOCS_GALLERY_EXAMPLES_BASE_REQS + MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS + else: + MKDOCS_GALLERY_EXAMPLES_REQS = MKDOCS_GALLERY_EXAMPLES_BASE_REQS # Since our tests are currently limited, use our own doc generation as a test session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS) @@ -173,15 +177,16 @@ def flake8(session: PowerSession): rm_file(Folders.flake8_intermediate_file) -MKDOCS_GALLERY_EXAMPLES_REQS = [ +MKDOCS_GALLERY_EXAMPLES_BASE_REQS = [ "matplotlib", "seaborn", "statsmodels", "plotly", # "memory_profiler", "pillow", # PIL, required for image rescaling +] +MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS = [ "PyQt5", # PyQt is required for the mayavi backend - "PyOpenGL", # PyOpenGL is required for mayavi backend on Windows OS "git+https://github.com/enthought/mayavi.git", # we want mayavi>=4.7.4 when available due to https://github.com/enthought/mayavi/pull/1272 ] @@ -190,6 +195,10 @@ def flake8(session: PowerSession): def docs(session: PowerSession): """Generates the doc and serves it on a local http server. Pass '-- build' to build statically instead.""" + if sys.platform is "linux" and session.python >=3.8: + MKDOCS_GALLERY_EXAMPLES_REQS = MKDOCS_GALLERY_EXAMPLES_BASE_REQS + MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS + else: + MKDOCS_GALLERY_EXAMPLES_REQS = MKDOCS_GALLERY_EXAMPLES_BASE_REQS session.install_reqs(phase="docs", phase_reqs=["mkdocs"] + MKDOCS_GALLERY_EXAMPLES_REQS) # Install the plugin From 8e1dee4c2a3520c49aa8a80ca3f7b504179b628a Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Wed, 22 Nov 2023 10:50:13 +1100 Subject: [PATCH 18/41] Try optional install of mayavi where python>=3.8 --- noxfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 6386c43f..ec51be56 100644 --- a/noxfile.py +++ b/noxfile.py @@ -214,7 +214,10 @@ def docs(session: PowerSession): @power_session(python=[PY39]) def publish(session: PowerSession): """Deploy the docs+reports on github pages. Note: this rebuilds the docs""" - + if sys.platform is "linux" and session.python >=3.8: + MKDOCS_GALLERY_EXAMPLES_REQS = MKDOCS_GALLERY_EXAMPLES_BASE_REQS + MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS + else: + MKDOCS_GALLERY_EXAMPLES_REQS = MKDOCS_GALLERY_EXAMPLES_BASE_REQS session.install_reqs( phase="mkdocs", phase_reqs=["mkdocs"] + MKDOCS_GALLERY_EXAMPLES_REQS From 6ab8d143cd2a35aede70a07b64f6321d72f293e3 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Wed, 22 Nov 2023 10:59:20 +1100 Subject: [PATCH 19/41] Try/except mayavi import, since we are skipping the mayavi scraper on unsupported python 3.7 --- src/mkdocs_gallery/scrapers.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mkdocs_gallery/scrapers.py b/src/mkdocs_gallery/scrapers.py index 154fc63f..b1a3c3a3 100644 --- a/src/mkdocs_gallery/scrapers.py +++ b/src/mkdocs_gallery/scrapers.py @@ -22,7 +22,7 @@ from pathlib import Path, PurePosixPath from textwrap import indent from typing import Dict, List, Optional -from warnings import filterwarnings +from warnings import filterwarnings, warn from .errors import ExtensionError from .gen_data_model import GalleryScript @@ -303,7 +303,11 @@ def mayavi_scraper(block, script: GalleryScript): The ReSTructuredText that will be rendered to HTML containing the images. This is often produced by :func:`figure_md_or_html`. """ - from mayavi import mlab + try: + from mayavi import mlab + except ModuleNotFoundError: + warn("No module named 'mayavi', skipping mayavi image scraper.") + return # skip scraper function image_path_iterator = script.run_vars.image_path_iterator image_paths = list() From 1c4d0efe1dd9b8f5b5f6ccd5bc2fe8e46c673c24 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Wed, 22 Nov 2023 11:03:48 +1100 Subject: [PATCH 20/41] Image scrapers need to return HTML strings, not None type --- src/mkdocs_gallery/scrapers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mkdocs_gallery/scrapers.py b/src/mkdocs_gallery/scrapers.py index b1a3c3a3..b8d40fe3 100644 --- a/src/mkdocs_gallery/scrapers.py +++ b/src/mkdocs_gallery/scrapers.py @@ -307,7 +307,7 @@ def mayavi_scraper(block, script: GalleryScript): from mayavi import mlab except ModuleNotFoundError: warn("No module named 'mayavi', skipping mayavi image scraper.") - return # skip scraper function + return "" # skip scraper function image_path_iterator = script.run_vars.image_path_iterator image_paths = list() From 2d6b03cf8aca1c109985162b576d49a5886990c7 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Wed, 22 Nov 2023 11:13:15 +1100 Subject: [PATCH 21/41] Try again to have optional mayavi tests --- noxfile.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/noxfile.py b/noxfile.py index ec51be56..0cdc5556 100644 --- a/noxfile.py +++ b/noxfile.py @@ -88,12 +88,14 @@ def tests(session: PowerSession, coverage, pkg_specs): # install all requirements session.install_reqs(setup=True, install=True, tests=True, versions_dct=pkg_specs) + # Since our tests are currently limited, use our own doc generation as a test + print("sys.platform", sys.platform) + print("session.python", session.python) if sys.platform is "linux" and session.python >=3.8: - MKDOCS_GALLERY_EXAMPLES_REQS = MKDOCS_GALLERY_EXAMPLES_BASE_REQS + MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS + session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS + MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS) else: - MKDOCS_GALLERY_EXAMPLES_REQS = MKDOCS_GALLERY_EXAMPLES_BASE_REQS - # Since our tests are currently limited, use our own doc generation as a test - session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS) + session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS) + # install CI-only dependencies # if install_ci_deps: @@ -177,7 +179,7 @@ def flake8(session: PowerSession): rm_file(Folders.flake8_intermediate_file) -MKDOCS_GALLERY_EXAMPLES_BASE_REQS = [ +MKDOCS_GALLERY_EXAMPLES_REQS = [ "matplotlib", "seaborn", "statsmodels", @@ -195,10 +197,6 @@ def flake8(session: PowerSession): def docs(session: PowerSession): """Generates the doc and serves it on a local http server. Pass '-- build' to build statically instead.""" - if sys.platform is "linux" and session.python >=3.8: - MKDOCS_GALLERY_EXAMPLES_REQS = MKDOCS_GALLERY_EXAMPLES_BASE_REQS + MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS - else: - MKDOCS_GALLERY_EXAMPLES_REQS = MKDOCS_GALLERY_EXAMPLES_BASE_REQS session.install_reqs(phase="docs", phase_reqs=["mkdocs"] + MKDOCS_GALLERY_EXAMPLES_REQS) # Install the plugin @@ -214,10 +212,7 @@ def docs(session: PowerSession): @power_session(python=[PY39]) def publish(session: PowerSession): """Deploy the docs+reports on github pages. Note: this rebuilds the docs""" - if sys.platform is "linux" and session.python >=3.8: - MKDOCS_GALLERY_EXAMPLES_REQS = MKDOCS_GALLERY_EXAMPLES_BASE_REQS + MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS - else: - MKDOCS_GALLERY_EXAMPLES_REQS = MKDOCS_GALLERY_EXAMPLES_BASE_REQS + session.install_reqs( phase="mkdocs", phase_reqs=["mkdocs"] + MKDOCS_GALLERY_EXAMPLES_REQS From ec4ec2271cdf01634e397ec14670fcf0d1ba3c8a Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Wed, 22 Nov 2023 11:38:09 +1100 Subject: [PATCH 22/41] Try again --- noxfile.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/noxfile.py b/noxfile.py index 0cdc5556..9824169a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -4,6 +4,7 @@ import logging import nox # noqa +from packaging import version from pathlib import Path # noqa import sys @@ -91,7 +92,7 @@ def tests(session: PowerSession, coverage, pkg_specs): # Since our tests are currently limited, use our own doc generation as a test print("sys.platform", sys.platform) print("session.python", session.python) - if sys.platform is "linux" and session.python >=3.8: + if sys.platform == "linux" and (version.parse(session.python) >= version.parse(PY38)): session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS + MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS) else: session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS) @@ -196,8 +197,10 @@ def flake8(session: PowerSession): @power_session(python=[PY39]) def docs(session: PowerSession): """Generates the doc and serves it on a local http server. Pass '-- build' to build statically instead.""" - - session.install_reqs(phase="docs", phase_reqs=["mkdocs"] + MKDOCS_GALLERY_EXAMPLES_REQS) + if sys.platform == "linux" and (version.parse(session.python) >= version.parse(PY38)): + session.install_reqs(phase="docs", phase_reqs=["mkdocs"] + MKDOCS_GALLERY_EXAMPLES_REQS + MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS) + else: + session.install_reqs(phase="docs", phase_reqs=["mkdocs"] + MKDOCS_GALLERY_EXAMPLES_REQS) # Install the plugin session.install2('.') @@ -212,11 +215,10 @@ def docs(session: PowerSession): @power_session(python=[PY39]) def publish(session: PowerSession): """Deploy the docs+reports on github pages. Note: this rebuilds the docs""" - - session.install_reqs( - phase="mkdocs", - phase_reqs=["mkdocs"] + MKDOCS_GALLERY_EXAMPLES_REQS - ) + if sys.platform == "linux" and (version.parse(session.python) >= version.parse(PY38)): + session.install_reqs(phase="mkdocs", phase_reqs=["mkdocs"] + MKDOCS_GALLERY_EXAMPLES_REQS + MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS) + else: + session.install_reqs(phase="mkdocs", phase_reqs=["mkdocs"] + MKDOCS_GALLERY_EXAMPLES_REQS) # Install the plugin session.install2('.') From 5d9c02bbaefecf8e9a54d363c174ddf437d8d43c Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 23 Nov 2023 12:42:39 +1100 Subject: [PATCH 23/41] Edit mkdocs.yml file to skip plot_10_mayavi.py example where mayavi dependency is not installed --- noxfile.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index 9824169a..a2c8bbcf 100644 --- a/noxfile.py +++ b/noxfile.py @@ -88,15 +88,30 @@ def tests(session: PowerSession, coverage, pkg_specs): # install all requirements session.install_reqs(setup=True, install=True, tests=True, versions_dct=pkg_specs) - # Since our tests are currently limited, use our own doc generation as a test - print("sys.platform", sys.platform) - print("session.python", session.python) if sys.platform == "linux" and (version.parse(session.python) >= version.parse(PY38)): session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS + MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS) else: session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS) + # Edit mkdocs config file + with open("mkdocs.yml", "r") as f: + mkdocs_config = f.readlines() + # Ignore failing mayavi example where mayavi is not installed + if sys.platform == "linux" and (version.parse(session.python) >= version.parse(PY38)): + # Add plot_10_mayavi.py to the list of expected failures + with open("mkdocs.yml", "w") as f: + for line in mkdocs_config: + if line == " expected_failing_examples:\n": + line = line + " - docs/examples/no_output/plot_10_mayavi.py\n" + f.write(line) + else: + # Make sure plot_10_mayavi.py is not ignored when the mayavi dependency is available + with open("mkdocs.yml", "w") as f: + for line in mkdocs_config: + if line == " - docs/examples/no_output/plot_10_mayavi.py\n" + line = "" + f.write(line) # install CI-only dependencies # if install_ci_deps: From f3f4c5a70d98c58a8d9f64fd31b95ad5fedd4b5d Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 23 Nov 2023 14:11:11 +1100 Subject: [PATCH 24/41] Fix typo, missing colon : --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index a2c8bbcf..c7a8e789 100644 --- a/noxfile.py +++ b/noxfile.py @@ -109,7 +109,7 @@ def tests(session: PowerSession, coverage, pkg_specs): # Make sure plot_10_mayavi.py is not ignored when the mayavi dependency is available with open("mkdocs.yml", "w") as f: for line in mkdocs_config: - if line == " - docs/examples/no_output/plot_10_mayavi.py\n" + if line == " - docs/examples/no_output/plot_10_mayavi.py\n": line = "" f.write(line) From eebe7ded2eb263e0c0740020812a1bce0cd2a7da Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 23 Nov 2023 14:17:16 +1100 Subject: [PATCH 25/41] Fix path to mayavi example file --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index c7a8e789..54ac15a8 100644 --- a/noxfile.py +++ b/noxfile.py @@ -109,7 +109,7 @@ def tests(session: PowerSession, coverage, pkg_specs): # Make sure plot_10_mayavi.py is not ignored when the mayavi dependency is available with open("mkdocs.yml", "w") as f: for line in mkdocs_config: - if line == " - docs/examples/no_output/plot_10_mayavi.py\n": + if line == " - docs/examples/plot_10_mayavi.py\n": line = "" f.write(line) From 7e3e63fec87424072d18c7f011baf4763dc907c2 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 23 Nov 2023 14:57:17 +1100 Subject: [PATCH 26/41] Fixes for noxfile.py, optionally skip mayavi example on Windows & python 3.7 --- noxfile.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/noxfile.py b/noxfile.py index 54ac15a8..539e622f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -27,7 +27,6 @@ PY38: {"coverage": True, "pkg_specs": {"pip": ">19"}}, } - # set the default activated sessions, minimal for CI nox.options.sessions = ["tests", "flake8", "docs"] # , "docs", "gh_pages" nox.options.error_on_missing_interpreters = True @@ -89,21 +88,22 @@ def tests(session: PowerSession, coverage, pkg_specs): # install all requirements session.install_reqs(setup=True, install=True, tests=True, versions_dct=pkg_specs) # Since our tests are currently limited, use our own doc generation as a test - if sys.platform == "linux" and (version.parse(session.python) >= version.parse(PY38)): - session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS + MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS) + if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): + session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS+MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS) else: + # We are having OpenGL issues installing mayavi on Windows, skip it session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS) # Edit mkdocs config file with open("mkdocs.yml", "r") as f: mkdocs_config = f.readlines() # Ignore failing mayavi example where mayavi is not installed - if sys.platform == "linux" and (version.parse(session.python) >= version.parse(PY38)): + if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): # Add plot_10_mayavi.py to the list of expected failures with open("mkdocs.yml", "w") as f: for line in mkdocs_config: if line == " expected_failing_examples:\n": - line = line + " - docs/examples/no_output/plot_10_mayavi.py\n" + line = line + " - docs/examples/plot_10_mayavi.py\n" f.write(line) else: # Make sure plot_10_mayavi.py is not ignored when the mayavi dependency is available @@ -212,10 +212,7 @@ def flake8(session: PowerSession): @power_session(python=[PY39]) def docs(session: PowerSession): """Generates the doc and serves it on a local http server. Pass '-- build' to build statically instead.""" - if sys.platform == "linux" and (version.parse(session.python) >= version.parse(PY38)): - session.install_reqs(phase="docs", phase_reqs=["mkdocs"] + MKDOCS_GALLERY_EXAMPLES_REQS + MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS) - else: - session.install_reqs(phase="docs", phase_reqs=["mkdocs"] + MKDOCS_GALLERY_EXAMPLES_REQS) + session.install_reqs(phase="docs", phase_reqs=["mkdocs"] + MKDOCS_GALLERY_EXAMPLES_REQS + MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS) # Install the plugin session.install2('.') @@ -230,10 +227,7 @@ def docs(session: PowerSession): @power_session(python=[PY39]) def publish(session: PowerSession): """Deploy the docs+reports on github pages. Note: this rebuilds the docs""" - if sys.platform == "linux" and (version.parse(session.python) >= version.parse(PY38)): - session.install_reqs(phase="mkdocs", phase_reqs=["mkdocs"] + MKDOCS_GALLERY_EXAMPLES_REQS + MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS) - else: - session.install_reqs(phase="mkdocs", phase_reqs=["mkdocs"] + MKDOCS_GALLERY_EXAMPLES_REQS) + session.install_reqs(phase="mkdocs", phase_reqs=["mkdocs"] + MKDOCS_GALLERY_EXAMPLES_REQS + MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS) # Install the plugin session.install2('.') From 7280f1fd940db0cfcbd997e311cf056152eeaeb0 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:06:45 +1100 Subject: [PATCH 27/41] More noxfile changes --- noxfile.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/noxfile.py b/noxfile.py index 539e622f..15d081bf 100644 --- a/noxfile.py +++ b/noxfile.py @@ -2,11 +2,12 @@ from itertools import product from json import dumps import logging +import os +import sys import nox # noqa from packaging import version from pathlib import Path # noqa -import sys # add parent folder to python path so that we can import noxfile_utils.py # note that you need to "pip install -r noxfile-requiterements.txt" for this file to work. @@ -100,18 +101,11 @@ def tests(session: PowerSession, coverage, pkg_specs): # Ignore failing mayavi example where mayavi is not installed if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): # Add plot_10_mayavi.py to the list of expected failures - with open("mkdocs.yml", "w") as f: + with open("mkdocs-no-mayavi.yml", "w") as f: for line in mkdocs_config: if line == " expected_failing_examples:\n": line = line + " - docs/examples/plot_10_mayavi.py\n" f.write(line) - else: - # Make sure plot_10_mayavi.py is not ignored when the mayavi dependency is available - with open("mkdocs.yml", "w") as f: - for line in mkdocs_config: - if line == " - docs/examples/plot_10_mayavi.py\n": - line = "" - f.write(line) # install CI-only dependencies # if install_ci_deps: @@ -136,9 +130,17 @@ def tests(session: PowerSession, coverage, pkg_specs): session.run2("python -m pytest --cache-clear -v tests/") # since our tests are too limited, we use our own mkdocs build as additional test for now. - session.run2("python -m mkdocs build") + if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): + session.run2("python -m mkdocs build -f mkdocs-no-mayavi.yml") + else: + session.run2("python -m mkdocs build") # -- add a second build so that we can go through the caching/md5 side - session.run2("python -m mkdocs build") + if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): + session.run2("python -m mkdocs build -f mkdocs-no-mayavi.yml") + else: + session.run2("python -m mkdocs build") + # Cleanup + os.remove("mkdocs-no-mayavi.yml") else: # install self in "develop" mode so that coverage can be measured session.install2('-e', '.', '--no-deps') From 359ef95caf23255240715f15face542adb23e97d Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:14:02 +1100 Subject: [PATCH 28/41] noxfile, explicitly specify mkdocs config yaml file for all mkdocs build commands --- noxfile.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/noxfile.py b/noxfile.py index 15d081bf..78ecea7a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -133,12 +133,12 @@ def tests(session: PowerSession, coverage, pkg_specs): if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): session.run2("python -m mkdocs build -f mkdocs-no-mayavi.yml") else: - session.run2("python -m mkdocs build") + session.run2("python -m mkdocs build -f mkdocs.yml") # -- add a second build so that we can go through the caching/md5 side if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): session.run2("python -m mkdocs build -f mkdocs-no-mayavi.yml") else: - session.run2("python -m mkdocs build") + session.run2("python -m mkdocs build -f mkdocs.yml") # Cleanup os.remove("mkdocs-no-mayavi.yml") else: @@ -156,11 +156,19 @@ def tests(session: PowerSession, coverage, pkg_specs): "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) # -- use the doc generation for coverage - session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build" - "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) + if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): + session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs-no-mayavi.yml" + "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) + else: + session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs.yml" + "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) # -- add a second build so that we can go through the caching/md5 side - session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build" - "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) + if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): + session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs-no-mayavi.yml" + "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) + else: + session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs.yml" + "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) session.run2("coverage report") session.run2("coverage xml -o '{covxml}'".format(covxml=Folders.coverage_xml)) @@ -235,7 +243,7 @@ def publish(session: PowerSession): session.install2('.') # possibly rebuild the docs in a static way (mkdocs serve does not build locally) - session.run2("mkdocs build") + session.run2("mkdocs build -f mkdocs.yml") # check that the doc has been generated with coverage if not Folders.site_reports.exists(): From ba986c1173402fec1352abba3066c5cd8aec39c0 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:25:35 +1100 Subject: [PATCH 29/41] noxfile, if/then statement logic accidentally reversed, fixing it --- noxfile.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/noxfile.py b/noxfile.py index 78ecea7a..fcc02ffe 100644 --- a/noxfile.py +++ b/noxfile.py @@ -131,14 +131,14 @@ def tests(session: PowerSession, coverage, pkg_specs): # since our tests are too limited, we use our own mkdocs build as additional test for now. if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): - session.run2("python -m mkdocs build -f mkdocs-no-mayavi.yml") - else: session.run2("python -m mkdocs build -f mkdocs.yml") + else: + session.run2("python -m mkdocs build -f mkdocs-no-mayavi.yml") # -- add a second build so that we can go through the caching/md5 side if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): - session.run2("python -m mkdocs build -f mkdocs-no-mayavi.yml") - else: session.run2("python -m mkdocs build -f mkdocs.yml") + else: + session.run2("python -m mkdocs build -f mkdocs-no-mayavi.yml") # Cleanup os.remove("mkdocs-no-mayavi.yml") else: @@ -157,17 +157,17 @@ def tests(session: PowerSession, coverage, pkg_specs): # -- use the doc generation for coverage if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): - session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs-no-mayavi.yml" + session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs.yml" "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) else: - session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs.yml" + session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs-no-mayavi.yml" "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) # -- add a second build so that we can go through the caching/md5 side if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): - session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs-no-mayavi.yml" + session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs.yml" "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) else: - session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs.yml" + session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs-no-mayavi.yml" "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) session.run2("coverage report") @@ -231,7 +231,7 @@ def docs(session: PowerSession): # use posargs instead of "serve" session.run2("mkdocs %s" % " ".join(session.posargs)) else: - session.run2("mkdocs serve") + session.run2("mkdocs serve -f mkdocs.yml") @power_session(python=[PY39]) @@ -250,7 +250,7 @@ def publish(session: PowerSession): raise ValueError("Test reports have not been built yet. Please run 'nox -s tests-3.7' first") # publish the docs - session.run2("mkdocs gh-deploy") + session.run2("mkdocs gh-deploy -f mkdocs.yml") # publish the coverage - now in github actions only # session.install_reqs(phase="codecov", phase_reqs=["codecov", "keyring"]) From b60c2948413143ef83264cc9b32b2f1e9984d53c Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:28:25 +1100 Subject: [PATCH 30/41] noxfile, fix up if/then logic --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index fcc02ffe..8d6bb29c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -99,7 +99,7 @@ def tests(session: PowerSession, coverage, pkg_specs): with open("mkdocs.yml", "r") as f: mkdocs_config = f.readlines() # Ignore failing mayavi example where mayavi is not installed - if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): + if sys.platform == "win32" or (version.parse(session.python) >= version.parse(PY38)): # Add plot_10_mayavi.py to the list of expected failures with open("mkdocs-no-mayavi.yml", "w") as f: for line in mkdocs_config: From 5595aa3357ef77bc50cc76027737541ea1e6fc72 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:33:38 +1100 Subject: [PATCH 31/41] Check mkdocs-no-mayavi.yml exists before attempting to delete it --- noxfile.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/noxfile.py b/noxfile.py index 8d6bb29c..df6b7536 100644 --- a/noxfile.py +++ b/noxfile.py @@ -100,7 +100,6 @@ def tests(session: PowerSession, coverage, pkg_specs): mkdocs_config = f.readlines() # Ignore failing mayavi example where mayavi is not installed if sys.platform == "win32" or (version.parse(session.python) >= version.parse(PY38)): - # Add plot_10_mayavi.py to the list of expected failures with open("mkdocs-no-mayavi.yml", "w") as f: for line in mkdocs_config: if line == " expected_failing_examples:\n": @@ -130,17 +129,18 @@ def tests(session: PowerSession, coverage, pkg_specs): session.run2("python -m pytest --cache-clear -v tests/") # since our tests are too limited, we use our own mkdocs build as additional test for now. - if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): - session.run2("python -m mkdocs build -f mkdocs.yml") - else: + if sys.platform == "win32" or (version.parse(session.python) >= version.parse(PY38)): session.run2("python -m mkdocs build -f mkdocs-no-mayavi.yml") - # -- add a second build so that we can go through the caching/md5 side - if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): - session.run2("python -m mkdocs build -f mkdocs.yml") else: + session.run2("python -m mkdocs build -f mkdocs.yml") + # -- add a second build so that we can go through the caching/md5 side + if sys.platform == "win32" or (version.parse(session.python) >= version.parse(PY38)): session.run2("python -m mkdocs build -f mkdocs-no-mayavi.yml") + else: + session.run2("python -m mkdocs build -f mkdocs.yml") # Cleanup - os.remove("mkdocs-no-mayavi.yml") + if os.path.exists("mkdocs-no-mayavi.yml"): + os.remove("mkdocs-no-mayavi.yml") else: # install self in "develop" mode so that coverage can be measured session.install2('-e', '.', '--no-deps') From b2c8729cd192abea571ecc0645131859d75a69e4 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:37:45 +1100 Subject: [PATCH 32/41] noxfile adjustments --- noxfile.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/noxfile.py b/noxfile.py index df6b7536..b8d7e07d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -89,7 +89,7 @@ def tests(session: PowerSession, coverage, pkg_specs): # install all requirements session.install_reqs(setup=True, install=True, tests=True, versions_dct=pkg_specs) # Since our tests are currently limited, use our own doc generation as a test - if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): + if sys.platform != "win32" and (version.parse(session.python) < version.parse(PY38)): session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS+MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS) else: # We are having OpenGL issues installing mayavi on Windows, skip it @@ -99,7 +99,7 @@ def tests(session: PowerSession, coverage, pkg_specs): with open("mkdocs.yml", "r") as f: mkdocs_config = f.readlines() # Ignore failing mayavi example where mayavi is not installed - if sys.platform == "win32" or (version.parse(session.python) >= version.parse(PY38)): + if sys.platform == "win32" or (version.parse(session.python) < version.parse(PY38)): with open("mkdocs-no-mayavi.yml", "w") as f: for line in mkdocs_config: if line == " expected_failing_examples:\n": @@ -129,12 +129,12 @@ def tests(session: PowerSession, coverage, pkg_specs): session.run2("python -m pytest --cache-clear -v tests/") # since our tests are too limited, we use our own mkdocs build as additional test for now. - if sys.platform == "win32" or (version.parse(session.python) >= version.parse(PY38)): + if sys.platform == "win32" or (version.parse(session.python) < version.parse(PY38)): session.run2("python -m mkdocs build -f mkdocs-no-mayavi.yml") else: session.run2("python -m mkdocs build -f mkdocs.yml") # -- add a second build so that we can go through the caching/md5 side - if sys.platform == "win32" or (version.parse(session.python) >= version.parse(PY38)): + if sys.platform == "win32" or (version.parse(session.python) < version.parse(PY38)): session.run2("python -m mkdocs build -f mkdocs-no-mayavi.yml") else: session.run2("python -m mkdocs build -f mkdocs.yml") @@ -156,14 +156,14 @@ def tests(session: PowerSession, coverage, pkg_specs): "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) # -- use the doc generation for coverage - if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): + if sys.platform != "win32" and (version.parse(session.python) < version.parse(PY38)): session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs.yml" "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) else: session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs-no-mayavi.yml" "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) # -- add a second build so that we can go through the caching/md5 side - if sys.platform != "win32" and (version.parse(session.python) >= version.parse(PY38)): + if sys.platform != "win32" and (version.parse(session.python) < version.parse(PY38)): session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs.yml" "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) else: From e9c4875bdff4706d6f8e8ee6bcf1a1fc61c488ea Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:42:23 +1100 Subject: [PATCH 33/41] noxfile, should use or instead of and --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index b8d7e07d..692eba44 100644 --- a/noxfile.py +++ b/noxfile.py @@ -89,7 +89,7 @@ def tests(session: PowerSession, coverage, pkg_specs): # install all requirements session.install_reqs(setup=True, install=True, tests=True, versions_dct=pkg_specs) # Since our tests are currently limited, use our own doc generation as a test - if sys.platform != "win32" and (version.parse(session.python) < version.parse(PY38)): + if sys.platform != "win32" or (version.parse(session.python) < version.parse(PY38)): session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS+MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS) else: # We are having OpenGL issues installing mayavi on Windows, skip it From 93dd1a9104cc44b7bf6b326f258679bc7d4aee78 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:46:58 +1100 Subject: [PATCH 34/41] Swap order of dependency installs --- noxfile.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index 692eba44..165827f0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -89,11 +89,12 @@ def tests(session: PowerSession, coverage, pkg_specs): # install all requirements session.install_reqs(setup=True, install=True, tests=True, versions_dct=pkg_specs) # Since our tests are currently limited, use our own doc generation as a test - if sys.platform != "win32" or (version.parse(session.python) < version.parse(PY38)): - session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS+MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS) - else: + if sys.platform == "win32" or (version.parse(session.python) < version.parse(PY38)): # We are having OpenGL issues installing mayavi on Windows, skip it session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS) + else: + # We are having OpenGL issues installing mayavi on Windows, skip it + session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS+MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS) # Edit mkdocs config file with open("mkdocs.yml", "r") as f: From 5b15cbf5d909402499f45d4c2e9add09fe29d686 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:53:10 +1100 Subject: [PATCH 35/41] noxfile cleanup of mkdocs-no-mayavi.yml file must happen only at the very end of the job --- noxfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index 165827f0..107b7cb0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -139,9 +139,6 @@ def tests(session: PowerSession, coverage, pkg_specs): session.run2("python -m mkdocs build -f mkdocs-no-mayavi.yml") else: session.run2("python -m mkdocs build -f mkdocs.yml") - # Cleanup - if os.path.exists("mkdocs-no-mayavi.yml"): - os.remove("mkdocs-no-mayavi.yml") else: # install self in "develop" mode so that coverage can be measured session.install2('-e', '.', '--no-deps') @@ -182,6 +179,9 @@ def tests(session: PowerSession, coverage, pkg_specs): # Use our own package to generate the badge session.run2("genbadge tests -i '%s' -o '%s' -t 100" % (Folders.test_xml, Folders.test_badge)) session.run2("genbadge coverage -i '%s' -o '%s'" % (Folders.coverage_xml, Folders.coverage_badge)) + # Cleanup + if os.path.exists("mkdocs-no-mayavi.yml"): + os.remove("mkdocs-no-mayavi.yml") @power_session(python=PY39, logsdir=Folders.runlogs) From ebb25003d4008a2b28c479a9b815e11c998771d4 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:53:39 +1100 Subject: [PATCH 36/41] Fix indentation level --- noxfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index 107b7cb0..766efd57 100644 --- a/noxfile.py +++ b/noxfile.py @@ -179,9 +179,9 @@ def tests(session: PowerSession, coverage, pkg_specs): # Use our own package to generate the badge session.run2("genbadge tests -i '%s' -o '%s' -t 100" % (Folders.test_xml, Folders.test_badge)) session.run2("genbadge coverage -i '%s' -o '%s'" % (Folders.coverage_xml, Folders.coverage_badge)) - # Cleanup - if os.path.exists("mkdocs-no-mayavi.yml"): - os.remove("mkdocs-no-mayavi.yml") + # Cleanup + if os.path.exists("mkdocs-no-mayavi.yml"): + os.remove("mkdocs-no-mayavi.yml") @power_session(python=PY39, logsdir=Folders.runlogs) From a9af2cb456ef5fe90c74835aec3d98a3093f40d3 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Thu, 23 Nov 2023 16:04:23 +1100 Subject: [PATCH 37/41] Fix python 3.8 test on ubuntu --- noxfile.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/noxfile.py b/noxfile.py index 766efd57..8c80d250 100644 --- a/noxfile.py +++ b/noxfile.py @@ -154,18 +154,18 @@ def tests(session: PowerSession, coverage, pkg_specs): "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) # -- use the doc generation for coverage - if sys.platform != "win32" and (version.parse(session.python) < version.parse(PY38)): - session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs.yml" + if sys.platform == "win32" or (version.parse(session.python) < version.parse(PY38)): + session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs-no-mayavi.yml" "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) else: - session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs-no-mayavi.yml" + session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs.yml" "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) # -- add a second build so that we can go through the caching/md5 side - if sys.platform != "win32" and (version.parse(session.python) < version.parse(PY38)): - session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs.yml" + if sys.platform == "win32" or (version.parse(session.python) < version.parse(PY38)): + session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs-no-mayavi.yml" "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) else: - session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs-no-mayavi.yml" + session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs.yml" "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) session.run2("coverage report") From d5fe33c360f05792dcc6a00b78da5f166379bdf4 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 5 Dec 2023 11:19:14 +1100 Subject: [PATCH 38/41] Use variable for logic about whether mayavi example should run --- noxfile.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/noxfile.py b/noxfile.py index 8c80d250..8bad8cdd 100644 --- a/noxfile.py +++ b/noxfile.py @@ -89,7 +89,8 @@ def tests(session: PowerSession, coverage, pkg_specs): # install all requirements session.install_reqs(setup=True, install=True, tests=True, versions_dct=pkg_specs) # Since our tests are currently limited, use our own doc generation as a test - if sys.platform == "win32" or (version.parse(session.python) < version.parse(PY38)): + cannot_run_mayavi = sys.platform == "win32" or (version.parse(session.python) < version.parse(PY38)) + if cannot_run_mayavi: # We are having OpenGL issues installing mayavi on Windows, skip it session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS) else: @@ -100,7 +101,7 @@ def tests(session: PowerSession, coverage, pkg_specs): with open("mkdocs.yml", "r") as f: mkdocs_config = f.readlines() # Ignore failing mayavi example where mayavi is not installed - if sys.platform == "win32" or (version.parse(session.python) < version.parse(PY38)): + if cannot_run_mayavi: with open("mkdocs-no-mayavi.yml", "w") as f: for line in mkdocs_config: if line == " expected_failing_examples:\n": @@ -130,12 +131,12 @@ def tests(session: PowerSession, coverage, pkg_specs): session.run2("python -m pytest --cache-clear -v tests/") # since our tests are too limited, we use our own mkdocs build as additional test for now. - if sys.platform == "win32" or (version.parse(session.python) < version.parse(PY38)): + if cannot_run_mayavi: session.run2("python -m mkdocs build -f mkdocs-no-mayavi.yml") else: session.run2("python -m mkdocs build -f mkdocs.yml") # -- add a second build so that we can go through the caching/md5 side - if sys.platform == "win32" or (version.parse(session.python) < version.parse(PY38)): + if cannot_run_mayavi: session.run2("python -m mkdocs build -f mkdocs-no-mayavi.yml") else: session.run2("python -m mkdocs build -f mkdocs.yml") @@ -154,14 +155,14 @@ def tests(session: PowerSession, coverage, pkg_specs): "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) # -- use the doc generation for coverage - if sys.platform == "win32" or (version.parse(session.python) < version.parse(PY38)): + if cannot_run_mayavi: session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs-no-mayavi.yml" "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) else: session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs.yml" "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) # -- add a second build so that we can go through the caching/md5 side - if sys.platform == "win32" or (version.parse(session.python) < version.parse(PY38)): + if cannot_run_mayavi: session.run2("coverage run --append --source src/{pkg_name} -m mkdocs build -f mkdocs-no-mayavi.yml" "".format(pkg_name=pkg_name, test_xml=Folders.test_xml, test_html=Folders.test_html)) else: From 5864c2bcfa74768f2772f1d597bdf80e6a51975e Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 5 Dec 2023 11:20:07 +1100 Subject: [PATCH 39/41] Use pyvista headless display action, smarie suggests it is the best option --- .github/workflows/base.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 555478db..f44cf0af 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -69,17 +69,16 @@ jobs: python-version: 3.9 architecture: x64 - # Setup Qt libraries for mayavi pyqt backend used in demo example - - name: Setup Qt libraries - uses: tlambert03/setup-qt-libs@v1 + - name: Setup headless display + uses: pyvista/setup-headless-display-action@v2 + with: + qt: true - name: Install noxfile requirements run: pip install -r noxfile-requirements.txt - name: Run nox session ${{ matrix.nox_session.session }} - uses: aganders3/headless-gui@v1 - with: - run: nox -s "${{ matrix.nox_session.session }}" + run: nox -s "${{ matrix.nox_session.session }}" # Share ./docs/reports so that they can be deployed with doc in next job - name: Share reports with other jobs From fd391366962bcb6573306d3ce71de32110e20edd Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 5 Dec 2023 11:28:01 +1100 Subject: [PATCH 40/41] Try mayavi example on windows, now we are using pyvista headless github action --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 8bad8cdd..f48c38f4 100644 --- a/noxfile.py +++ b/noxfile.py @@ -89,7 +89,7 @@ def tests(session: PowerSession, coverage, pkg_specs): # install all requirements session.install_reqs(setup=True, install=True, tests=True, versions_dct=pkg_specs) # Since our tests are currently limited, use our own doc generation as a test - cannot_run_mayavi = sys.platform == "win32" or (version.parse(session.python) < version.parse(PY38)) + cannot_run_mayavi = version.parse(session.python) < version.parse(PY38) if cannot_run_mayavi: # We are having OpenGL issues installing mayavi on Windows, skip it session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS) From 6af6e44f44ae304abd6afa5ec9c79746f3830d65 Mon Sep 17 00:00:00 2001 From: Genevieve Buckley <30920819+GenevieveBuckley@users.noreply.github.com> Date: Tue, 5 Dec 2023 11:40:02 +1100 Subject: [PATCH 41/41] Remove inaccurate comment, have fixed OpenGL problem on Windows using pyvista headless github action --- noxfile.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/noxfile.py b/noxfile.py index f48c38f4..c8f730c1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -91,10 +91,8 @@ def tests(session: PowerSession, coverage, pkg_specs): # Since our tests are currently limited, use our own doc generation as a test cannot_run_mayavi = version.parse(session.python) < version.parse(PY38) if cannot_run_mayavi: - # We are having OpenGL issues installing mayavi on Windows, skip it session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS) else: - # We are having OpenGL issues installing mayavi on Windows, skip it session.install_reqs(phase="tests", phase_reqs=MKDOCS_GALLERY_EXAMPLES_REQS+MKDOCS_GALLERY_EXAMPLES_MAYAVI_REQS) # Edit mkdocs config file