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

fix: Update the tox.ini to different tox env #3164

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
74dda02
fix: update the codestyle
Revathyvenugopal162 Jun 10, 2024
c47f466
fix: update vale
Revathyvenugopal162 Jun 10, 2024
a5e4be0
docs: add build env variable
Revathyvenugopal162 Jun 10, 2024
1c61a30
fix: add link check tox env
Revathyvenugopal162 Jun 10, 2024
e514d99
Merge branch 'main' into fix/improve-tox
Revathyvenugopal162 Jun 10, 2024
7706b24
fix: add the docker run env
Revathyvenugopal162 Jun 10, 2024
56cabe5
fix: add the docker run env
Revathyvenugopal162 Jun 10, 2024
97667f7
Update doc/source/conf.py
Revathyvenugopal162 Jun 11, 2024
514a371
feat: apply suggestions from @jorgepiloto
Revathyvenugopal162 Jun 11, 2024
c5f9697
Merge branch 'fix/improve-tox' of https://github.com/ansys/pymapdl in…
Revathyvenugopal162 Jun 11, 2024
2a40945
feat: apply suggestions from @jorgepiloto
Revathyvenugopal162 Jun 11, 2024
2bae4dd
docs: rearrange sphinx conf
Revathyvenugopal162 Jun 11, 2024
1d2585f
docs: rearrange the crads with index
Revathyvenugopal162 Jun 11, 2024
1ddd1e6
docs: add jinja conditions to pymapdl
Revathyvenugopal162 Jun 11, 2024
e9e01f5
fix: update the tox file
Revathyvenugopal162 Jun 11, 2024
1c00997
fix: ref links
Revathyvenugopal162 Jun 11, 2024
24fa784
fix: wnv variable for docs
Revathyvenugopal162 Jun 12, 2024
58aaebb
fix: fix docker file
Revathyvenugopal162 Jun 17, 2024
f96b7b6
fix: ansys version on docker file
Revathyvenugopal162 Jun 18, 2024
981f269
fix: ansys license server
Revathyvenugopal162 Jun 18, 2024
dca0d42
fix: add docker compose and tox docker buid commands
Revathyvenugopal162 Jun 18, 2024
edb007c
fix: add tox docker buid commands
Revathyvenugopal162 Jun 18, 2024
cf41c39
Merge branch 'main' into fix/improve-tox
Revathyvenugopal162 Jun 18, 2024
b707026
Adding changelog entry: 3164.miscellaneous.md
pyansys-ci-bot Jun 18, 2024
ad8e462
fix: add tox docker buid commands
Revathyvenugopal162 Jun 18, 2024
d3e70d2
Merge branch 'fix/improve-tox' of https://github.com/ansys/pymapdl in…
Revathyvenugopal162 Jun 18, 2024
9037c89
fix: add tox docker buid commands
Revathyvenugopal162 Jun 19, 2024
bf0bb9d
Adding changelog entry: 3164.fixed.md
pyansys-ci-bot Jun 19, 2024
c82d9e0
Merge branch 'main' into fix/improve-tox
Revathyvenugopal162 Jun 19, 2024
cdbde4b
Merge branch 'main' into fix/improve-tox
Revathyvenugopal162 Aug 23, 2024
8159e5d
Update the image cache
Revathyvenugopal162 Aug 23, 2024
1adab82
Merge branch 'main' into fix/improve-tox
germa89 Aug 27, 2024
51f6d5e
Merge branch 'main' into fix/improve-tox
Revathyvenugopal162 Oct 7, 2024
e2a3f45
Merge branch 'main' into fix/improve-tox
Revathyvenugopal162 Oct 7, 2024
2265269
fix: remove the comments
Revathyvenugopal162 Oct 7, 2024
801800f
Merge branch 'fix/improve-tox' of https://github.com/ansys/pymapdl in…
Revathyvenugopal162 Oct 7, 2024
f167caf
Merge branch 'main' into fix/improve-tox
Revathyvenugopal162 Oct 7, 2024
cd5998e
Merge branch 'main' into fix/improve-tox
germa89 Oct 25, 2024
6b1094e
Merge branch 'main' into fix/improve-tox
germa89 Nov 25, 2024
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
74 changes: 44 additions & 30 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,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",
"sphinx_reredirects",
Expand Down Expand Up @@ -187,6 +187,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")
Revathyvenugopal162 marked this conversation as resolved.
Show resolved Hide resolved
# -- 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 = ""

Expand All @@ -205,7 +248,6 @@

# Setting redicts
redirects = {
#
# Old link: https://dev.mapdl.docs.pyansys.com/user_guide/krylov.html
"user_guide/krylov": "examples/extended_examples/Krylov/krylov_example"
}
Expand Down Expand Up @@ -242,34 +284,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"
Expand Down
2 changes: 1 addition & 1 deletion doc/source/getting_started/devcontainer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Develop on a remote container
The Docker image listed in the
`repository development container configuration files <pymapdl_devcontainer_configuration_>`_
is not for public use due to licensing issues.
However, you can `create your own Docker image <ref_make_container_>`
However, you can `create your own Docker image <ref_make_container>`_
and use this file as a template for setting your own local development container.

To use a `remote container <vscode_devcontainers_containers_>`_, you must install this software:
Expand Down
130 changes: 66 additions & 64 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@
.. 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
.. jinja:: main_toctree
Revathyvenugopal162 marked this conversation as resolved.
Show resolved Hide resolved

.. 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 %}


.. image:: ../source/_static/logo_dark.png
Expand All @@ -40,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`.
.. jinja:: main_toctree

.. grid-item::
.. card:: :fa:`gears` See some PyMAPDL usage examples
{% 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.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ doc = [
"sphinx-copybutton==0.5.2",
"sphinx-design==0.6.0",
"sphinx-gallery==0.16.0",
"sphinx-jinja==2.0.2",
"sphinx-notfound-page==1.0.2",
"sphinxcontrib-websupport==1.2.7",
"sphinxemoji==0.3.1",
Expand Down
58 changes: 48 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,37 +1,75 @@
[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}
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
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 =
jorgepiloto marked this conversation as resolved.
Show resolved Hide resolved
BUILD_API
BUILD_EXAMPLES
ON_DOCUMENTATION
extras = doc
commands =
sphinx-build -d "{toxworkdir}/doc_doctree" doc/source "{toxworkdir}/doc_out" --color -vW -bhtml
sphinx-build -d "{toxworkdir}/doc_doctree" doc/source "{toxinidir}/doc/_build/{env:BUILDER}" --color -vW -b {env:BUILDER} -j auto

[testenv:docker-run-{linux_host, windows_host}]
description = Run tests in a docker container
skip_install = true
allowlist_externals =
docker
platform =
Revathyvenugopal162 marked this conversation as resolved.
Show resolved Hide resolved
linux_host: linux
windows_host: win32
passenv =
ANSYSLMD_LICENSE_FILE
LOCAL_MAPDL_PORT
Revathyvenugopal162 marked this conversation as resolved.
Show resolved Hide resolved
MAPDL_DOCKER_REGISTRY_URL
GITHUB_USERNAME
GITHUB_TOKEN
commands =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Login is no longer required since users can build the images locally:

Suggested change
docker login ghcr.io -u {env:GITHUB_USERNAME} -p {env:GITHUB_TOKEN}

docker login ghcr.io -u {env:GITHUB_USERNAME} -p {env:GITHUB_TOKEN}
docker run \
--env ANSYSLMD_LICENSE_FILE={env:ANSYSLMD_LICENSE_FILE} \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up, @germa89.

We should take advantage of this and add a rule for building a docker image locally. This will help us to review the docker/ directory and the current image building process.

This directory could look like this:

docker/
|- linux/
   |- Dockerfile
   |- docker-compose.yml
   |- distributions/
      |- .gitignore  # Ignore everything except the dir itself
      |- .gitkeep

Users should just copy MAPDL artifacts in the distributions/ dir. Then, running:

tox -e docker-build-images would trigger the docker-compose.yml file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Building the docker image is a bit complex.. because the dockerignore depends on the MAPDL version.
The docker directory is not used by the CICD nor myself to build the docker image at the moment, hence it is not fully maintained.
We have some instructions about building the docker image in: https://mapdl.docs.pyansys.com/version/stable/getting_started/make_container.html

We could meet next week to discuss this more in details.

--name mapdl -p {env:LOCAL_MAPDL_PORT}:50052 \
jorgepiloto marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{env:MAPDL_DOCKER_REGISTRY_URL} -smp
-smp

{env:MAPDL_DOCKER_REGISTRY_URL} -smp

Loading