From 6ca7c7e3640fd0da383eed2b2ad623936540585d Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 27 Sep 2023 09:38:34 +0200 Subject: [PATCH] build: semantic-release sets library version everywhere Signed-off-by: Jan Kowalleck --- docs/conf.py | 3 ++- pyproject.toml | 4 +++- serializable/__init__.py | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 34aedbd..e76f20a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,7 +24,8 @@ author = 'Paul Horton' # The full version, including alpha/beta/rc tags -release = pkg_resources.get_distribution("py-serializable").version +# !! version is managed by semantic_release +release = '0.12.0' # -- General configuration --------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index cfffcaa..755b9ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,8 +54,10 @@ requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" [tool.semantic_release] +version_toml = "pyproject.toml:tool.poetry.version" version_variable = [ - "pyproject.toml:version" + "serializable/__init__.py:__version__", + "docs/conf.py:release", ] branch = "main" upload_to_pypi = true diff --git a/serializable/__init__.py b/serializable/__init__.py index 4f9d00f..f64c74d 100644 --- a/serializable/__init__.py +++ b/serializable/__init__.py @@ -43,6 +43,10 @@ from .formatters import BaseNameFormatter, CurrentFormatter from .helpers import BaseHelper +# !! version is managed by semantic_release +# do not use typing here, or else `semantic_release` might have issues finding the variable +__version__ = '0.12.0' + logger = logging.getLogger('serializable') logger.setLevel(logging.INFO)