diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 5a68950709..5668430ad7 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -14,6 +14,3 @@ build: os: ubuntu-22.04 tools: python: "3.11" - jobs: - pre_build: - - towncrier build --yes --date TBA diff --git a/doc/conf.py b/doc/conf.py index 096af48c82..6eb52fed34 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -7,6 +7,7 @@ import os import sys from datetime import datetime +from pathlib import Path # Pylint documentation build configuration file, created by # sphinx-quickstart on Thu Apr 4 20:31:25 2013. @@ -32,6 +33,18 @@ # pylint: enable=wrong-import-position +# -- Path setup -------------------------------------------------------------- + +PROJECT_ROOT_DIR = Path(__file__).parents[1].resolve() +IS_RELEASE_ON_RTD = ( + os.getenv("READTHEDOCS", "False") == "True" + and os.environ["READTHEDOCS_VERSION_TYPE"] == "tag" +) +if IS_RELEASE_ON_RTD: + tags: set[str] + # pylint: disable-next=used-before-assignment + tags.add("is_release") # noqa: F821 + # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. @@ -47,6 +60,7 @@ "sphinx.ext.autosectionlabel", "sphinx.ext.intersphinx", "sphinx_reredirects", + "sphinxcontrib.towncrier.ext", ] @@ -305,3 +319,11 @@ linkcheck_ignore = [ "https://github.com/pylint-dev/pylint/blob/main/pylint/extensions/.*" ] + +# -- Options for towncrier_draft extension ----------------------------------- + +# or: 'sphinx-version', 'sphinx-release' +towncrier_draft_autoversion_mode = "draft" +towncrier_draft_include_empty = True +towncrier_draft_working_directory = PROJECT_ROOT_DIR +towncrier_draft_config_path = "towncrier.toml" # relative to cwd diff --git a/doc/requirements.txt b/doc/requirements.txt index c72ed192d5..4f49e9d1e9 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,5 +1,5 @@ Sphinx==7.2.6 sphinx-reredirects<1 -towncrier~=23.11 +sphinxcontrib-towncrier ~= 0.4.0a0 furo==2024.1.29 -e . diff --git a/doc/whatsnew/3/3.2/index.rst b/doc/whatsnew/3/3.2/index.rst index 4448c71172..4e750ef255 100644 --- a/doc/whatsnew/3/3.2/index.rst +++ b/doc/whatsnew/3/3.2/index.rst @@ -13,4 +13,18 @@ Summary -- Release highlights ============================= -.. towncrier release notes start +.. only:: not is_release + + *To be included in the next release* + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + .. towncrier-draft-entries:: |release| :sub:`/UNRELEASED DRAFT/` + + Released versions + ^^^^^^^^^^^^^^^^^ + + .. towncrier release notes start + +.. only:: is_release + + .. towncrier release notes start