From fac659abd0e0c084411880ece4a6ec531d0154d2 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Tue, 7 Feb 2023 21:39:12 +0100 Subject: [PATCH] Add sphinx towncrier extension and link changelog --- docs/conf.py | 8 ++++++++ docs/index.rst | 1 + docs/pages/changelog.rst | 9 +++++++++ poetry.lock | 18 +++++++++++++++++- pyproject.toml | 1 + 5 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 docs/pages/changelog.rst diff --git a/docs/conf.py b/docs/conf.py index da354ad1..906d3e36 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -10,6 +10,7 @@ import sys from datetime import date +from pathlib import Path from packaging.version import parse as parse_version @@ -46,6 +47,8 @@ "m2r2", # Copyable codeblocks "sphinx_copybutton", + # Towncrier changelog + "sphinxcontrib.towncrier.ext", ] autoclass_content = "both" @@ -104,6 +107,11 @@ # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True +# Towncrier +towncrier_draft_autoversion_mode = "draft" +towncrier_draft_include_empty = True +towncrier_draft_working_directory = Path(__file__).parents[1].resolve() + # -- Other options ----------------------------------------------------------- diff --git a/docs/index.rst b/docs/index.rst index 24de3786..3c54d29b 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -10,6 +10,7 @@ Content pages/installation.rst examples/index.rst pages/faq.rst + pages/changelog.rst pages/contributing.rst pages/code-of-conduct.rst diff --git a/docs/pages/changelog.rst b/docs/pages/changelog.rst new file mode 100644 index 00000000..2ef12e61 --- /dev/null +++ b/docs/pages/changelog.rst @@ -0,0 +1,9 @@ +Changelog +========= + +.. attention:: + Major and minor releases also include the changes specified in prior development releases. + +.. towncrier-draft-entries:: Unreleased changes + +.. mdinclude:: ../../CHANGELOG.md diff --git a/poetry.lock b/poetry.lock index 6dee18ee..33ea1ec3 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1806,6 +1806,22 @@ files = [ lint = ["docutils-stubs", "flake8", "mypy"] test = ["pytest"] +[[package]] +name = "sphinxcontrib-towncrier" +version = "0.3.2a0" +description = "An RST directive for injecting a Towncrier-generated changelog draft containing fragments for the unreleased (next) project version" +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "sphinxcontrib-towncrier-0.3.2a0.tar.gz", hash = "sha256:7cf18ac9c13533fffdb794dab278c6ad845f8c85bfa56942eba077d543885fa6"}, + {file = "sphinxcontrib_towncrier-0.3.2a0-py3-none-any.whl", hash = "sha256:74fc27a24231b56f1e4820a5dcb121a8c69aa6b6a0d2367c61144b9673ebf73a"}, +] + +[package.dependencies] +sphinx = "*" +towncrier = ">=19.2" + [[package]] name = "stdlib-list" version = "0.8.0" @@ -1970,4 +1986,4 @@ testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools" [metadata] lock-version = "2.0" python-versions = ">=3.8.1,<4" -content-hash = "a9286cf85cb10dca02696972f06c557a90e907c085843b3f69a8798e6adb318c" +content-hash = "2d3fd28d705f240b5d49b03b22c870aec07b1b3b4961a6f7fae2a0907a54a116" diff --git a/pyproject.toml b/pyproject.toml index 56d13fcf..79618e96 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,6 +87,7 @@ m2r2 = "^0.3.3.post2" packaging = "^23.0" sphinx-autodoc-typehints = "^1.22" sphinx-copybutton = "^0.5.1" +sphinxcontrib-towncrier = "^0.3.2a0" [tool.poetry.group.docs-ci] optional = true