| 1 |
.. image:: https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct-team.svg |
| 2 |
:target: https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md |
| 3 |
:alt: SWUbanner |
| 4 |
|
| 5 |
.. image:: https://img.shields.io/pypi/v/sphinxcontrib-towncrier.svg?logo=Python&logoColor=white |
| 6 |
:target: https://pypi.org/project/sphinxcontrib-towncrier |
| 7 |
:alt: sphinxcontrib-towncrier @ PyPI |
| 8 |
|
| 9 |
.. image:: https://github.com/sphinx-contrib/sphinxcontrib-towncrier/actions/workflows/ci-cd.yml/badge.svg?event=push |
| 10 |
:target: https://github.com/sphinx-contrib/sphinxcontrib-towncrier/actions/workflows/ci-cd.yml |
| 11 |
:alt: GitHub Actions CI/CD build status — Python package |
| 12 |
|
| 13 |
.. image:: https://codecov.io/gh/sphinx-contrib/sphinxcontrib-towncrier/branch/master/graph/badge.svg |
| 14 |
:target: https://codecov.io/gh/sphinx-contrib/sphinxcontrib-towncrier |
| 15 |
:alt: sphinxcontrib-towncrier coverage charts @ Covecov.io |
| 16 |
|
| 17 |
.. DO-NOT-REMOVE-docs-badges-END |
| 18 |
|
| 19 |
.. image:: https://img.shields.io/readthedocs/sphinxcontrib-towncrier/latest.svg?logo=Read%20The%20Docs&logoColor=white |
| 20 |
:target: https://sphinxcontrib-towncrier.rtfd.io/en/latest/?badge=latest |
| 21 |
:alt: Documentation Status @ RTD |
| 22 |
|
| 23 |
sphinxcontrib-towncrier |
| 24 |
======================= |
| 25 |
|
| 26 |
.. DO-NOT-REMOVE-docs-intro-START |
| 27 |
|
| 28 |
An RST directive for injecting a Towncrier-generated changelog draft |
| 29 |
containing fragments for the unreleased (next) project version. |
| 30 |
|
| 31 |
|
| 32 |
How to use this? |
| 33 |
---------------- |
| 34 |
|
| 35 |
.. code-block:: shell-session |
| 36 |
|
| 37 |
$ pip install sphinxcontrib-towncrier |
| 38 |
|
| 39 |
.. code-block:: python |
| 40 |
|
| 41 |
extensions = ['sphinxcontrib.towncrier.ext'] |
| 42 |
|
| 43 |
# Options: draft/sphinx-version/sphinx-release |
| 44 |
towncrier_draft_autoversion_mode = 'draft' |
| 45 |
towncrier_draft_include_empty = True |
| 46 |
towncrier_draft_working_directory = PROJECT_ROOT_DIR |
| 47 |
# Not yet supported: |
| 48 |
# towncrier_draft_config_path = 'pyproject.toml' # relative to cwd |
| 49 |
|
| 50 |
Make sure to point to the dir with ``pyproject.toml`` and pre-configure |
| 51 |
towncrier itself in the config. |
| 52 |
|
| 53 |
If everything above is set up correctly, you should be able to add |
| 54 |
|
| 55 |
.. code-block:: rst |
| 56 |
|
| 57 |
.. towncrier-draft-entries:: |
| 58 |
|
| 59 |
to your documents, like ``changelog.rst``. With no argument, the version |
| 60 |
title will be generated using the strategy set up in the |
| 61 |
``towncrier_draft_autoversion_mode`` setting. |
| 62 |
|
| 63 |
If you want to be in control, override it with an argument you like: |
| 64 |
|
| 65 |
.. code-block:: rst |
| 66 |
|
| 67 |
.. towncrier-draft-entries:: |release| [UNRELEASED DRAFT] |
| 68 |
|
| 69 |
Native RST substitutions in the argument work, just make sure to declare |
| 70 |
any non-default ones via ``rst_epilog`` or at the end of the document |
| 71 |
where the ``towncrier-draft-entries`` directive is being used. |
| 72 |
|
| 73 |
|
| 74 |
Does anybody actually use this? |
| 75 |
------------------------------- |
| 76 |
|
| 77 |
So far we know about two projects using ``sphinxcontrib-towncrier`` — |
| 78 |
ansible/pylibssh and pypa/pip. Also, this Sphinx extension is inspired |
| 79 |
by and somewhat based on the ideas used in pytest-dev/pytest and |
| 80 |
tox-dev/tox. We believe that these projects are full of wonderful tricks |
| 81 |
that you may want to explore regardless of whether you'll use our |
| 82 |
project. |