Skip to content

Commit

Permalink
Update minimum python version
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroFernandezLuces committed Jan 18, 2024
1 parent d8f152b commit 47842a5
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
vale-config: "doc/.vale.ini"
vale-version: "2.29.6"

docs-style:
name: Documentation Style Check
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ version = "0.1.dev0"
authors = [{ name="ANSYS, Inc.", email="[email protected]" }]
description = "A Python wrapper for Ansys Rocky PrePost UI"
readme = "README.rst"
requires-python = ">=3.8,<4"
requires-python = ">=3.9,<4"
license = { file = "LICENSE" }
classifiers = [
"Development Status :: 4 - Beta",
Expand Down
16 changes: 7 additions & 9 deletions src/ansys/rocky/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def connect_to_rocky(host: str = "localhost", port: int = 50615) -> "RockyClient
The host name where the application is running, by default "localhost".
port : int, optional
The service port to connect, by default 50615.
Returns
-------
RockyClient
Expand All @@ -33,12 +33,13 @@ def connect_to_rocky(host: str = "localhost", port: int = 50615) -> "RockyClient

class RockyClient:
"""A client object to interact with the Rocky Application.
Parameters
----------
rocky_api : Pyro5.api.Proxy
The Pyro5 proxy object to interact with the Rocky Application.
"""

def __init__(self, rocky_api):
self._api_adapter = rocky_api

Expand All @@ -52,14 +53,15 @@ def close(self):

class _ApiElementProxy:
"""A proxy object for API Elements.
Parameters
----------
pyro_api : Pyro5.api.Proxy
The Pyro5 proxy object to interact with the Rocky Application.
pool_id : int
The ID of the API Element.
"""

def __init__(self, pyro_api, pool_id):
self._pool_id = pool_id
self._pyro_api = pyro_api
Expand Down Expand Up @@ -106,8 +108,7 @@ def serialize(cls, classname: str, obj) -> dict:


class _ApiListProxy(_ApiElementProxy):
"""A proxy object for API Elements that implement the sequence interface.
"""
"""A proxy object for API Elements that implement the sequence interface."""

def __len__(self) -> int:
return self._pyro_api.SendToApiElement(self._pool_id, "__len__")
Expand All @@ -125,7 +126,7 @@ def __delitem__(self, index: int) -> None:

def deserialize_api_error(classname: str, serialized: dict) -> RockyApiError:
"""Deserialize an API Error.
Parameters
----------
serialized : dict
Expand Down Expand Up @@ -162,6 +163,3 @@ def deserialize_numpy(classname, serialized) -> "Any":
Pyro5.api.register_dict_to_class("ndarray", deserialize_numpy)

Pyro5.api.register_class_to_dict(_ApiElementProxy, _ApiElementProxy.serialize)



6 changes: 5 additions & 1 deletion src/ansys/rocky/core/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
ANSYS_EXAMPLE_DATA_REPO = "https://github.com/ansys/example-data/raw/master"


def _get_file_url(file_name: str, file_host: str = ANSYS_EXAMPLE_DATA_REPO, directory: Optional[str] = None) -> str:
def _get_file_url(
file_name: str,
file_host: str = ANSYS_EXAMPLE_DATA_REPO,
directory: Optional[str] = None,
) -> str:
"""Get file URL."""
if directory:
return f"{file_host}/{directory}/{file_name}"
Expand Down
6 changes: 4 additions & 2 deletions src/ansys/rocky/core/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
class PyRockyError(Exception):
"""Generic exception for PyRocky API"""


class RockyLaunchError(PyRockyError):
"""Raised for errors occurred during Rocky application launch"""



class RockyApiError(Exception):
"""
Exception class representing an error generated in the API layer.
"""
"""
4 changes: 2 additions & 2 deletions src/ansys/rocky/core/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ def launch_rocky(
"""
Launch Rocky executable with PyRocky server enabled, wait Rocky to start up and
return a `RockyClient` instance.
Parameters
----------
rocky_exe : Optional[Path], optional
Path to Rocky executable. If not specified, will try to find it in the
environment variables `AWP_ROOT241` and `AWP_ROOT232`.
headless : bool, optional
Whether to launch Rocky in headless mode. Default is `True`.
Returns
-------
RockyClient
Expand Down
1 change: 1 addition & 0 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
EXAMPLES_DIR = Path(os.path.join(ROOT_DIR, "examples"))


@pytest.mark.parametrize("example_path", list(EXAMPLES_DIR.rglob("*.py")))
def test_examples(example_path: Path) -> None:
subprocess.check_call([sys.executable, str(example_path.absolute())])

0 comments on commit 47842a5

Please sign in to comment.