diff --git a/.gitignore b/.gitignore index ee27c203f2..5c70031396 100755 --- a/.gitignore +++ b/.gitignore @@ -101,3 +101,7 @@ doc/source/sg_execution_times.rst *prin-stresses.html doc/webserver.log doc/webserver.pid + + +# Ignore any distributions directory to prevent accidental publications +distributions/ \ No newline at end of file diff --git a/doc/changelog.d/3164.fixed.md b/doc/changelog.d/3164.fixed.md new file mode 100644 index 0000000000..b0416fea98 --- /dev/null +++ b/doc/changelog.d/3164.fixed.md @@ -0,0 +1 @@ +fix: Update the tox.ini to different tox env \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py index e1364dc2f9..f687f51823 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -91,9 +91,9 @@ "sphinx.ext.extlinks", "sphinx.ext.intersphinx", "sphinx_autodoc_typehints", + "sphinx_jinja", "sphinx_design", "sphinx_copybutton", - "sphinx_gallery.gen_gallery", "sphinxemoji.sphinxemoji", "sphinx.ext.graphviz", "ansys_sphinx_theme.extension.linkcode", @@ -114,7 +114,7 @@ "ansys-tools-path": ("https://path.tools.docs.pyansys.com/version/stable/", None), } -suppress_warnings = ["label.*", "design.fa-build", "config.cache"] +suppress_warnings = ["label.*", "design.fa-build", "config.cache", "design.grid"] sd_fontawesome_latex = True # Graphviz diagrams configuration @@ -192,6 +192,49 @@ "substitutions.rst", ] +BUILD_API = True if os.environ.get("BUILD_API", "true") == "true" else False +if not BUILD_API: + exclude_patterns.extend(["api/**", "mapdl_commands/**"]) + +BUILD_EXAMPLES = True if os.environ.get("BUILD_EXAMPLES", "true") == "true" else False +if not BUILD_EXAMPLES: + exclude_patterns.extend(["examples/index.rst", "examples/**", "examples/**/**"]) + suppress_warnings.append("ref.*") +else: + extensions.append("sphinx_gallery.gen_gallery") + # -- Sphinx Gallery Options --------------------------------------------------- + sphinx_gallery_conf = { + # convert rst to md for ipynb + "pypandoc": True, + # path to your examples scripts + "examples_dirs": [EXAMPLES_PATH_FOR_DOCS], + # path where to save gallery generated examples + "gallery_dirs": [GALLERY_EXAMPLES_PATH], + # Pattern to search for example files + "filename_pattern": r"\." + DEFAULT_EXAMPLE_EXTENSION, + # Remove the "Download all examples" button from the top level gallery + "download_all_examples": False, + # Sort gallery example by file name instead of number of lines (default) + "within_subsection_order": FileNameSortKey, + # directory where function granular galleries are stored + "backreferences_dir": None, + # Modules for which function level galleries are created. In + "doc_module": "ansys-mapdl-core", + "image_scrapers": ("pyvista", "matplotlib"), + "ignore_pattern": "flycheck*", + "thumbnail_size": (350, 350), + "remove_config_comments": True, + "default_thumb_file": pyansys_light_mode_logo, + "show_signature": False, + } + +jinja_contexts = { + "main_toctree": { + "build_api": BUILD_API, + "build_examples": BUILD_EXAMPLES, + }, +} + # make rst_epilog a variable, so you can add other epilog parts to it rst_epilog = "" @@ -207,6 +250,7 @@ with open("substitutions.rst") as f: rst_epilog += f.read() + # Broken anchors: linkcheck_exclude_documents = ["index"] linkcheck_anchors_ignore_for_url = ["https://docs.pyvista.org/api/*"] @@ -246,34 +290,6 @@ copybutton_prompt_text = r">>> ?|\.\.\. " copybutton_prompt_is_regexp = True -# -- Sphinx Gallery Options --------------------------------------------------- -sphinx_gallery_conf = { - # convert rst to md for ipynb - "pypandoc": True, - # path to your examples scripts - "examples_dirs": [EXAMPLES_PATH_FOR_DOCS], - # path where to save gallery generated examples - "gallery_dirs": [GALLERY_EXAMPLES_PATH], - # Pattern to search for example files - "filename_pattern": r"\." + DEFAULT_EXAMPLE_EXTENSION, - # Remove the "Download all examples" button from the top level gallery - "download_all_examples": False, - # Sort gallery example by file name instead of number of lines (default) - "within_subsection_order": FileNameSortKey, - # directory where function granular galleries are stored - "backreferences_dir": None, - # Modules for which function level galleries are created. In - "doc_module": "ansys-mapdl-core", - "image_scrapers": ("pyvista", "matplotlib"), - "ignore_pattern": "flycheck*", - "thumbnail_size": (350, 350), - "remove_config_comments": True, - "default_thumb_file": pyansys_light_mode_logo, - "show_signature": False, -} -# --- - - # -- Options for HTML output ------------------------------------------------- html_short_title = html_title = "PyMAPDL" html_theme = "ansys_sphinx_theme" diff --git a/doc/source/getting_started/devcontainer.rst b/doc/source/getting_started/devcontainer.rst index 0c5e8d416e..1f238ac961 100644 --- a/doc/source/getting_started/devcontainer.rst +++ b/doc/source/getting_started/devcontainer.rst @@ -67,7 +67,7 @@ Develop on a remote container The Docker image listed in the `repository development container configuration files `_ is not for public use due to licensing issues. - However, you can `create your own Docker image ` + However, you can `create your own Docker image `_ and use this file as a template for setting your own local development container. To use a `remote container `_, you must install this software: diff --git a/doc/source/index.rst b/doc/source/index.rst index e84487c86b..24176cfcc2 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -5,18 +5,22 @@ .. meta:: :keywords: pymapdl mapdl simulation finite elements python - -.. toctree:: - :hidden: - :maxdepth: 3 - - getting_started/index - user_guide/index - mapdl_commands/index - api/index - examples/index - changelog - +.. jinja:: main_toctree + + .. toctree:: + :hidden: + :maxdepth: 3 + + getting_started/index + user_guide/index + {% if build_api %} + mapdl_commands/index + api/index + {% endif %} + {% if build_examples %} + examples/index + {% endif %} + changelog .. image:: ../source/_static/logo_dark.png :class: only-dark @@ -41,80 +45,77 @@ .. vale on .. grid:: 3 + :gutter: 2 2 3 4 + :margin: 2 2 3 4 - .. grid-item:: - .. card:: :fa:`newspaper` Know what is PyMAPDL - :link: ref_project_page - :link-type: ref + .. grid-item-card:: :fa:`newspaper` Know what is PyMAPDL + :link: ref_project_page + :link-type: ref - Check our project page :ref:`ref_project_page` - where a quick project overview can be found. - Learn what this project is about! + Check our project page :ref:`ref_project_page` + where a quick project overview can be found. + Learn what this project is about! - .. grid-item:: - .. card:: :fa:`book` Learn how to use PyMAPDL - :link: ref_learning - :link-type: ref + .. grid-item-card:: :fa:`book` Learn how to use PyMAPDL + :link: ref_learning + :link-type: ref - Check our :ref:`ref_learning` section. - It is recommended you follow the - :ref:`ref_pymapdl_course` course. + Check our :ref:`ref_learning` section. + It is recommended you follow the + :ref:`ref_pymapdl_course` course. - .. grid-item:: - .. card:: :fa:`terminal` Learn how to get started - :link: ref_getting_started - :link-type: ref + .. grid-item-card:: :fa:`terminal` Learn how to get started + :link: ref_getting_started + :link-type: ref - Check our :ref:`ref_getting_started` section to learn to - :ref:`ref_using_standard_install`, :ref:`ref_pymapdl_installation`, - and :ref:`ref_launch_pymapdl`. + Check our :ref:`ref_getting_started` section to learn to + :ref:`ref_using_standard_install`, :ref:`ref_pymapdl_installation`, + and :ref:`ref_launch_pymapdl`. - .. grid-item:: - .. card:: :fa:`gears` See some PyMAPDL usage examples + .. jinja:: main_toctree + + {% if build_examples %} + .. grid-item-card:: :fa:`gears` See some PyMAPDL usage examples :link: ref_examples :link-type: ref In our :ref:`ref_examples` section, you can find a great collection of PyMAPDL user cases. + {% endif %} - .. grid-item:: - .. card:: :fa:`book-open-reader` Use the different library modules - :link: ref_user_guide - :link-type: ref + .. grid-item-card:: :fa:`book-open-reader` Use the different library modules + :link: ref_user_guide + :link-type: ref - Check our :ref:`ref_user_guide` chapter. - Don't miss the right side bar with the table content. + Check our :ref:`ref_user_guide` chapter. + Don't miss the right side bar with the table content. - .. grid-item:: - .. card:: :fa:`question` Help with PyMAPDL - :link: ref_troubleshooting - :link-type: ref + .. grid-item-card:: :fa:`question` Help with PyMAPDL + :link: ref_troubleshooting + :link-type: ref - Check our :ref:`ref_troubleshooting` section. - Additionally, there are some helpful - resources in :ref:`faq`. + Check our :ref:`ref_troubleshooting` section. + Additionally, there are some helpful + resources in :ref:`faq`. - .. grid-item:: - .. card:: :fa:`users` Contribute to PyMAPDL project - :link: ref_contributing - :link-type: ref + .. grid-item-card:: :fa:`users` Contribute to PyMAPDL project + :link: ref_contributing + :link-type: ref - Great!! Check our :ref:`ref_contributing` - section to start contribute. + Great!! Check our :ref:`ref_contributing` + section to start contribute. - .. grid-item:: - .. card:: :fa:`user-pen` Document or create an example for PyMAPDL - :link: write_documentation - :link-type: ref + .. grid-item-card:: :fa:`user-pen` Document or create an example for PyMAPDL + :link: write_documentation + :link-type: ref - Check our :ref:`write_documentation` section. + Check our :ref:`write_documentation` section. - .. grid-item:: - .. card:: :fa:`keyboard` Develop PyMAPDL - :link: developing_pymapdl - :link-type: ref + .. grid-item-card:: :fa:`keyboard` Develop PyMAPDL + :link: developing_pymapdl + :link-type: ref - Check our :ref:`developing_pymapdl` section - to get guidance about setting - the project for development. + Check our :ref:`developing_pymapdl` section + to get guidance about setting + the project for development. diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index a756c98f0b..0000000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,98 +0,0 @@ -FROM ubuntu:22.04 - -ARG VERSION -ARG MAPDL_PATH -ARG USERNAME=mapdl -ARG USER_UID=1000 -ARG USER_GID=$USER_UID - -# Storing version in a env var -ENV ANSYS_VERSION=$VERSION - -# Location env var -# This var needs to be updated when version changes. -ENV AWP_ROOT222=/ansys_inc - - -# LABELS -LABEL description="MAPDL on Ubuntu" -LABEL email="pyansys.core@ansys.com" - -# OCI LABELS -LABEL org.opencontainers.image.documentation="https://mapdl.docs.pyansys.com" - -# Update packages before packing and -# installing dependencies -RUN apt-get update && \ - apt-get install -y \ - sudo \ - git \ - python3.10-venv \ - openssh-client \ - libgl1 \ - libglu1 \ - libxm4 \ - libxi6 - -# libxp.so missing. This is a workaround -#https://bugs.launchpad.net/ubuntu/+source/libxp/+bug/1517884 -RUN apt install -y software-properties-common \ - && add-apt-repository -y ppa:zeehio/libxp \ - && apt-get update \ - && apt-get install -y libxp6 - - -# Create the user -RUN groupadd --gid $USER_GID $USERNAME \ - && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME - - -# Copying files -RUN mkdir -p /ansys_inc -COPY $MAPDL_PATH /ansys_inc - -# Cleaning -RUN rm -rf .dockerignore \ - && rm -rf Dockerfile \ - && rm -rf *.log - - -# Setting working directory -ENV WORKING_DIRECTORY=/jobs - -# Setting home directory -ENV HOME=/home/$USERNAME - -# License server -# (Optional) -# ENV LICENSE_SERVER=111.222.333.444 -# ENV ANSYSLMD_LICENSE_FILE=1055@$LICENSE_SERVER - -# Add a working directory and make it accessible to any user -RUN mkdir -p /home/$USERNAME/$WORKING_DIRECTORY \ - && \ - chown -R $USERNAME:$USERNAME /home/$USERNAME/$WORKING_DIRECTORY \ - && \ - chmod a+rwx /home/$USERNAME/$WORKING_DIRECTORY - -# Setting other env vars -## For MAPDL awareness -ENV ON_DOCKER=TRUE - -ENV OMPI_ALLOW_RUN_AS_ROOT=1 -ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 - -# Adding alias to ansys executable -RUN printf '#!/bin/bash\n/ansys_inc/v$ANSYS_VERSION/ansys/bin/mapdl "$@"' > /usr/bin/ansys && \ - chmod +x /usr/bin/ansys -RUN printf '#!/bin/bash\n/ansys_inc/v$ANSYS_VERSION/ansys/bin/mapdl -grpc "$@"' > /usr/bin/ansysgrpc && \ - chmod +x /usr/bin/ansysgrpc - -# Setting user -USER $USERNAME -WORKDIR /home/$USERNAME/$WORKING_DIRECTORY - -# Setting entrypoint -EXPOSE 50052 -ENTRYPOINT [ "bash", "-c", "/ansys_inc/v${ANSYS_VERSION}/ansys/bin/mapdl -grpc -dir ${WORKING_DIRECTORY}"] - diff --git a/docker/.dockerignore b/docker/linux/.dockerignore similarity index 92% rename from docker/.dockerignore rename to docker/linux/.dockerignore index 801a0c3889..237edf8db4 100644 --- a/docker/.dockerignore +++ b/docker/linux/.dockerignore @@ -20,18 +20,18 @@ **/aisol/lib/linx64/libaddress_sorting.so **/aisol/lib/linx64/libans.autodyn.adbatch.so **/aisol/lib/linx64/libans.autodyn.results_api.so -**/aisol/lib/linx64/libans.cadint.assemblycontainer231.so -**/aisol/lib/linx64/libans.cadint.assemblycontainerdrawing231.so -**/aisol/lib/linx64/libans.cadint.assemblycontainerdrawingold231.so -**/aisol/lib/linx64/libans.cadint.assemblycontainerserializer231.so -**/aisol/lib/linx64/libans.cadint.assemblycontainertesselation231.so -**/aisol/lib/linx64/libans.cadint.assemblycontainervirtualhelper231.so +**/aisol/lib/linx64/libans.cadint.assemblycontainer241.so +**/aisol/lib/linx64/libans.cadint.assemblycontainerdrawing241.so +**/aisol/lib/linx64/libans.cadint.assemblycontainerdrawingold241.so +**/aisol/lib/linx64/libans.cadint.assemblycontainerserializer241.so +**/aisol/lib/linx64/libans.cadint.assemblycontainertesselation241.so +**/aisol/lib/linx64/libans.cadint.assemblycontainervirtualhelper241.so **/aisol/lib/linx64/libans.cadint.autovt.so -**/aisol/lib/linx64/libans.cadint.brepcomponent231.so -**/aisol/lib/linx64/libans.cadint.brepcomponentmeshinghelper231.so -**/aisol/lib/linx64/libans.cadint.brepcomponenttesselation231.so -**/aisol/lib/linx64/libans.cadint.brepgeometry231.so -**/aisol/lib/linx64/libans.cadint.brepserializer231.so +**/aisol/lib/linx64/libans.cadint.brepcomponent241.so +**/aisol/lib/linx64/libans.cadint.brepcomponentmeshinghelper241.so +**/aisol/lib/linx64/libans.cadint.brepcomponenttesselation241.so +**/aisol/lib/linx64/libans.cadint.brepgeometry241.so +**/aisol/lib/linx64/libans.cadint.brepserializer241.so **/aisol/lib/linx64/libans.cadint.virtualtopo.so **/aisol/lib/linx64/libans.modelmanager.core.so **/aisol/lib/linx64/libans.modelmanager.engine.pm.so @@ -151,32 +151,32 @@ **/aisol/StartPage **/aisol/WBAddins **/aisol/WBMWRegistry -**/ans_uninstall231 +**/ans_uninstall241 **/ansys/bin/.change_ansysdir2022r2 -**/ansys/bin/.change_ansysdir231 +**/ansys/bin/.change_ansysdir241 **/ansys/bin/about.admin **/ansys/bin/ans_admin -**/ansys/bin/ans_admin231 +**/ansys/bin/ans_admin241 **/ansys/bin/ansconnect -**/ansys/bin/ansconnect231 +**/ansys/bin/ansconnect241 **/ansys/bin/anshelp -**/ansys/bin/anshelp231 +**/ansys/bin/anshelp241 **/ansys/bin/ansslurm -**/ansys/bin/ansslurm231 +**/ansys/bin/ansslurm241 **/ansys/bin/anstclsh -**/ansys/bin/anstclsh231 +**/ansys/bin/anstclsh241 **/ansys/bin/ansuge -**/ansys/bin/ansuge231 +**/ansys/bin/ansuge241 **/ansys/bin/answish -**/ansys/bin/answish231 +**/ansys/bin/answish241 **/ansys/bin/ansysts -**/ansys/bin/ansysts231 +**/ansys/bin/ansysts241 **/ansys/bin/bintst -**/ansys/bin/bintst231 +**/ansys/bin/bintst241 **/ansys/bin/launcher -**/ansys/bin/launcher231 +**/ansys/bin/launcher241 **/ansys/bin/launchertcl -**/ansys/bin/launchertcl231 +**/ansys/bin/launchertcl241 **/ansys/bin/linx64/.ansys_installed **/ansys/bin/linx64/lsdyna_dp.e **/ansys/bin/linx64/lsdyna_dp_mpp.e @@ -185,27 +185,27 @@ **/ansys/bin/linx64/lsl2a.e **/ansys/bin/linx64/lsl2a_dp.e **/ansys/bin/lsdyna -**/ansys/bin/lsdyna231 +**/ansys/bin/lsdyna241 **/ansys/bin/lsl2a -**/ansys/bin/lsl2a231 +**/ansys/bin/lsl2a241 **/ansys/bin/lsrun -**/ansys/bin/lsrun231 +**/ansys/bin/lsrun241 **/ansys/bin/nlhist -**/ansys/bin/nlhist231 +**/ansys/bin/nlhist241 **/ansys/bin/rdresu -**/ansys/bin/rdresu231 +**/ansys/bin/rdresu241 **/ansys/bin/rdsubs -**/ansys/bin/rdsubs231 +**/ansys/bin/rdsubs241 **/ansys/bin/ResRdDemo -**/ansys/bin/ResRdDemo231 +**/ansys/bin/ResRdDemo241 **/ansys/bin/ResWrDemo -**/ansys/bin/ResWrDemo231 +**/ansys/bin/ResWrDemo241 **/ansys/bin/userprog -**/ansys/bin/userprog231 +**/ansys/bin/userprog241 **/ansys/bin/wrtres -**/ansys/bin/wrtres231 +**/ansys/bin/wrtres241 **/ansys/bin/wrtsub -**/ansys/bin/wrtsub231 +**/ansys/bin/wrtsub241 **/ansys/bin/xansadmin.tcl **/ansys/data **/ansys/docu/ansadmin.hlp diff --git a/docker/linux/Dockerfile b/docker/linux/Dockerfile new file mode 100644 index 0000000000..941b2d9582 --- /dev/null +++ b/docker/linux/Dockerfile @@ -0,0 +1,106 @@ +# Use Ubuntu 22.04 as the base image +FROM ubuntu:22.04 + +# Set environment variables +ARG VERSION +ARG USERNAME=mapdl +ARG USER_UID=1000 +ARG LICENSE_SERVER + +ENV USER_GID=$USER_UID +ENV ANSYS_VERSION=$VERSION +ENV LICENSE_SERVER=$LICENSE_SERVER +ENV AWP_ROOT241=/ansys_inc +ENV WORKING_DIRECTORY=/jobs +ENV HOME=/home/$USERNAME +ENV ON_DOCKER=TRUE +ENV OMPI_ALLOW_RUN_AS_ROOT=1 +ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 + +# Update package list +RUN apt-get update + +# Install necessary packages +RUN apt-get install -y \ + libbrotli1 \ + libbsd0 \ + libexpat1 \ + libfontconfig1 \ + libfreetype6 \ + libglib2.0-0 \ + libice6 \ + libmd0 \ + libpng16-16 \ + libsm6 \ + libx11-6 \ + libx11-xcb1 \ + libxau6 \ + libxcb-icccm4 \ + libxcb-image0 \ + libxcb-keysyms1 \ + libxcb-randr0 \ + libxcb-render-util0 \ + libxcb-render0 \ + libxcb-shape0 \ + libxcb-shm0 \ + libxcb-sync1 \ + libxcb-util1 \ + libxcb-xfixes0 \ + libxcb-xinerama0 \ + libxcb-xkb1 \ + libxcb1 \ + libxdmcp6 \ + libxext6 \ + libxkbcommon-x11-0 \ + libxkbcommon0 \ + software-properties-common\ + && add-apt-repository -y ppa:zeehio/libxp \ + && apt-get update \ + && apt-get install -y libxp6 + +# Create the necessary directory +RUN mkdir -p /ansys_inc && \ + echo "Directory created." + +# Create the user +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME + +# Add a working directory and make it accessible to any user +RUN mkdir -p /home/$USERNAME/$WORKING_DIRECTORY \ + && chown -R $USERNAME:$USERNAME /home/$USERNAME/$WORKING_DIRECTORY \ + && chmod a+rwx /home/$USERNAME/$WORKING_DIRECTORY + +# Copy distribution files to /tmp +COPY distributions/*.tgz /tmp/ +RUN apt-get install -y tar \ + && cd /tmp \ + && for file in *.tgz; do tar -xzf "$file" -C /ansys_inc; done \ + && rm -rf /tmp/* + +# install the product +RUN /ansys_inc/INSTALL -silent -install_dir /ansys_inc -licserverinfo $LICENSE_SERVER -mechapdl + +# LABELS +LABEL description="MAPDL on Ubuntu" +LABEL email="pyansys.core@ansys.com" + +# OCI LABELS +LABEL org.opencontainers.image.documentation="https://mapdl.docs.pyansys.com" + +# Cleaning up unnecessary files +RUN rm -rf /tmp/ + +# Adding alias to ansys executable +RUN printf '#!/bin/bash\n/ansys_inc/v$ANSYS_VERSION/ansys/bin/mapdl "$@"' > /usr/bin/ansys && \ + chmod +x /usr/bin/ansys +RUN printf '#!/bin/bash\n/ansys_inc/v$ANSYS_VERSION/ansys/bin/mapdl -grpc "$@"' > /usr/bin/ansysgrpc && \ + chmod +x /usr/bin/ansysgrpc + +# Setting user +USER $USERNAME +WORKDIR /home/$USERNAME/$WORKING_DIRECTORY + +# Setting entrypoint +EXPOSE 50052 +ENTRYPOINT [ "bash", "-c", "/ansys_inc/v${ANSYS_VERSION}/ansys/bin/mapdl -grpc -dir ${WORKING_DIRECTORY}"] diff --git a/docker/linux/docker-compose.yml b/docker/linux/docker-compose.yml new file mode 100644 index 0000000000..8f00c2592b --- /dev/null +++ b/docker/linux/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3.8' + +services: + mapdl-container: + build: + context: . + dockerfile: Dockerfile + args: + VERSION: ${VERSION} + LICENSE_SERVER: ${LICENSE_SERVER} + environment: + - VERSION=${VERSION} + - USERNAME=mapdl + - USER_UID=1000 + - LICENSE_SERVER=${LICENSE_SERVER} + - AWP_ROOT222=/ansys_inc + - WORKING_DIRECTORY=/jobs + - HOME=/home/mapdl + - ANSYSLMD_LICENSE_FILE=1055@${LICENSE_SERVER} + ports: + - "50052:50052" + volumes: + - ./distributions:/tmp/distributions + command: bash -c "/ansys_inc/v${VERSION}/ansys/bin/mapdl -grpc -dir /jobs" + diff --git a/tox.ini b/tox.ini index 6d5b8ecd56..9af2442845 100644 --- a/tox.ini +++ b/tox.ini @@ -1,20 +1,20 @@ [tox] description = Default tox environments list envlist = - style,{py38,py39,py310,py311,py312}{,-coverage},doc + code-style + doc-style + {py39,py310,py311,py312}{,-coverage} + doc-{links,html} + docker-run-{linux_host,windows_host} + docker-build-ubuntu_images skip_missing_interpreters = true isolated_build = true isolated_build_env = build - [testenv] description = Checks for project unit tests and coverage (if desired) basepython = - py39: python3.9 - py310: python3.10 - py311: python3.11 - py312: python3.12 py: python3 - {style,reformat,doc}: python3 + {code-style,doc-links,doc-html, tests}: python3 setenv = PYTHONUNBUFFERED = yes coverage: PYTEST_EXTRA_ARGS = --cov=ansys.mapdl --cov-report=term --cov-report=xml:.cov/xml --cov-report=html:.cov/html @@ -22,16 +22,63 @@ extras = tests commands = pytest {env:PYTEST_MARKERS:} {env:PYTEST_EXTRA_ARGS:} {posargs:-vv} -[testenv:style] +[testenv:code-style] description = Checks project code style +skip_install = true deps = pre-commit commands = pre-commit install pre-commit run --all-files --show-diff-on-failure -[testenv:doc] +[testenv:doc-style] +description = Checks project documentation style +skip_install = true +allowlist_externals = + vale +commands = + vale sync --config="{toxinidir}/doc/.vale.ini" + vale --config="{toxinidir}/doc/.vale.ini" "{toxinidir}/doc" + +[testenv:doc-{links, html}] description = Check if documentation generates properly +setenv = + links: BUILDER = linkcheck + html: BUILDER = html +passenv = + BUILD_API + BUILD_EXAMPLES + ON_DOCUMENTATION extras = doc commands = - sphinx-build -d "{toxworkdir}/doc_doctree" doc/source "{toxworkdir}/doc_out" --color -vW -bhtml \ No newline at end of file + sphinx-build -d "{toxworkdir}/doc_doctree" doc/source "{toxinidir}/doc/_build/{env:BUILDER}" --color -vW -b {env:BUILDER} -j auto + +[testenv:docker-build-ubuntu_images] +description = Build docker images for Ubuntu +skip_install = true +allowlist_externals = + docker + compose +commands = + docker-compose -f "{toxinidir}/docker/linux/docker-compose.yml" build + +[testenv:docker-run-{linux_host, windows_host}] +description = Run tests in a docker container +skip_install = true +allowlist_externals = + docker +platform = + linux_host: linux + windows_host: win32 +passenv = + ANSYSLMD_LICENSE_FILE + LOCAL_MAPDL_PORT + MAPDL_DOCKER_REGISTRY_URL + GITHUB_USERNAME + GITHUB_TOKEN +commands = + docker login ghcr.io -u {env:GITHUB_USERNAME} -p {env:GITHUB_TOKEN} + docker run \ + --env ANSYSLMD_LICENSE_FILE={env:ANSYSLMD_LICENSE_FILE} \ + --name mapdl -p {env:LOCAL_MAPDL_PORT}:50052 \ + {env:MAPDL_DOCKER_REGISTRY_URL} -smp