diff --git a/_version.py b/_version.py new file mode 100644 index 0000000..5635676 --- /dev/null +++ b/_version.py @@ -0,0 +1 @@ +__version__ = "0.2.11" diff --git a/config/system_config.yaml b/config/system_config.yaml index fd9057e..1bc49c2 100644 --- a/config/system_config.yaml +++ b/config/system_config.yaml @@ -1,5 +1,3 @@ -client_version: "0.2.11" - error_messages: template_not_found: message: | diff --git a/pyproject.toml b/pyproject.toml index a79fea8..9efc47c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "codeplain" -version = "0.2.11" +dynamic = ["version"] description = "Transform plain language specifications into working code" readme = "README.md" requires-python = "==3.11" @@ -40,6 +40,9 @@ dev = [ [project.scripts] codeplain = "plain2code:main" +[tool.hatch.version] +path = "_version.py" + [tool.hatch.build.targets.wheel] include = [ "*.py", diff --git a/system_config.py b/system_config.py index 46c14cc..dcc3721 100644 --- a/system_config.py +++ b/system_config.py @@ -3,6 +3,7 @@ import yaml +from _version import __version__ from plain2code_console import console @@ -11,12 +12,10 @@ class SystemConfig: def __init__(self): self.config = self._load_config() - if "client_version" not in self.config: - raise KeyError("Missing 'client_version' in system_config.yaml") if "error_messages" not in self.config: raise KeyError("Missing 'error_messages' section in system_config.yaml") - self.client_version = self.config["client_version"] + self.client_version = __version__ self.error_messages = self.config["error_messages"] def _load_config(self):