From c37068e05cb2b2dca351259155e47924bac37f19 Mon Sep 17 00:00:00 2001 From: German Date: Thu, 23 Feb 2023 19:47:04 +0700 Subject: [PATCH 1/7] Adapting docs. --- .gitignore | 1 + README.rst | 2 ++ doc/source/API.rst | 14 ++++++++++++++ doc/source/conf.py | 2 +- doc/source/index.rst | 30 ++++++++++++++++++++++++++++++ pyproject.toml | 8 ++++---- src/ansys/tools/path/path.py | 18 +++++++++--------- 7 files changed, 61 insertions(+), 14 deletions(-) create mode 100644 doc/source/API.rst diff --git a/.gitignore b/.gitignore index a203ca30..ee590b7c 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ test-output.xml .venv .DS_Store +doc/_build/*/* diff --git a/README.rst b/README.rst index f6fccceb..70ef269a 100644 --- a/README.rst +++ b/README.rst @@ -102,6 +102,7 @@ need to follow these steps: python -m pip install --editable ansys-tools-path +.. howtouse How to testing -------------- @@ -157,3 +158,4 @@ the building requirements and then executing the build module: .. _pytest: https://docs.pytest.org/en/stable/ .. _Sphinx: https://www.sphinx-doc.org/en/master/ .. _tox: https://tox.wiki/ +.. _api: diff --git a/doc/source/API.rst b/doc/source/API.rst new file mode 100644 index 00000000..2c8edc47 --- /dev/null +++ b/doc/source/API.rst @@ -0,0 +1,14 @@ +.. _ref_api: + +API +======== + +.. currentmodule:: ansys.tools.path + +.. autosummary:: + :toctree: _autosummary + + find_ansys + get_available_ansys_installations + change_default_ansys_path + save_ansys_path \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py index acb90d2c..1dc269f3 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -12,7 +12,7 @@ # Select desired logo, theme, and declare the html title html_logo = logo html_theme = "ansys_sphinx_theme" -html_short_title = html_title = "pytools-path" +html_short_title = html_title = "ansys-tools-path" # specify the location of your github repo html_theme_options = { diff --git a/doc/source/index.rst b/doc/source/index.rst index d2824a5f..cb0fc361 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -3,4 +3,34 @@ Provide any documentation specific to your online documentation here. + +.. toctree:: + :hidden: + :maxdepth: 3 + + API + + +.. include:: ../../README.rst + :end-before: .. howtouse + + + +How to use +---------- + +You can use any of the functions available in the :ref:`ref_api` +to identify the path of the local ANSYS installation. + +For example you can use :func:`find_ansys ` +to locate the path of the latest ANSYS installation available: + +.. code:: pycon + + >>> from ansys.tools.path import find_ansys + >>> find_ansys() + 'C:/Program Files/ANSYS Inc/v211/ANSYS/bin/winx64/ansys211.exe', 21.1 + + .. include:: ../../README.rst + :start-after: .. howtouse \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 7c69d475..7c2f2dcd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,10 +36,10 @@ test = [ ] doc = [ - "Sphinx==5.0.2", - "numpydoc==1.4.0", - "ansys-sphinx-theme==0.4.2", - "sphinx-copybutton==0.5", + "Sphinx==5.3.0", + "numpydoc==1.5.0", + "ansys-sphinx-theme==0.9.3", + "sphinx-copybutton==0.5.1", ] build = [ diff --git a/src/ansys/tools/path/path.py b/src/ansys/tools/path/path.py index 5a7e8627..3f32870f 100644 --- a/src/ansys/tools/path/path.py +++ b/src/ansys/tools/path/path.py @@ -89,7 +89,7 @@ def _get_available_base_ansys(supported_versions=SUPPORTED_ANSYS_VERSIONS): Examples -------- - >>> from ansys.mapdl.core import _get_available_base_ansys + >>> from ansys.tools.path.path import _get_available_base_ansys >>> _get_available_base_ansys() {222: 'C:\\Program Files\\ANSYS Inc\\v222', 212: 'C:\\Program Files\\ANSYS Inc\\v212', @@ -181,7 +181,7 @@ def get_available_ansys_installations(supported_versions=SUPPORTED_ANSYS_VERSION Examples -------- - >>> from ansys.mapdl.core import get_available_ansys_installations + >>> from ansys.tools.path import get_available_ansys_installations >>> get_available_ansys_installations() {222: 'C:\\Program Files\\ANSYS Inc\\v222', 212: 'C:\\Program Files\\ANSYS Inc\\v212', @@ -225,7 +225,7 @@ def find_ansys(version=None, supported_versions=SUPPORTED_ANSYS_VERSIONS): -------- Within Windows - >>> from ansys.mapdl.core.launcher import find_ansys + >>> from ansys.tools.path import find_ansys >>> find_ansys() 'C:/Program Files/ANSYS Inc/v211/ANSYS/bin/winx64/ansys211.exe', 21.1 @@ -293,15 +293,15 @@ def change_default_ansys_path(exe_loc): -------- Change default Ansys location on Linux - >>> from ansys.mapdl.core import launcher - >>> launcher.change_default_ansys_path('/ansys_inc/v201/ansys/bin/ansys201') - >>> launcher.get_ansys_path() + >>> from ansys.tools.path import change_default_ansys_path, get_ansys_path + >>> change_default_ansys_path('/ansys_inc/v201/ansys/bin/ansys201') + >>> get_ansys_path() '/ansys_inc/v201/ansys/bin/ansys201' Change default Ansys location on Windows >>> ans_pth = 'C:/Program Files/ANSYS Inc/v193/ansys/bin/winx64/ANSYS193.exe' - >>> launcher.change_default_ansys_path(ans_pth) + >>> change_default_ansys_path(ans_pth) """ if os.path.isfile(exe_loc): @@ -351,7 +351,7 @@ def save_ansys_path(exe_loc=None, allow_prompt=True): You can change the default ``exe_loc`` either by modifying the mentioned ``config.txt`` file or by executing: - >>> from ansys.mapdl.core import save_ansys_path + >>> from ansys.tools.path import save_ansys_path >>> save_ansys_path('/new/path/to/executable') """ @@ -379,7 +379,7 @@ def _prompt_ansys_path(): # pragma: no cover "You are about to enter manually the path of the ANSYS MAPDL executable(ansysXXX,where XXX is the version\n" "This file is very likely to contained in path ending in 'vXXX/ansys/bin/ansysXXX', but it is not required.\n" "\nIf you experience problems with the input path you can overwrite the configuration file by typing:\n" - ">>> from ansys.mapdl.core.launcher import save_ansys_path\n" + ">>> from ansys.tools.path import save_ansys_path\n" ">>> save_ansys_path('/new/path/to/executable/')\n" ) need_path = True From 4d44de5bd1d9f23b12cff6aac88f9c2dccd3da7c Mon Sep 17 00:00:00 2001 From: German Date: Thu, 23 Feb 2023 19:49:14 +0700 Subject: [PATCH 2/7] activating docs sections --- .github/workflows/ci_cd.yml | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index f0b0282b..d510f012 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -98,25 +98,25 @@ jobs: run: | make -C doc html SPHINXOPTS="-W" - # - name: Build PDF Documentation - # run: | - # sudo apt update - # sudo apt-get install -y texlive-latex-extra latexmk - # make -C doc latexpdf - - # - name: Upload HTML Documentation - # uses: actions/upload-artifact@v2 - # with: - # name: Documentation-html - # path: doc/build/html - # retention-days: 7 - - # - name: Upload PDF Documentation - # uses: actions/upload-artifact@v2 - # with: - # name: Documentation-pdf - # path: doc/build/latex/*.pdf - # retention-days: 7 + - name: Build PDF Documentation + run: | + sudo apt update + sudo apt-get install -y texlive-latex-extra latexmk + make -C doc latexpdf + + - name: Upload HTML Documentation + uses: actions/upload-artifact@v2 + with: + name: Documentation-html + path: doc/build/html + retention-days: 7 + + - name: Upload PDF Documentation + uses: actions/upload-artifact@v2 + with: + name: Documentation-pdf + path: doc/build/latex/*.pdf + retention-days: 7 Release: if: contains(github.ref, 'refs/tags') From a5af44d62fda0450960744f3c6cc9037bf4e5641 Mon Sep 17 00:00:00 2001 From: German Date: Thu, 23 Feb 2023 19:52:24 +0700 Subject: [PATCH 3/7] removing warning --- doc/source/_templates/sidebar-nav-bs.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/_templates/sidebar-nav-bs.html b/doc/source/_templates/sidebar-nav-bs.html index 0554e82e..0747bd05 100644 --- a/doc/source/_templates/sidebar-nav-bs.html +++ b/doc/source/_templates/sidebar-nav-bs.html @@ -1,9 +1,9 @@