Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 18 additions & 18 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
uses: codecov/codecov-action@v3

- name: Upload wheel
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ansys-product-library-wheel
path: dist/
Expand All @@ -84,9 +84,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand All @@ -104,15 +104,15 @@ jobs:
# 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 HTML Documentation
uses: actions/upload-artifact@v3
with:
name: Documentation-html
path: doc/_build/html
retention-days: 7

# - name: Upload PDF Documentation
# uses: actions/upload-artifact@v2
# uses: actions/upload-artifact@v3
# with:
# name: Documentation-pdf
# path: doc/build/latex/*.pdf
Expand All @@ -124,21 +124,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.9

- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: ansys-product-library-wheel

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: Documentation-pdf

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: Documentation-html
path: ~/html
Expand All @@ -148,7 +148,7 @@ jobs:
run: ls -R

- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.1.5
uses: JamesIves/github-pages-deploy-action@4.4
with:
BRANCH: gh-pages
FOLDER: ~/html
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ test-output.xml

.venv
.DS_Store
doc/_build/*/*
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ need to follow these steps:
python -m pip install --editable ansys-tools-path


.. howtouse

How to testing
--------------
Expand Down Expand Up @@ -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:
14 changes: 14 additions & 0 deletions doc/source/API.rst
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions doc/source/_templates/sidebar-nav-bs.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation">
<div class="bd-toc-item active">
{% if pagename.startswith("_autosummary") or pagename.startswith("api")%}
{{ generate_nav_html("sidebar", maxdepth=4, collapse=True, includehidden=True, titles_only=True) }}
{{ generate_toctree_html("sidebar", maxdepth=4, collapse=True, includehidden=True, titles_only=True) }}
{% else %}
{{ generate_nav_html("sidebar", maxdepth=4, collapse=False, includehidden=True, titles_only=True) }}
{{ generate_toctree_html("sidebar", maxdepth=4, collapse=False, includehidden=True, titles_only=True) }}
{% endif %}

</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
30 changes: 30 additions & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ansys.tools.path.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
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
18 changes: 9 additions & 9 deletions src/ansys/tools/path/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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')

"""
Expand Down Expand Up @@ -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
Expand Down