From 24dd720e7d33f48764e1be2fe8b8dc2724f889be Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Tue, 22 Oct 2024 22:46:27 -0400 Subject: [PATCH] Try to fix ReadTheDocs Sphinx build that is having problems getting the version from setuptools-scm (#1342) --- .readthedocs.yaml | 5 ++++- docs/conf.py | 11 +++++------ docs/requirements.txt | 2 +- setup.py | 7 +++++++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 9caa5b6c..4c8b13b5 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -28,4 +28,7 @@ formats: all # See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html python: install: - - requirements: docs/requirements.txt + - method: pip + path: . + extra_requirements: + - docs diff --git a/docs/conf.py b/docs/conf.py index 2883c537..f4f3451b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -19,6 +19,7 @@ """ import sys +from importlib.metadata import version as get_version from os.path import abspath, dirname # Make sure we get the version of this copy of cmd2 @@ -27,8 +28,6 @@ # Import for custom theme from Read the Docs import sphinx_rtd_theme -import cmd2 - # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. @@ -66,10 +65,10 @@ # |version| and |release|, also used in various other places throughout the # built documents. # -# version will look like x.y.z -version = cmd2.__version__ -# release will look like x.y -release = '.'.join(version.split('.')[:2]) +# release will look like x.y.z +release: str = get_version("cmd2") +# for example take major/minor +version: str = ".".join(release.split('.')[:2]) # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/requirements.txt b/docs/requirements.txt index 7b1735fc..58a108b5 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,7 +1,7 @@ pyperclip setuptools -setuptools-scm<8 +setuptools-scm Sphinx sphinx-autobuild sphinx-rtd-theme diff --git a/setup.py b/setup.py index dfd1a6ba..7db19ac1 100755 --- a/setup.py +++ b/setup.py @@ -77,6 +77,13 @@ 'ruff', 'twine', ], + 'docs': [ + 'setuptools', + 'setuptools_scm', + 'sphinx', + 'sphinx-rtd-theme', + 'sphinx-autobuild', + ], 'validate': [ 'mypy', 'ruff',