diff --git a/doc/source/getting_started/installation.rst b/doc/source/getting_started/installation.rst index 7a7dc6f74..3edd6075b 100644 --- a/doc/source/getting_started/installation.rst +++ b/doc/source/getting_started/installation.rst @@ -4,17 +4,20 @@ Install packages ================ -The ``ansys-sherlock`` package supports Python 3.7 through Python 3.10 on Windows. +The ``ansys-sherlock-core`` package supports Python 3.7 through Python 3.10 on Windows. To use PySherlock, you must download and install both the ``ansys-api-sherlock`` -and ``ansys-sherlock`` packages. +and ``ansys-sherlock-core`` packages. By using ``pip``, ``ansys-api-sherlock`` is +installed as part of ``ansys-sherlock-core``. Run the following to install -.. TODO: uncomment the following lines when PySherlock is released to the public PyPi. - Install the latest ``ansys-sherlock-core`` package from PyPi with: +the publicly distributed version of the package. -.. .. code:: +.. code:: -.. pip install ansys-sherlock-core + pip install ansys-sherlock-core + +If you want to install the ``ansys-api-sherlock`` and ``ansys-sherlock-core`` packages +from its source code directly, follow the upcoming instructions: #. Download the latest ``ansys-api-sherlock`` package by running this ``git clone`` command: @@ -35,7 +38,7 @@ and ``ansys-sherlock`` packages. cd ansys-api-sherlock pip install -e . -#. Download the latest ``ansys-sherlock`` package by running this +#. Download the latest ``ansys-sherlock-core`` package by running this ``git clone`` command: .. code:: diff --git a/pyproject.toml b/pyproject.toml index 8f8fa6381..7bf75b8b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi" [project] name = "ansys-sherlock-core" -version = "0.1.dev0" +version = "0.2.dev0" description = "A python wrapper for Ansys Sherlock" readme = "README.rst" requires-python = ">=3.8,<4" diff --git a/src/ansys/sherlock/core/__init__.py b/src/ansys/sherlock/core/__init__.py index c92868c96..d7a3dd0de 100644 --- a/src/ansys/sherlock/core/__init__.py +++ b/src/ansys/sherlock/core/__init__.py @@ -1,8 +1,22 @@ # © 2023 ANSYS, Inc. All rights reserved. """PySherlock client library.""" -from ansys.sherlock.core._version import __version__ + +# Version +# ------------------------------------------------------------------------------ + +try: + import importlib.metadata as importlib_metadata +except ModuleNotFoundError: # pragma: no cover + import importlib_metadata # type: ignore + +__version__ = importlib_metadata.version(__name__.replace(".", "-")) +"""PySherlock version.""" + +# Ease import statements +# ------------------------------------------------------------------------------ + from ansys.sherlock.core.logging import Logger LOG = Logger("sherlock") -SHERLOCK = None +"""PySherlock logger.""" diff --git a/src/ansys/sherlock/core/_version.py b/src/ansys/sherlock/core/_version.py deleted file mode 100644 index 3200f503a..000000000 --- a/src/ansys/sherlock/core/_version.py +++ /dev/null @@ -1,13 +0,0 @@ -# © 2023 ANSYS, Inc. All rights reserved. - -"""Version of ``ansys-sherlock-core`` module. - -On the ``main`` branch, use '`dev0'` to denote a development version. -For example, ``version_info = 0, 58, 'dev0'``. -""" - -# major, minor, patch -version_info = 0, 2, "dev0" - -# Nicely formatted string for the version -__version__ = ".".join(map(str, version_info)) diff --git a/tests/test_metadata.py b/tests/test_metadata.py new file mode 100644 index 000000000..dd8e40ce7 --- /dev/null +++ b/tests/test_metadata.py @@ -0,0 +1,14 @@ +from ansys.sherlock.core import __version__ + + +def test_pkg_version(): + try: + import importlib.metadata as importlib_metadata + except ModuleNotFoundError: # pragma: no cover + import importlib_metadata + + # Read from the pyproject.toml + # major, minor, patch + read_version = importlib_metadata.version("ansys-sherlock-core") + + assert __version__ == read_version