diff --git a/pyproject.toml b/pyproject.toml index 99821ecd3..7b3536876 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi" [project] # Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections name = "ansys-sphinx-theme" -dynamic = ["version"] +version = "0.12.dev0" description = "A theme devised by ANSYS, Inc. for Sphinx documentation." readme = "README.rst" requires-python = ">=3.8,<4" @@ -28,6 +28,7 @@ dependencies = [ "Sphinx>=4.2.0", "pydata-sphinx-theme==0.13.3", "Jinja2>=3.1.2", + "importlib-metadata>=4.0", ] [project.optional-dependencies] diff --git a/src/ansys_sphinx_theme/__init__.py b/src/ansys_sphinx_theme/__init__.py index af996385b..4e20f22fe 100644 --- a/src/ansys_sphinx_theme/__init__.py +++ b/src/ansys_sphinx_theme/__init__.py @@ -11,7 +11,12 @@ from ansys_sphinx_theme.extension.linkcode import DOMAIN_KEYS, sphinx_linkcode_resolve from ansys_sphinx_theme.latex import generate_404 # noqa: F401 -__version__ = "0.11.dev0" +try: + import importlib.metadata as importlib_metadata +except ModuleNotFoundError: # pragma: no cover + import importlib_metadata + +__version__ = importlib_metadata.version(__name__.replace(".", "-")) # Declare the fundamental paths of the theme