Skip to main content

Building newsfiles for your project.

Project description

https://travis-ci.org/hawkowl/towncrier.svg?branch=master https://codecov.io/github/hawkowl/towncrier/coverage.svg?branch=master

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.

Philosophy

towncrier delivers the news which is convenient to those that hear it, not those that write it.

That is, by duplicating what has changed from the “developer log” (which may contain complex information about the original issue, how it was fixed, who authored the fix, and who reviewed the fix) into a “news fragment” (a small file containing just enough information to be useful to end users), towncrier can produce a digest of the changes which is valuable to those who may wish to use the software. These fragments are also commonly called “topfiles” or “newsfiles” in Twisted parlance.

towncrier works best in a development system where all merges involve closing a ticket.

Quick Start

Install from PyPI:

python3 -m pip install towncrier
# OR:
python2 -m pip install towncrier

In your project root, add a pyproject.toml file, with the contents:

[tool.towncrier]
    package = "mypackage"
    package_dir = "src"
    filename = "NEWS.rst"

Then put news fragments (see “News Fragments” below) into a “newsfragments” directory under your package (so, if your project is named “myproject”, and it’s kept under src, your newsfragments dir would be src/myproject/newsfragments/).

To prevent git from removing the newsfragments directory, make a .gitignore file in it with:

!.gitignore

This will keep the folder around, but otherwise “empty”.

towncrier needs to know what version your project is, and there are two ways you can give it:

  • For Python 2/3 compatible projects, a __version__ in the top level package. This can be either a string literal, a tuple, or an Incremental version.

  • Manually passing --version=<myversionhere> when interacting with towncrier.

To produce a draft of the news file, run:

towncrier --draft

To produce the news file for real, run:

towncrier

This command will remove the news files (with git rm) and append the built news to the filename specified in towncrier.ini, and then stage the news file changes (with git add). It leaves committing the changes up to the user.

If you wish to have content at the top of the news file (for example, to say where you can find the tickets), put your text above a rST comment that says:

.. towncrier release notes start

towncrier will then put the version notes after this comment, and leave your existing content that was above it where it is.

News Fragments

towncrier has a few standard types of news fragments, signified by the file extension. These are:

  • .feature: Signifying a new feature.

  • .bugfix: Signifying a bug fix.

  • .doc: Signifying a documentation improvement.

  • .removal: Signifying a deprecation or removal of public API.

  • .misc: A ticket has been closed, but it is not of interest to users.

The start of the filename is the ticket number, and the content is what will end up in the news file. For example, if ticket #850 is about adding a new widget, the filename would be myproject/newsfragments/850.feature and the content would be myproject.widget has been added.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

towncrier-17.8.0.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

towncrier-17.8.0-py2.py3-none-any.whl (18.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file towncrier-17.8.0.tar.gz.

File metadata

  • Download URL: towncrier-17.8.0.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for towncrier-17.8.0.tar.gz
Algorithm Hash digest
SHA256 8c0e5949851a9771a50d637b708322d73a4d4090fa354e5cb24a4f7464e81d47
MD5 f210d1f0de65426dd5812fddae944658
BLAKE2b-256 075466d0de4311ead3c5514bf9dafd25cb17816292532d4f486036a807f9c0c8

See more details on using hashes here.

File details

Details for the file towncrier-17.8.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for towncrier-17.8.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bf5752f4c0d61da1f9d8deef0b14f324f04d88053ef35e406b704b2ee0948ebf
MD5 078e9a46a44d44c737e5e9abacee512c
BLAKE2b-256 801c0790764a34d115708a57cfeb0cd2c4fd967d106d327f4c2cae65df5f2e34

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page