Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: using pyvista.DynamicScraper() #163

Merged
merged 29 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5efcc9a
doc: using pyvista.DynamicScraper()
clatapie Aug 18, 2023
ffebf0d
Merge branch 'main' into doc/dynamic-examples
clatapie Aug 28, 2023
953dd19
maint: updating intersphinx_mapping
clatapie Aug 28, 2023
46d2f87
maint: updating cicd
clatapie Aug 28, 2023
e91a288
doc: adding missing docstrings
clatapie Aug 28, 2023
826d863
doc: fixing intersphinx mapping
clatapie Aug 28, 2023
b5df545
maint: printing `pip list` in CICD
clatapie Aug 29, 2023
4049511
doc: updating links
clatapie Aug 29, 2023
1796279
Update README.rst
clatapie Sep 6, 2023
2d89d0c
Update README.rst
clatapie Sep 6, 2023
f47f2cd
maint: updating pyvista
clatapie Sep 6, 2023
dffc6f4
Merge branch 'main' into doc/dynamic-examples
clatapie Sep 6, 2023
3e6e6b9
maint: remove cache
clatapie Sep 6, 2023
5e9981f
maitn: reset cache
clatapie Sep 6, 2023
aec8398
Merge branch 'main' into doc/dynamic-examples
clatapie Sep 6, 2023
611c0b6
maint: adding `image/_static` directory
clatapie Sep 6, 2023
f22bda1
maint: removing empty file
clatapie Sep 6, 2023
22f003f
maint: readding an empty file in `image/_static` directory
clatapie Sep 6, 2023
8588555
maint: using same version as pyvista
clatapie Sep 6, 2023
4f994d0
maint: move README.rst file
clatapie Sep 6, 2023
10cd12a
doc: identical version as pyvista
clatapie Sep 6, 2023
104d82c
doc: fixing dependencies
clatapie Sep 6, 2023
54af532
doc: fixing intersphinx
clatapie Sep 6, 2023
8357938
doc: trying to fix dynamic scraper
clatapie Sep 6, 2023
bbe353c
doc: update pyvista
clatapie Sep 6, 2023
462fe02
doc: fixing pyvista.DynamicScraper
clatapie Sep 6, 2023
fec2c3b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 6, 2023
6544a5c
doc: restoring window size
clatapie Sep 6, 2023
159db81
doc: cleaning the code
clatapie Sep 6, 2023
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
22 changes: 12 additions & 10 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- main

env:
MAIN_PYTHON_VERSION: '3.9'
MAIN_PYTHON_VERSION: '3.11'
clatapie marked this conversation as resolved.
Show resolved Hide resolved
clatapie marked this conversation as resolved.
Show resolved Hide resolved
PACKAGE_NAME: 'ansys-math-core'
PACKAGE_NAMESPACE: 'ansys.math.core'
DOCKER_PACKAGE: ghcr.io/ansys/pymapdl/mapdl
Expand All @@ -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_AUTOSUMMARY_CACHE: 0
RESET_EXAMPLES_CACHE: 0
RESET_DOC_BUILD_CACHE: 0
RESET_PIP_CACHE: 0
RESET_AUTOSUMMARY_CACHE: 2
RESET_EXAMPLES_CACHE: 2
RESET_DOC_BUILD_CACHE: 2
RESET_PIP_CACHE: 2

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -293,12 +293,14 @@ jobs:
- name: "Install docs build requirements"
run: |
pip install .[doc]

- name: Install VTK
run: |
pip uninstall vtk -y
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa
clatapie marked this conversation as resolved.
Show resolved Hide resolved
clatapie marked this conversation as resolved.
Show resolved Hide resolved

# If DPF server is needed, uncomment
# - name: "DPF server activation"
# run: |
# docker pull ghcr.io/ansys/dpf-core:22.2dev
# docker run -d --name dpfserver -p ${{ env.DPF_PORT }}:50052 ghcr.io/ansys/dpf-core:22.2dev && echo "DPF Server active on port ${{ env.DPF_PORT }}."
- name: List
run: pip list
clatapie marked this conversation as resolved.
Show resolved Hide resolved

- name: "Run Ansys documentation building action"
uses: ansys/actions/doc-build@v4
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Install the latest package for use with this command:
pip install ansys-math-core

Alternatively, install the latest
`PyAnsys Math GitHub <https://github.com/ansys/pyansys-math.git>`_ package
`PyAnsys Math GitHub <https://github.com/ansys/pyansys-math>`_ package
clatapie marked this conversation as resolved.
Show resolved Hide resolved
clatapie marked this conversation as resolved.
Show resolved Hide resolved
with this command:

.. code::
Expand Down
Empty file added doc/_static/README.rst
Empty file.
21 changes: 11 additions & 10 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,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
clatapie marked this conversation as resolved.
Show resolved Hide resolved
clatapie marked this conversation as resolved.
Show resolved Hide resolved
from sphinx_gallery.sorting import FileNameSortKey

from ansys.math.core import __version__
Expand All @@ -14,16 +15,14 @@
# Manage errors
pyvista.set_error_output_file("errors.txt")

# Ensure that offscreen rendering is used for docs generation
pyvista.OFF_SCREEN = True

# must be less than or equal to the XVFB window size
try:
pyvista.global_theme.window_size = np.array([1024, 768])
pyvista.global_theme.window_size = np.array([1024, 768]) * 2
except AttributeError:
# for compatibility with pyvista < 0.40
pyvista.rcParams["window_size"] = np.array([1024, 768])
pyvista.rcParams["window_size"] = np.array([1024, 768]) * 2
clatapie marked this conversation as resolved.
Show resolved Hide resolved

pyvista.set_plot_theme("document")
clatapie marked this conversation as resolved.
Show resolved Hide resolved
clatapie marked this conversation as resolved.
Show resolved Hide resolved
# 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):
Expand All @@ -33,6 +32,9 @@
pyvista.BUILDING_GALLERY = True
pymath.BUILDING_GALLERY = True

# Ensure that offscreen rendering is used for docs generation
pyvista.OFF_SCREEN = True

# suppress annoying matplotlib bug
warnings.filterwarnings(
"ignore",
Expand All @@ -52,6 +54,7 @@
html_logo = pyansys_logo_black
html_theme = "ansys_sphinx_theme"
html_short_title = html_title = "PyAnsys Math"
html_static_path = ["images/_static"]
clatapie marked this conversation as resolved.
Show resolved Hide resolved
clatapie marked this conversation as resolved.
Show resolved Hide resolved

# specify the location of your github repo
html_theme_options = {
Expand Down Expand Up @@ -87,16 +90,14 @@

# Sphinx extensions
extensions = [
"jupyter_sphinx",
"notfound.extension", # for the not found page.
"numpydoc",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.coverage",
"sphinx.ext.intersphinx",
"sphinx_copybutton",
"sphinx_gallery.gen_gallery",
"sphinx.ext.graphviz",
"pyvista.ext.viewer_directive",
clatapie marked this conversation as resolved.
Show resolved Hide resolved
clatapie marked this conversation as resolved.
Show resolved Hide resolved
]

# -- Sphinx Gallery Options ---------------------------------------------------
Expand All @@ -117,8 +118,8 @@
"backreferences_dir": None,
# Modules for which function level galleries are created. In
"doc_module": "ansys-math-core",
"image_scrapers": ("pyvista", "matplotlib"),
"ignore_pattern": "flycheck*",
"image_scrapers": (DynamicScraper(), "matplotlib"),
clatapie marked this conversation as resolved.
Show resolved Hide resolved
clatapie marked this conversation as resolved.
Show resolved Hide resolved
"ignore_pattern": r"__init__\.py",
"thumbnail_size": (350, 350),
}

Expand Down
2 changes: 1 addition & 1 deletion doc/source/links.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.. _pymath_docs: https://math.docs.pyansys.com/
.. _pymath_dev_docs: https://math.docs.pyansys.com/dev/
.. _pymath_issues: https://github.com/ansys/pyansys-math/issues
.. _pymath_github: https://github.com/ansys/pyansys-math.git
.. _pymath_github: https://github.com/ansys/pyansys-math

.. #MAPDL related
.. _mapdl_tech_show: https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v222/en/wb_wbtec/wb_wbtec.html
Expand Down
2 changes: 2 additions & 0 deletions examples/ansys-math_vs_scipy.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@

mm._mapdl.eplot()

# %%


###############################################################################
# Set up modal analysis
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies = [
[project.optional-dependencies]
tests = [
"ansys-mapdl-core==0.65.2",
"numpy==1.25.2",
"scipy==1.11.2",
"pyansys-tools-report==0.6.0",
"pytest==7.4.0",
Expand All @@ -53,16 +54,17 @@ doc = [
"jupyter_sphinx==0.4.0",
"jupyterlab==4.0.5",
"numpydoc==1.5.0",
"pandas==2.1.0",
germa89 marked this conversation as resolved.
Show resolved Hide resolved
"pypandoc==1.11",
"pytest-sphinx==0.5.0",
"pyvista==0.42.0",
"pyvista[jupyter,trame]==0.42.0",
"scipy==1.11.2",
"sphinx-autobuild==2021.3.14",
"sphinx-autodoc-typehints==1.24.0",
"sphinx-copybutton==0.5.2",
"sphinx-notfound-page==0.8.3",
"sphinx-gallery==0.14.0",
"trame==3.2.4",
"typed-ast==1.5.5",
clatapie marked this conversation as resolved.
Show resolved Hide resolved
clatapie marked this conversation as resolved.
Show resolved Hide resolved
"vtk==9.2.6",
]

Expand Down
10 changes: 8 additions & 2 deletions src/ansys/math/core/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class AnsMath:
"""

def __init__(self, mapdl=None, **kwargs):
"""Initiate a common class for abstract math object."""
clatapie marked this conversation as resolved.
Show resolved Hide resolved
clatapie marked this conversation as resolved.
Show resolved Hide resolved
if mapdl is None:
mapdl = launch_mapdl(**kwargs)

Expand Down Expand Up @@ -1274,6 +1275,7 @@ class AnsMathObj:
"""Provides the common class for AnsMath objects."""

def __init__(self, id_, mapdl=None, dtype=ObjType.GEN):
"""Initiate a common class for AnsMath objects."""
clatapie marked this conversation as resolved.
Show resolved Hide resolved
clatapie marked this conversation as resolved.
Show resolved Hide resolved
if mapdl is None:
mapdl = launch_mapdl()
self.id = id_
Expand Down Expand Up @@ -1495,6 +1497,7 @@ class AnsVec(AnsMathObj):
"""Provides the AnsMath vector objects."""

def __init__(self, id_, mapdl, dtype=np.double, init=None):
"""Initiate an AnsMath vector object."""
clatapie marked this conversation as resolved.
Show resolved Hide resolved
clatapie marked this conversation as resolved.
Show resolved Hide resolved
AnsMathObj.__init__(self, id_, mapdl, ObjType.VEC)

if init not in ["ones", "zeros", "rand", None]:
Expand Down Expand Up @@ -1609,8 +1612,8 @@ def asarray(self, dtype=None) -> np.ndarray:
Parameters
----------
dtype : numpy.dtype, optional
NumPy data type to upload the array as. The options are `np.double <numpy.double>`_,
`np.int32 <numpy.int32>`_, and `np.int64 <numpy.int64>`_. The default is the current
NumPy data type to upload the array as. The options are :class:`numpy.double`,
:class:`numpy.int32`, and :class:`numpy.int64`. The default is the current
array type.

Returns
Expand Down Expand Up @@ -1641,6 +1644,7 @@ class AnsMat(AnsMathObj):
"""Provides the AnsMath matrix objects."""

def __init__(self, id_, mapdl, type_=ObjType.DMAT):
"""Initiate an AnsMath matrix object."""
clatapie marked this conversation as resolved.
Show resolved Hide resolved
clatapie marked this conversation as resolved.
Show resolved Hide resolved
AnsMathObj.__init__(self, id_, mapdl, type_)

@property
Expand Down Expand Up @@ -1809,6 +1813,7 @@ class AnsDenseMat(AnsMat):
"""Provides the AnsMath dense matrix objects."""

def __init__(self, uid, mapdl):
"""Initiate an AnsMath dense matrix object."""
clatapie marked this conversation as resolved.
Show resolved Hide resolved
clatapie marked this conversation as resolved.
Show resolved Hide resolved
AnsMat.__init__(self, uid, mapdl, ObjType.DMAT)

def __array__(self):
Expand All @@ -1827,6 +1832,7 @@ class AnsSparseMat(AnsMat):
"""Provides the AnsMath sparse matrix objects."""

def __init__(self, uid, mapdl):
"""Initiate an AnsMath sparse matrix object."""
clatapie marked this conversation as resolved.
Show resolved Hide resolved
clatapie marked this conversation as resolved.
Show resolved Hide resolved
AnsMat.__init__(self, uid, mapdl, ObjType.SMAT)

def __repr__(self):
Expand Down
Loading