Skip to content

Commit 24dd720

Browse files
authored
Try to fix ReadTheDocs Sphinx build that is having problems getting the version from setuptools-scm (#1342)
1 parent 54219d4 commit 24dd720

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

.readthedocs.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ formats: all
2828
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
2929
python:
3030
install:
31-
- requirements: docs/requirements.txt
31+
- method: pip
32+
path: .
33+
extra_requirements:
34+
- docs

docs/conf.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"""
2020

2121
import sys
22+
from importlib.metadata import version as get_version
2223
from os.path import abspath, dirname
2324

2425
# Make sure we get the version of this copy of cmd2
@@ -27,8 +28,6 @@
2728
# Import for custom theme from Read the Docs
2829
import sphinx_rtd_theme
2930

30-
import cmd2
31-
3231
# -- General configuration -----------------------------------------------------
3332

3433
# If your documentation needs a minimal Sphinx version, state it here.
@@ -66,10 +65,10 @@
6665
# |version| and |release|, also used in various other places throughout the
6766
# built documents.
6867
#
69-
# version will look like x.y.z
70-
version = cmd2.__version__
71-
# release will look like x.y
72-
release = '.'.join(version.split('.')[:2])
68+
# release will look like x.y.z
69+
release: str = get_version("cmd2")
70+
# for example take major/minor
71+
version: str = ".".join(release.split('.')[:2])
7372

7473
# The language for content autogenerated by Sphinx. Refer to documentation
7574
# for a list of supported languages.

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
pyperclip
33
setuptools
4-
setuptools-scm<8
4+
setuptools-scm
55
Sphinx
66
sphinx-autobuild
77
sphinx-rtd-theme

setup.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@
7777
'ruff',
7878
'twine',
7979
],
80+
'docs': [
81+
'setuptools',
82+
'setuptools_scm',
83+
'sphinx',
84+
'sphinx-rtd-theme',
85+
'sphinx-autobuild',
86+
],
8087
'validate': [
8188
'mypy',
8289
'ruff',

0 commit comments

Comments
 (0)