diff --git a/docs/source/conf.py b/docs/source/conf.py index f694f64..da5fde5 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -43,15 +43,8 @@ # built documents. # # The short X.Y version. -import configparser -config = configparser.ConfigParser(allow_no_value=True) -try: - with open("../../setup.cfg", encoding='utf-8') as f: - config.read_string(f.read()) -except TypeError: - # NOTE: encoding is not a keyword in Python 2 - with open("../../setup.cfg") as f: - config.read_string(f.read().decode('utf-8')) +from ppl import __version__ as release + version = release = config['metadata']['version'] # List of patterns, relative to source directory, that match files and diff --git a/ppl/__init__.py b/ppl/__init__.py index e983530..9f1efec 100644 --- a/ppl/__init__.py +++ b/ppl/__init__.py @@ -127,6 +127,8 @@ Remove the _mutable_immutable class. """ +__version__ = "0.8.8" + from .linear_algebra import ( Variable, Variables_Set, Linear_Expression, ) diff --git a/pyproject.toml b/pyproject.toml index 939055b..90e389b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,6 @@ build-backend = "setuptools.build_meta" [project] name = "pplpy" -version = "0.8.8" description = "Python PPL wrapper" readme = "README.rst" authors = [{name = "Vincent Delecroix", email = "vincent.delecroix@labri.fr"}] @@ -39,6 +38,7 @@ dependencies = [ "cysignals", "gmpy2>=2.1.0b1", ] +dynamic = ["version"] [project.optional-dependencies] doc = [ @@ -54,5 +54,8 @@ packages = ["ppl"] platforms = ["any"] include-package-data = false +[tool.setuptools.dynamic] +version = {attr = "ppl.__version__"} + [tool.setuptools.package-data] ppl = ["*.pxd", "*.h", "*.hh"]