Skip to content

Commit

Permalink
Fixing DynamicScrapper (#198)
Browse files Browse the repository at this point in the history
Co-authored-by: Roberto Pastor Muela <[email protected]>
  • Loading branch information
clatapie and RobPasMue authored Feb 21, 2024
1 parent 6eaad89 commit 4d8b232
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 40 deletions.
61 changes: 27 additions & 34 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ env:
PYMAPDL_START_INSTANCE: FALSE
PYMAPDL_PORT: 21000 # default won't work on GitHub runners
PYMAPDL_DB_PORT: 21001 # default won't work on GitHub runners
RESET_PIP_CACHE: 0
RESET_AUTOSUMMARY_CACHE: 0
RESET_EXAMPLES_CACHE: 0
RESET_DOC_BUILD_CACHE: 0
RESET_PIP_CACHE: 0

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -45,14 +45,14 @@ jobs:
name: "Documentation Style Check"
runs-on: ubuntu-latest
steps:
- name: PyAnsys documentation style checks
- name: "PyAnsys documentation style checks"
uses: ansys/actions/doc-style@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}


smoke-tests:
name: Build and Smoke tests
name: "Build and Smoke tests"
runs-on: ${{ matrix.os }}
needs: [code-style]
strategy:
Expand All @@ -69,7 +69,7 @@ jobs:
- should-release: false
os: windows-latest
steps:
- name: Build wheelhouse and perform smoke test
- name: "Build wheelhouse and perform smoke test"
uses: ansys/actions/build-wheelhouse@v5
with:
library-name: ${{ env.PACKAGE_NAME }}
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
restore-keys: |
Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.mapdl-version }}
- name: Install ansys-mapdl-core
- name: "Install ansys-mapdl-core"
run: |
python -m pip install ansys-mapdl-core
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
name: ${{ matrix.mapdl-version }}-remote.xml
flags: remote,${{ matrix.mapdl-version }}

- name: Upload coverage artifacts
- name: "Upload coverage artifacts"
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.mapdl-version }}-remote.xml
Expand Down Expand Up @@ -214,15 +214,16 @@ jobs:
doc-build:
name: Doc building
name: "Doc building"
runs-on: ubuntu-latest
needs: [doc-style]
outputs:
ANSYSMATH_VERSION: ${{ steps.version.outputs.ANSYSMATH_VERSION }}
env:
PYMAPDL_PORT: 21000 # default won't work on GitHub runners
PYMAPDL_DB_PORT: 21001 # default won't work on GitHub runners
PYMAPDL_START_INSTANCE: FALSE
steps:
# This checkout is repeated later at the 'doc-build' action. This could be avoided by copything the sh file here, but introduces some code duplicity.
- name: "Install Git and checkout project"
uses: actions/checkout@v4

Expand All @@ -231,11 +232,6 @@ jobs:
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: "Install OS packages"
run: |
sudo apt update
sudo apt install pandoc
- name: "Cache pip"
uses: actions/cache@v4
with:
Expand All @@ -244,9 +240,9 @@ jobs:
restore-keys: |
Python-v${{ env.RESET_PIP_CACHE }}-Linux-${{ env.MAIN_PYTHON_VERSION }}
- name: "Install ansys-math-core"
- name: "Install ansys-math-core and documentation requirements"
run: |
pip install .
pip install .[doc]
- name: "Login in Github container registry"
uses: docker/[email protected]
Expand All @@ -262,57 +258,54 @@ jobs:
MAPDL_IMAGE: '${{ env.DOCKER_PACKAGE }}:${{ env.DOCKER_IMAGE_VERSION_DOCS_BUILD }}'

- name: "Retrieve AnsysMath version"
id: version
run: |
echo "ANSYSMATH_VERSION=$(python -c 'from ansys.math.core import __version__; print(__version__)')" >> $GITHUB_ENV
echo "ANSYSMATH_VERSION=$(python -c 'from ansys.math.core import __version__; print(__version__)')" >> $GITHUB_OUTPUT
echo "AnsysMath version is: $(python -c "from ansys.math.core import __version__; print(__version__)")"
- name: "Cache examples"
uses: actions/cache@v4
with:
path: doc/source/examples
key: Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ env.ANSYSMATH_VERSION }}-${{ github.sha }}
key: Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.ANSYSMATH_VERSION }}-${{ github.sha }}
restore-keys: |
Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ env.ANSYSMATH_VERSION }}
Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.ANSYSMATH_VERSION }}
- name: "Cache docs build directory"
uses: actions/cache@v4
with:
path: doc/_build
key: doc-build-v${{ env.RESET_DOC_BUILD_CACHE }}-${{ env.ANSYSMATH_VERSION }}-${{ github.sha }}
key: doc-build-v${{ env.RESET_DOC_BUILD_CACHE }}-${{ steps.version.outputs.ANSYSMATH_VERSION }}-${{ github.sha }}
restore-keys: |
doc-build-v${{ env.RESET_DOC_BUILD_CACHE }}-${{ env.ANSYSMATH_VERSION }}
doc-build-v${{ env.RESET_DOC_BUILD_CACHE }}-${{ steps.version.outputs.ANSYSMATH_VERSION }}
- name: "Cache autosummary"
uses: actions/cache@v4
with:
path: doc/source/**/_autosummary/*.rst
key: autosummary-v${{ env.RESET_AUTOSUMMARY_CACHE }}-${{ env.ANSYSMATH_VERSION }}-${{ github.sha }}
key: autosummary-v${{ env.RESET_AUTOSUMMARY_CACHE }}-${{ steps.version.outputs.ANSYSMATH_VERSION }}-${{ github.sha }}
restore-keys: |
autosummary-v${{ env.RESET_AUTOSUMMARY_CACHE }}-${{ env.ANSYSMATH_VERSION }}
- name: "Install docs build requirements"
run: |
pip install .[doc]
- name: List
run: pip list
autosummary-v${{ env.RESET_AUTOSUMMARY_CACHE }}-${{ steps.version.outputs.ANSYSMATH_VERSION }}
- name: "Run Ansys documentation building action"
uses: ansys/actions/doc-build@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
checkout: false
skip-install: true
sphinxopts: -j auto
checkout: false
sphinxopts: -j auto --keep-going
requires-xvfb: true
skip-json-build: true
dependencies: pandoc


package:
name: Package library
name: "Package library"
needs: [doc-build, build-test]
runs-on: ubuntu-latest
steps:
- name: Build library source and wheel artifacts
- name: "Build library source and wheel artifacts"
uses: ansys/actions/build-library@v5
with:
library-name: ${{ env.PACKAGE_NAME }}
Expand Down
File renamed without changes.
Empty file removed doc/source/_static/README.rst
Empty file.
9 changes: 3 additions & 6 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from ansys_sphinx_theme import ansys_favicon, get_version_match, pyansys_logo_black
import numpy as np
import pyvista
from pyvista.plotting.utilities.sphinx_gallery import DynamicScraper
from sphinx_gallery.sorting import FileNameSortKey

from ansys.math.core import __version__
Expand All @@ -18,11 +19,6 @@
# must be less than or equal to the XVFB window size
pyvista.global_theme.window_size = np.array([1024, 768])

# Save figures in specified directory
pyvista.FIGURE_PATH = os.path.join(os.path.abspath("./images/"), "auto-generated/")
if not os.path.exists(pyvista.FIGURE_PATH):
os.makedirs(pyvista.FIGURE_PATH)

# necessary when building the sphinx gallery
pyvista.BUILDING_GALLERY = True
pymath.BUILDING_GALLERY = True
Expand Down Expand Up @@ -92,6 +88,7 @@
"sphinx.ext.coverage",
"sphinx.ext.intersphinx",
"sphinx_copybutton",
"sphinx_design",
"sphinx_gallery.gen_gallery",
"pyvista.ext.viewer_directive",
]
Expand All @@ -114,7 +111,7 @@
"backreferences_dir": None,
# Modules for which function level galleries are created. In
"doc_module": "ansys-math-core",
"image_scrapers": ("pyvista", "matplotlib"),
"image_scrapers": (DynamicScraper(), "matplotlib"),
"ignore_pattern": "flycheck*",
"thumbnail_size": (350, 350),
}
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ doc = [
"sphinx-autobuild==2024.2.4",
"sphinx-autodoc-typehints==2.0.0",
"sphinx-copybutton==0.5.2",
"sphinx-design==0.5.0",
"sphinx-notfound-page==1.0.0",
"sphinx-gallery==0.15.0",
"trame==3.5.2",
Expand Down

0 comments on commit 4d8b232

Please sign in to comment.