From 5adc79acabde831e95989c8bb25d922991babee4 Mon Sep 17 00:00:00 2001 From: Dylan Verheul Date: Sun, 24 Dec 2023 09:52:19 +0100 Subject: [PATCH] Single source package version in pyproject.toml --- .readthedocs.yml | 1 - docs/conf.py | 5 +---- pyproject.toml | 2 +- src/django_marina/__about__.py | 4 +++- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index b987040..a34d643 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -7,6 +7,5 @@ build: commands: - pip install -U pip - pip install -U -r docs/requirements.txt - - pip install -e . - make docs - mv docs/_build $READTHEDOCS_OUTPUT diff --git a/docs/conf.py b/docs/conf.py index f34e299..46810fd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,15 +1,12 @@ -import importlib from datetime import datetime import tomllib -module = importlib.import_module("django_marina") - with open("../pyproject.toml", "rb") as f: pyproject = tomllib.load(f) project = pyproject["project"]["name"] -release = module.__version__ +release = pyproject["project"]["version"] version = ".".join(release.split(".")[:2]) author = ", ".join(author["name"] for author in pyproject["project"]["authors"]) year = datetime.now().year diff --git a/pyproject.toml b/pyproject.toml index 6aee67c..50d75e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ license = {file = "LICENSE"} name = "django-marina" readme = "README.md" requires-python = ">=3.8" -version = "23.6" +version = "23.7.dev0" [project.urls] Changelog = "https://github.com/zostera/django-marina/blob/main/CHANGELOG.md" diff --git a/src/django_marina/__about__.py b/src/django_marina/__about__.py index e5cc4b7..2c02b64 100644 --- a/src/django_marina/__about__.py +++ b/src/django_marina/__about__.py @@ -1 +1,3 @@ -__version__ = "23.6.dev0" +import importlib.metadata + +__version__ = importlib.metadata.version(__package__ or __name__)