diff --git a/{{ cookiecutter.package_name }}/docs/conf.py b/{{ cookiecutter.package_name }}/docs/conf.py index e595c98..fb8fa45 100644 --- a/{{ cookiecutter.package_name }}/docs/conf.py +++ b/{{ cookiecutter.package_name }}/docs/conf.py @@ -6,12 +6,22 @@ import datetime +from packaging.version import Version + # -- Project information ----------------------------------------------------- # The full version, including alpha/beta/rc tags from {{ cookiecutter.module_name }} import __version__ -release = __version__ +_version = Version(__version__) +version = release = str(_version) +# Avoid "post" appearing in version string in rendered docs +if _version.is_postrelease: + version = release = _version.base_version +# Avoid long githashes in rendered Sphinx docs +elif _version.is_devrelease: + version = release = f'{_version.base_version}.dev{_version.dev}' +is_development = _version.is_devrelease project = "{{ cookiecutter.package_name }}" author = "{{ cookiecutter.author_name }}" diff --git a/{{ cookiecutter.package_name }}/pyproject.toml b/{{ cookiecutter.package_name }}/pyproject.toml index 4635dd1..5054519 100644 --- a/{{ cookiecutter.package_name }}/pyproject.toml +++ b/{{ cookiecutter.package_name }}/pyproject.toml @@ -42,6 +42,7 @@ tests = [ docs = [ "sphinx", "sphinx-automodapi", + "packaging", ] {%- if cookiecutter.project_url %}