Skip to content

Commit

Permalink
Fix instructions to pip install ansys-rocky-core (#29)
Browse files Browse the repository at this point in the history
* Fix instructions to pip install ansys-rocky-core

* Search for the latest AWP_ROOT env variable

Remove hard coded AWP_ROOT env variables and create a short list
comprehension to make it dynamic.
  • Loading branch information
igortg authored Feb 15, 2024
1 parent dd9279f commit 24a2af7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
7 changes: 3 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@ PyRocky

|pyansys| |MIT| |python| |pypi| |codecov| |MIT| |black| |pre-commit|

PyRocky is a Python client library for remotely controlling Ansys Rocky.
PyRocky is a Python client for Ansys Rocky.

Usage
-----

Installation
^^^^^^^^^^^^

PyRocky is currently a private GitHub library in the Ansys Internal account. To
install PyRocky, run this command:
To install PyRocky, run this command:

.. code:: bash
python -m pip install https://github.com/ansys/pyrocky
python -m pip install ansys-rocky-core
Getting started
^^^^^^^^^^^^^^^
Expand Down
5 changes: 2 additions & 3 deletions doc/source/getting_started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ Getting started
Installation
------------

PyRocky is currently a private GitHub library in the Ansys Internal account. To
install PyRocky, run this command:
To install PyRocky, run this command:

.. code:: bash
python -m pip install https://github.com/ansys/pyrocky
python -m pip install ansys-rocky-core
Launch PyRocky
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "flit_core.buildapi"
name = "ansys-rocky-core"
version = "0.1.dev0"
authors = [{ name="ANSYS, Inc.", email="[email protected]" }]
description = "A Python wrapper for Ansys Rocky PrePost UI"
description = "Python client library for Ansys Rocky"
readme = "README.rst"
requires-python = ">=3.9,<4"
license = { file = "LICENSE" }
Expand Down
11 changes: 4 additions & 7 deletions src/ansys/rocky/core/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,11 @@ def launch_rocky(
----------
rocky_exe : Optional[Path], optional
Path to the Rocky executable. If a path is not specified, this method
tries to find the path in the ``AWP_ROOT241`` and ``AWP_ROOT232``
environment variables.
tries to find the path using ``AWP_ROOT*`` environment variables.
headless : bool, optional
Whether to launch Rocky in headless mode. The default is ``True``.
server_port: int, optional
Port that hosts the Rocky server.
Set the port for Rocky RPC server.
Returns
-------
Expand All @@ -70,10 +69,8 @@ def launch_rocky(
raise RockyLaunchError(f"Port {server_port} is already in use.")

if rocky_exe is None:
for awp_root in ["AWP_ROOT241", "AWP_ROOT232"]:
if awp_root not in os.environ:
continue

awp_roots = [k for k in os.environ.keys() if k.startswith("AWP_ROOT")]
for awp_root in sorted(awp_roots, reverse=True):
rocky_exe = Path(os.environ[awp_root]) / "Rocky/bin/Rocky.exe"
if rocky_exe.is_file():
break
Expand Down

0 comments on commit 24a2af7

Please sign in to comment.