Skip to content

Commit 071d4c8

Browse files
author
Matthias Koeppe
committed
Single-source the version from ppl/__init__.py
1 parent ccb619d commit 071d4c8

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

docs/source/conf.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,9 @@
4343
# built documents.
4444
#
4545
# The short X.Y version.
46-
import configparser
47-
config = configparser.ConfigParser(allow_no_value=True)
48-
try:
49-
with open("../../setup.cfg", encoding='utf-8') as f:
50-
config.read_string(f.read())
51-
except TypeError:
52-
# NOTE: encoding is not a keyword in Python 2
53-
with open("../../setup.cfg") as f:
54-
config.read_string(f.read().decode('utf-8'))
55-
version = release = config['metadata']['version']
46+
from ppl import __version__ as release
47+
48+
version = release
5649

5750
# List of patterns, relative to source directory, that match files and
5851
# directories to ignore when looking for source files.

ppl/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@
127127
Remove the _mutable_immutable class.
128128
"""
129129

130+
__version__ = "0.8.9"
131+
130132
from .linear_algebra import (
131133
Variable, Variables_Set, Linear_Expression,
132134
)

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ build-backend = "setuptools.build_meta"
99

1010
[project]
1111
name = "pplpy"
12-
version = "0.8.8"
1312
description = "Python PPL wrapper"
1413
readme = "README.rst"
1514
authors = [{name = "Vincent Delecroix", email = "vincent.delecroix@labri.fr"}]
@@ -39,6 +38,7 @@ dependencies = [
3938
"cysignals",
4039
"gmpy2>=2.1.0b1",
4140
]
41+
dynamic = ["version"]
4242

4343
[project.optional-dependencies]
4444
doc = [
@@ -54,5 +54,8 @@ packages = ["ppl"]
5454
platforms = ["any"]
5555
include-package-data = false
5656

57+
[tool.setuptools.dynamic]
58+
version = {attr = "ppl.__version__"}
59+
5760
[tool.setuptools.package-data]
5861
ppl = ["*.pxd", "*.h", "*.hh"]

0 commit comments

Comments
 (0)