Skip to content

Commit 186e69d

Browse files
Setup client version as a single source of trouth
1 parent 2ecfded commit 186e69d

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.2.10"

config/system_config.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
client_version: "0.2.10"
2-
31
error_messages:
42
template_not_found:
53
message: |

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "codeplain"
7-
version = "0.2.10"
7+
dynamic = ["version"]
88
description = "Transform plain language specifications into working code"
99
readme = "README.md"
1010
requires-python = "==3.11"
@@ -40,6 +40,9 @@ dev = [
4040
[project.scripts]
4141
codeplain = "plain2code:main"
4242

43+
[tool.hatch.version]
44+
path = "_version.py"
45+
4346
[tool.hatch.build.targets.wheel]
4447
include = [
4548
"*.py",

system_config.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import yaml
55

6+
from _version import __version__
67
from plain2code_console import console
78

89

@@ -11,12 +12,10 @@ class SystemConfig:
1112

1213
def __init__(self):
1314
self.config = self._load_config()
14-
if "client_version" not in self.config:
15-
raise KeyError("Missing 'client_version' in system_config.yaml")
1615
if "error_messages" not in self.config:
1716
raise KeyError("Missing 'error_messages' section in system_config.yaml")
1817

19-
self.client_version = self.config["client_version"]
18+
self.client_version = __version__
2019
self.error_messages = self.config["error_messages"]
2120

2221
def _load_config(self):

0 commit comments

Comments
 (0)