Skip to content

Commit

Permalink
Display changelog for unreleased version in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
webknjaz committed Apr 25, 2021
1 parent 3603b28 commit b2c1420
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
from functools import partial
from pathlib import Path

from setuptools_scm import get_version


extensions = ['sphinx.ext.autodoc', 'jaraco.packaging.sphinx', 'rst.linker']

master_doc = "index"
Expand Down Expand Up @@ -99,3 +105,27 @@

# Add support for inline tabs
extensions += ['sphinx_inline_tabs']

# Add support for the unreleased "next-version" change notes
extensions += ['sphinxcontrib.towncrier']


# -- Options for towncrier_draft extension --------------------------------------------

PROJECT_ROOT_DIR = Path(__file__).parents[1].resolve()
get_scm_version = partial(get_version, root=PROJECT_ROOT_DIR)

# The short X.Y version
version = '.'.join(
get_scm_version(
local_scheme='no-local-version',
).split('.')[:3],
)

# The full version, including alpha/beta/rc tags
release = get_scm_version()

towncrier_draft_autoversion_mode = "draft" # or: 'sphinx-release', 'sphinx-version'
towncrier_draft_include_empty = True
towncrier_draft_working_directory = PROJECT_ROOT_DIR
# Not yet supported: towncrier_draft_config_path = 'pyproject.toml' # relative to cwd
2 changes: 2 additions & 0 deletions docs/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
History
*******

.. towncrier-draft-entries:: |release|, unreleased as on |today|

.. include:: ../CHANGES (links).rst

Credits
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ docs =

# local
pygments-github-lexers==0.0.5
setuptools-scm
sphinx-inline-tabs
sphinxcontrib-towncrier

ssl =
wincertstore==0.2; sys_platform=='win32'
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ deps =
commands =
pytest {posargs}
usedevelop = True
deps = setuptools-scm
extras = testing
setenv =
COVERAGE_FILE={toxworkdir}/.coverage.{envname}
Expand Down

0 comments on commit b2c1420

Please sign in to comment.