Skip to content

Commit 06344e8

Browse files
committed
Display changelog for unreleased version in docs
1 parent 733f33a commit 06344e8

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

docs/conf.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
from functools import partial
2+
from pathlib import Path
3+
4+
from setuptools_scm import get_version
5+
6+
17
extensions = ['sphinx.ext.autodoc', 'jaraco.packaging.sphinx', 'rst.linker']
28

39
master_doc = "index"
@@ -99,3 +105,27 @@
99105

100106
# Add support for inline tabs
101107
extensions += ['sphinx_inline_tabs']
108+
109+
# Add support for the unreleased "next-version" change notes
110+
extensions += ['sphinxcontrib.towncrier']
111+
112+
113+
# -- Options for towncrier_draft extension --------------------------------------------
114+
115+
PROJECT_ROOT_DIR = Path(__file__).parents[1].resolve()
116+
get_scm_version = partial(get_version, root=PROJECT_ROOT_DIR)
117+
118+
# The short X.Y version
119+
version = '.'.join(
120+
get_scm_version(
121+
local_scheme='no-local-version',
122+
).split('.')[:3],
123+
)
124+
125+
# The full version, including alpha/beta/rc tags
126+
release = get_scm_version()
127+
128+
towncrier_draft_autoversion_mode = "draft" # or: 'sphinx-release', 'sphinx-version'
129+
towncrier_draft_include_empty = True
130+
towncrier_draft_working_directory = PROJECT_ROOT_DIR
131+
# Not yet supported: towncrier_draft_config_path = 'pyproject.toml' # relative to cwd

docs/history.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
History
66
*******
77

8+
.. towncrier-draft-entries:: |release|, unreleased as on |today|
9+
810
.. include:: ../CHANGES (links).rst
911

1012
Credits

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ docs =
7474

7575
# local
7676
pygments-github-lexers==0.0.5
77+
setuptools-scm
7778
sphinx-inline-tabs
79+
sphinxcontrib-towncrier
7880

7981
ssl =
8082
wincertstore==0.2; sys_platform=='win32'

0 commit comments

Comments
 (0)