diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b17a712d5..486641c75 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -165,6 +165,7 @@ repos: - sphinx - types-docutils - types-PyYAML + - types-setuptools args: - --python-version=3.10 pass_filenames: false @@ -179,6 +180,7 @@ repos: - types-dataclasses # Needed for checking py3.6 with a later interpreter - types-docutils - types-PyYAML + - types-setuptools args: - --python-version=3.6 diff --git a/docs/conf.py b/docs/conf.py index f5bf5a71c..98fef09e0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -3,17 +3,15 @@ # Ref: https://www.sphinx-doc.org/en/master/usage/configuration.html """Configuration file for the Sphinx docs.""" -from functools import partial + +from importlib.metadata import version as get_version from pathlib import Path from sys import path -from setuptools_scm import get_version - # -- Path setup -------------------------------------------------------------- PROJECT_ROOT_DIR = Path(__file__).parents[1].resolve() -get_scm_version = partial(get_version, root=PROJECT_ROOT_DIR) # Make in-tree extension importable in non-tox setups/envs, like RTD. # Refs: @@ -36,23 +34,20 @@ author = f"{project} project contributors" copyright = author # pylint:disable=redefined-builtin -# fmt: off +NAVIGATOR_VERSION = get_version("ansible_navigator") + # The short X.Y version -version = ".".join( - get_scm_version( - local_scheme="no-local-version", - ).split(".")[:3], -) +# including .Z, resulting in the X.Y.Z version +version = ".".join(NAVIGATOR_VERSION.split(".")[:3]) # The full version, including alpha/beta/rc tags -release = get_scm_version() +release = NAVIGATOR_VERSION rst_epilog = f""" .. |project| replace:: {project} .. |release_l| replace:: ``v{release}`` """ - # -- General configuration --------------------------------------------------- @@ -277,8 +272,8 @@ "substitution", # replace common ASCII shortcuts into their symbols ] myst_substitutions = { - "project": project, - "release": release, - "release_l": f"`v{release}`", - "version": version, + "project": project, + "release": release, + "release_l": f"`v{release}`", + "version": version, } diff --git a/pyproject.toml b/pyproject.toml index 242434364..54fc56003 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,8 @@ name = "Contributor-facing changes" showcontent = true +[build-system] +requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"] [tool.black] line-length = 100 @@ -95,3 +97,5 @@ skip_glob = ["tests/fixtures/common/collections*"] # Skip ansible content due to [tool.pylint.format] max-line-length = 100 + +[tool.setuptools_scm]