diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index c1a99595a..f1bb4ec22 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -11,7 +11,7 @@ on: - main env: - MAIN_PYTHON_VERSION: '3.9' + MAIN_PYTHON_VERSION: '3.10' PACKAGE_NAME: 'ansys-math-core' PACKAGE_NAMESPACE: 'ansys.math.core' DOCKER_PACKAGE: ghcr.io/ansys/pymapdl/mapdl @@ -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 - # 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 - name: "Run Ansys documentation building action" uses: ansys/actions/doc-build@v4 diff --git a/README.rst b/README.rst index 72c99d3cd..cfb2d0c25 100644 --- a/README.rst +++ b/README.rst @@ -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 `_ package +`PyAnsys Math GitHub `_ package with this command: .. code:: diff --git a/doc/_static/README.rst b/doc/_static/README.rst new file mode 100644 index 000000000..e69de29bb diff --git a/doc/source/conf.py b/doc/source/conf.py index 802c29321..2e9f4bee6 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -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 from sphinx_gallery.sorting import FileNameSortKey from ansys.math.core import __version__ @@ -14,15 +15,8 @@ # 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]) -except AttributeError: - # for compatibility with pyvista < 0.40 - pyvista.rcParams["window_size"] = np.array([1024, 768]) +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/") @@ -33,6 +27,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", @@ -52,6 +49,7 @@ html_logo = pyansys_logo_black html_theme = "ansys_sphinx_theme" html_short_title = html_title = "PyAnsys Math" +html_static_path = ["images/_static"] # specify the location of your github repo html_theme_options = { @@ -87,8 +85,6 @@ # Sphinx extensions extensions = [ - "jupyter_sphinx", - "notfound.extension", # for the not found page. "numpydoc", "sphinx.ext.autodoc", "sphinx.ext.autosummary", @@ -96,7 +92,7 @@ "sphinx.ext.intersphinx", "sphinx_copybutton", "sphinx_gallery.gen_gallery", - "sphinx.ext.graphviz", + "pyvista.ext.viewer_directive", ] # -- Sphinx Gallery Options --------------------------------------------------- @@ -117,7 +113,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), } diff --git a/doc/source/links.rst b/doc/source/links.rst index 3d4cb5c2c..09f25a00c 100644 --- a/doc/source/links.rst +++ b/doc/source/links.rst @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 3c361cf44..b3505be5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", @@ -53,10 +54,10 @@ doc = [ "jupyter_sphinx==0.4.0", "jupyterlab==4.0.5", "numpydoc==1.5.0", - "pandas==2.1.0", "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", diff --git a/src/ansys/math/core/math.py b/src/ansys/math/core/math.py index 379df73a1..871d90a04 100644 --- a/src/ansys/math/core/math.py +++ b/src/ansys/math/core/math.py @@ -122,6 +122,7 @@ class AnsMath: """ def __init__(self, mapdl=None, **kwargs): + """Initiate a common class for abstract math object.""" if mapdl is None: mapdl = launch_mapdl(**kwargs) @@ -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.""" if mapdl is None: mapdl = launch_mapdl() self.id = id_ @@ -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.""" AnsMathObj.__init__(self, id_, mapdl, ObjType.VEC) if init not in ["ones", "zeros", "rand", None]: @@ -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 `_, - `np.int32 `_, and `np.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 @@ -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.""" AnsMathObj.__init__(self, id_, mapdl, type_) @property @@ -1809,6 +1813,7 @@ class AnsDenseMat(AnsMat): """Provides the AnsMath dense matrix objects.""" def __init__(self, uid, mapdl): + """Initiate an AnsMath dense matrix object.""" AnsMat.__init__(self, uid, mapdl, ObjType.DMAT) def __array__(self): @@ -1827,6 +1832,7 @@ class AnsSparseMat(AnsMat): """Provides the AnsMath sparse matrix objects.""" def __init__(self, uid, mapdl): + """Initiate an AnsMath sparse matrix object.""" AnsMat.__init__(self, uid, mapdl, ObjType.SMAT) def __repr__(self):