Skip to content

Commit

Permalink
Merge branch 'master' into altendky-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
glyph authored Mar 15, 2022
2 parents c913812 + 6b1527b commit 3de3f5f
Show file tree
Hide file tree
Showing 16 changed files with 717 additions and 25 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ exclude src/towncrier/newsfragments
recursive-exclude bin *
recursive-exclude admin *
recursive-exclude src/towncrier/newsfragments *
recursive-exclude docs *
18 changes: 13 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Hear ye, hear ye, says the ``towncrier``
``towncrier`` is a utility to produce useful, summarised news files for your project.
Rather than reading the Git history as some newer tools to produce it, or having one single file which developers all write to, ``towncrier`` reads "news fragments" which contain information `useful to end users`.

Used by `Twisted <https://github.com/twisted/twisted>`_, `pytest <https://github.com/pytest-dev/pytest/>`_, `pip <https://github.com/pypa/pip/>`_, `BuildBot <https://github.com/buildbot/buildbot>`_, and `attrs <https://github.com/python-attrs/attrs>`_, among others.


Philosophy
----------
Expand Down Expand Up @@ -154,15 +156,21 @@ If ``title_format`` is unspecified or an empty string, the default format will b
If set to ``false``, no title will be created.
This can be useful if the specified template creates the title itself.

Furthermore, you can add your own fragment types using:
Furthermore, you can customize each of your own fragment types using:

.. code-block:: toml
[tool.towncrier]
[[tool.towncrier.type]]
directory = "deprecation"
name = "Deprecations"
showcontent = true
# To add custom fragment types, with default setting, just add an empty section.
[tool.towncrier.feat]
[tool.towncrier.fix]
# Custom fragment types can have custom attributes
# that are used when rendering the result based on the template.
[tool.towncrier.chore]
name = "Other Tasks"
showcontent = false
Automatic pull request checks
Expand Down
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_build
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = Towncrier
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
171 changes: 171 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# -*- coding: utf-8 -*-
#
# Towncrier documentation build configuration file, created by
# sphinx-quickstart on Mon Aug 21 20:46:13 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'Towncrier'
copyright = u'2017, Amber Brown'
author = u'Amber Brown'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'17.08'
# The full version, including alpha/beta/rc tags.
release = u'17.08'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False


# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
'donate.html',
]
}


# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'Towncrierdoc'


# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'Towncrier.tex', u'Towncrier Documentation',
u'Amber Brown', 'manual'),
]


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'towncrier', u'Towncrier Documentation',
[author], 1)
]


# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'Towncrier', u'Towncrier Documentation',
author, 'Towncrier', 'One line description of project.',
'Miscellaneous'),
]



96 changes: 96 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
Configuration Reference
=======================

``towncrier`` has many knobs and switches you can use, to customise it to your project's needs.
The setup in the `Quick Start <quickstart.html>`_ doesn't touch on many, but this document will detail each of these options for you!

For how to perform common customisation tasks, see `Customisation <customisation/index.html>`_.

``[tool.towncrier]``
--------------------

All configuration for ``towncrier`` sits inside ``pyproject.toml``, under the ``tool.towncrier`` namespace.
Please see `the TOML GitHub repo <https://github.com/toml-lang/toml>`_ for how to write TOML.

Top level keys
~~~~~~~~~~~~~~

- ``package`` -- The package name of your project. (Python projects only)
- ``package_dir`` -- The folder your package lives. ``./`` by default, some projects might need to use ``src``. (Python projects only)
- ``newsfile`` -- The filename of your news file. ``NEWS.rst`` by default.
- ``fragment_directory`` -- If you are not storing your newsfragments in your Python package, or aren't using Python, this is the path to where your newsfragments will be put.
- ``template`` -- Path to an alternate template for generating the newsfile, if you have one.
- ``start_line`` -- The magic string that ``towncrier`` looks for when considering where the release notes should start. ``.. towncrier release notes start`` by default.
- ``title_format`` -- A format string for the title of your project. ``{name} {version} ({project_date})`` by default.
- ``issue_format`` -- A format string for rendering the issue/ticket number in newsfiles. ``#{issue}`` by default.
- ``underlines`` -- The characters used for underlining headers. ``["=", "-", "~"]`` by default.

Custom fragment types
---------------------
``Towncrier`` allows defining custom fragment types. Custom fragment types
will be used instead ``towncrier`` default ones, they are not combined.

Users can configure each of their own custom fragment types by adding tables to
the pyproject.toml named ``[tool.towncrier.type.<a custom fragment type>]``.

These tables may include the following optional keys:

* ``name``: The description of the fragment type, as it must be included
in the news file. If omitted, it defaults to its fragment type,
but capitalized.
* ``showcontent``: Whether if the fragment contents should be included in the
news file. If omitted, it defaults to ``true``



For example, if you want your custom fragment types to be
``["feat", "fix", "chore",]`` and you want all
of them to use the default configuration except ``"chore"`` you can do it as
follows:


.. code-block:: toml
[tool.towncrier]
[tool.towncrier.fragment.feat]
[tool.towncrier.fragment.fix]
[tool.towncrier.fragment.chore]
name = "Other Tasks"
showcontent = false
DEPRECATED: Defining custom fragment types with an array of toml tables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Users can create their own custom fragment types by adding an array of
tables to the pyproject.toml named ``[[tool.towncrier.type]]``.

If still using this way to configure custom fragment types,
please notice that ``fragment_types`` must be empty or not provided.

Each custom type (``[[tool.towncrier.type]]``) has the following
mandatory keys:
* ``directory``: The type of the fragment.
* ``name``: The description of the fragment type, as it must be included
in the news file.
* ``showcontent``: Whether if the fragment contents should be included in the
news file.



For example:

.. code-block:: toml
[tool.towncrier]
[[tool.towncrier.type]]
directory = "deprecation"
name = "Deprecations"
showcontent = true
[[tool.towncrier.type]]
directory = "chore"
name = "Other Tasks"
showcontent = false
10 changes: 10 additions & 0 deletions docs/customisation/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Customising ``towncrier``
=========================

``towncrier`` can be customised to suit your project's needs.
These pages should describe common customisation tasks, while if you want a reference, see `Configuration <../configuration.html>`_.

.. toctree::
:maxdepth: 2

newsfile
27 changes: 27 additions & 0 deletions docs/customisation/newsfile.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Customising the News File Output
================================

Adding Content Above ``towncrier``
----------------------------------

If you wish to have content at the top of the news file (for example, to say where you can find the tickets), you can use a special rST comment to tell ``towncrier`` to only update after it.
In your existing news file (e.g. ``NEWS.rst``), add the following line above where you want ``towncrier`` to put content::

.. towncrier release notes start

In an existing news file, it'll look something like this::

This is the changelog of my project. You can find the
issue tracker at http://blah.

.. towncrier release notes start

myproject 1.0.2 (2018-01-01)
============================

Bugfixes
--------

- Fixed, etc...

``towncrier`` will not alter content above the comment.
8 changes: 8 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. include:: ../README.rst

.. toctree::
:maxdepth: 2

quickstart
customisation/index
configuration
Loading

0 comments on commit 3de3f5f

Please sign in to comment.