Skip to content

Commit 4d16631

Browse files
webknjazpradyunsg
andcommitted
Add a preview for the "next release" change notes
This change integrates `sphinxcontrib-towncrier` into the docs build. It uses Towncrier and its configs to render a draft changelog as RST and injects that into the `news.rst` document right above the older changelog entries using `towncrier-draft-entries` directive. Co-Authored-By: Pradyun Gedam <[email protected]>
1 parent a498c13 commit 4d16631

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

docs/html/conf.py

+9
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import glob
1515
import os
16+
import pathlib
1617
import re
1718
import sys
1819

@@ -36,6 +37,7 @@
3637
'sphinx.ext.intersphinx',
3738
# third-party:
3839
'sphinx_inline_tabs',
40+
'sphinxcontrib.towncrier',
3941
# in-tree:
4042
'docs_feedback_sphinxext',
4143
'pip_sphinxext',
@@ -316,3 +318,10 @@ def to_document_name(path, base_dir):
316318
'What content was useful?',
317319
'What content was not useful?',
318320
)
321+
322+
# -- Options for towncrier_draft extension -----------------------------------
323+
324+
towncrier_draft_autoversion_mode = 'draft' # or: 'sphinx-release', 'sphinx-version'
325+
towncrier_draft_include_empty = True
326+
towncrier_draft_working_directory = pathlib.Path(docs_dir).parent
327+
# Not yet supported: towncrier_draft_config_path = 'pyproject.toml' # relative to cwd

docs/html/news.rst

+2
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ Changelog
77
Major and minor releases of pip also include changes listed within
88
prior beta releases.
99

10+
.. towncrier-draft-entries:: |release|, unreleased as on
11+
1012
.. include:: ../../NEWS.rst

news/9172.doc.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Render the unreleased pip version change notes on the news page in docs.

tools/requirements/docs.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
sphinx == 3.2.1
22
furo
33
sphinx-inline-tabs
4+
sphinxcontrib-towncrier
45

56
# `docs.pipext` uses pip's internals to generate documentation. So, we install
67
# the current directory to make it work.

0 commit comments

Comments
 (0)