Browse Source

Merge branch 'master' into altendky-patch-1

pull/330/head
Adi Roiban 6 months ago committed by GitHub
parent
commit
d09d7aa189
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      .github/workflows/ci.yml
  2. 14
      CONTRIBUTING.rst
  3. 67
      NEWS.rst
  4. 6
      README.rst
  5. 10
      setup.py
  6. 18
      src/towncrier/_settings.py
  7. 2
      src/towncrier/_shell.py
  8. 2
      src/towncrier/_version.py
  9. 1
      src/towncrier/_writer.py
  10. 2
      src/towncrier/check.py
  11. 1
      src/towncrier/newsfragments/126.feature
  12. 1
      src/towncrier/newsfragments/163.bugfix
  13. 2
      src/towncrier/newsfragments/165.feature.rst
  14. 1
      src/towncrier/newsfragments/167.misc
  15. 2
      src/towncrier/newsfragments/172.doc.rst
  16. 3
      src/towncrier/newsfragments/173.feature.rst
  17. 2
      src/towncrier/newsfragments/175.bugfix.rst
  18. 1
      src/towncrier/newsfragments/180.bugfix
  19. 1
      src/towncrier/newsfragments/275.feature
  20. 1
      src/towncrier/newsfragments/277.doc.rst
  21. 0
      src/towncrier/newsfragments/279.misc.rst
  22. 0
      src/towncrier/newsfragments/286.misc.rst
  23. 0
      src/towncrier/newsfragments/287.misc.rst
  24. 1
      src/towncrier/newsfragments/291.feature.rst
  25. 0
      src/towncrier/newsfragments/291.misc.rst
  26. 0
      src/towncrier/newsfragments/293.misc.rst
  27. 0
      src/towncrier/newsfragments/295.misc.rst
  28. 2
      src/towncrier/newsfragments/297.feature.rst
  29. 0
      src/towncrier/newsfragments/299.misc.rst
  30. 0
      src/towncrier/newsfragments/305.misc.rst
  31. 1
      src/towncrier/newsfragments/314.feature.rst
  32. 0
      src/towncrier/newsfragments/315.misc.rst
  33. 1
      src/towncrier/newsfragments/316.misc.rst
  34. 0
      src/towncrier/newsfragments/317.misc.rst
  35. 1
      src/towncrier/newsfragments/324.misc.rst
  36. 0
      src/towncrier/newsfragments/327.misc.rst
  37. 1
      src/towncrier/newsfragments/329.misc.rst
  38. 0
      src/towncrier/newsfragments/331.misc
  39. 1
      src/towncrier/newsfragments/84.bugfix.rst
  40. 1
      src/towncrier/newsfragments/85.bugfix.rst
  41. 9
      src/towncrier/test/test_project.py

7
.github/workflows/ci.yml

@ -73,9 +73,6 @@ jobs:
- name: CPython 3.5
tox: py35
action: 3.5
- name: CPython 3.6
tox: py36
action: 3.6
- name: CPython 3.7
tox: py37
action: 3.7
@ -88,9 +85,6 @@ jobs:
- name: PyPy 2.7
tox: pypy27
action: pypy-2.7
- name: PyPy 3.6
tox: pypy36
action: pypy-3.6
- name: PyPy 3.7
tox: pypy37
action: pypy-3.7
@ -176,7 +170,6 @@ jobs:
needs:
- build
- test
- check
steps:
- uses: actions/checkout@v2

14
CONTRIBUTING.rst

@ -75,9 +75,19 @@ Step-by-step
- Edit ``src/towncrier/_version.py`` such as ``__version__ = Version('towncrier', 19, 9, 0)`` to remove the release candidate indication.
- Return to the towncrier build step and continue.
- Manually update the NEWS.rst by removing the `.rcN` version and update the release date.
- If the final release has been completed, continue below.
- Disable the actual check for `tox -e check-newsfragment` so that you will have a green test run.
- Commit and push the changes to trigger the CI tests and make sure all are green.
- Tag as ``19.9.0`` and push the tag to the primary repository.
- This will result in another build which will publish to PyPI for the final release.
- Confirm the presence of the release on PyPI.
- If the final release has been completed, re-enable `tox -e check-newsfragment`.
- Increment the patch version by one and set to a development version.

67
NEWS.rst

@ -2,6 +2,73 @@
.. towncrier release notes start
towncrier 21.9.0 (2022-02-04)
=============================
Features
--------
- towncrier --version` was added to the command line interface to show the product version. (`#339 <https://github.com/hawkowl/towncrier/issues/339>`_)
- Support Toml v1 syntax with tomli on Python 3.6+ (`#354 <https://github.com/hawkowl/towncrier/issues/354>`_)
Bugfixes
--------
- Stop writing title twice when ``title_format`` is specified. (`#346 <https://github.com/hawkowl/towncrier/issues/346>`_)
- Disable universal newlines when reading TOML (`#359 <https://github.com/hawkowl/towncrier/issues/359>`_)
Misc
----
- `#332 <https://github.com/hawkowl/towncrier/issues/332>`_, `#333 <https://github.com/hawkowl/towncrier/issues/333>`_, `#334 <https://github.com/hawkowl/towncrier/issues/334>`_, `#338 <https://github.com/hawkowl/towncrier/issues/338>`_
towncrier 21.3.0 (2021-04-02)
=============================
No significant changes since the previous release candidate.
towncrier 21.3.0.rc1 (2021-03-21)
=================================
Features
--------
- Ticket number from file names will be stripped down to avoid ticket links such as ``#007``. (`#126 <https://github.com/hawkowl/towncrier/issues/126>`_)
- Allow definition of the project ``version`` and ``name`` in the configuration file.
This allows use of towncrier seamlessly with non-Python projects. (`#165 <https://github.com/hawkowl/towncrier/issues/165>`_)
- Improve news fragment file name parsing to allow using file names like
``123.feature.1.ext`` which are convenient when one wants to use an appropriate
extension (e.g. ``rst``, ``md``) to enable syntax highlighting. (`#173 <https://github.com/hawkowl/towncrier/issues/173>`_)
- The new ``--edit`` option of the ``create`` subcommand launches an editor for entering the contents of the newsfragment. (`#275 <https://github.com/hawkowl/towncrier/issues/275>`_)
- CPython 3.8 and 3.9 are now part of our automated test matrix and are officially supported. (`#291 <https://github.com/hawkowl/towncrier/issues/291>`_)
- When searching for the project, first check for an existing importable instance.
This helps if the version is only available in the installed version and not the source. (`#297 <https://github.com/hawkowl/towncrier/issues/297>`_)
- Support building with PEP 517. (`#314 <https://github.com/hawkowl/towncrier/issues/314>`_)
Bugfixes
--------
- Configuration errors found during command line execution now trigger a message to stderr and no longer show a traceback. (`#84 <https://github.com/hawkowl/towncrier/issues/84>`_)
- A configuration error is triggered when the newsfragment files couldn't be discovered. (`#85 <https://github.com/hawkowl/towncrier/issues/85>`_)
- Invoking towncrier as `python -m towncrier` works. (`#163 <https://github.com/hawkowl/towncrier/issues/163>`_)
- ``check`` subcommand defaults to UTF-8 encoding when ``sys.stdout.encoding`` is ``None``.
This happens, for example, with Python 2 on GitHub Actions or when the output is piped. (`#175 <https://github.com/hawkowl/towncrier/issues/175>`_)
- Specifying ``title_format`` disables default top line creation to avoid duplication. (`#180 <https://github.com/hawkowl/towncrier/issues/180>`_)
Improved Documentation
----------------------
- The README now mentions the possibility to name the configuration file
``towncrier.toml`` (in addition to ``pyproject.toml``). (`#172 <https://github.com/hawkowl/towncrier/issues/172>`_)
- ``start_line`` corrected to ``start_string`` in the readme to match the long standing implementation. (`#277 <https://github.com/hawkowl/towncrier/issues/277>`_)
towncrier 19.9.0 (2021-03-20)
=============================

6
README.rst

@ -34,7 +34,7 @@ Install from PyPI::
.. note::
``towncrier``, as a command line tool, works on Python 3.5+ only.
``towncrier``, as a command line tool, works on Python 2.7 and 3.5+ only.
It is usable by projects written in other languages, provided you specify the project version either in the configuration file or on the command line.
For Python 2/3 compatible projects, the version can be discovered automatically.
@ -144,7 +144,7 @@ Towncrier has the following global options, which can be specified in the toml f
start_string = "Text used to detect where to add the generated content in the middle of a file. Generated content added after this text. Newline auto added."
title_format = "{name} {version} ({project_date})" # or false if template includes title
issue_format = "format string for {issue} (issue is the first part of fragment name)"
underlines: "=-~"
underlines = "=-~"
wrap = false # Wrap text to 79 characters
all_bullets = true # make all fragments bullet points
@ -162,4 +162,4 @@ Furthermore, you can add your own fragment types using:
[[tool.towncrier.type]]
directory = "deprecation"
name = "Deprecations"
showcontent = true
showcontent = true

10
setup.py

@ -41,7 +41,15 @@ setup(
"Programming Language :: Python :: Implementation :: PyPy",
],
use_incremental=True,
install_requires=["click", "click-default-group", "incremental", "jinja2", "toml"],
install_requires=[
"click",
"click-default-group",
"incremental",
"jinja2",
"setuptools",
"toml; python_version < '3.6'",
"tomli; python_version >= '3.6'",
],
extras_require={"dev": ["packaging"]},
package_dir={"": "src"},
packages=find_packages("src"),

18
src/towncrier/_settings.py

@ -1,9 +1,16 @@
# Copyright (c) Amber Brown, 2015
# See LICENSE for details.
import io
import os
import sys
import pkg_resources
import toml
if sys.version_info >= (3, 6):
import tomli
else:
tomli = None
import toml
from collections import OrderedDict
@ -68,9 +75,12 @@ def load_config(directory):
def load_config_from_file(directory, config_file):
with open(config_file, "r") as conffile:
config = toml.load(conffile)
if tomli:
with io.open(config_file, "rb") as conffile:
config = tomli.load(conffile)
else:
with io.open(config_file, "r", encoding="utf8", newline="") as conffile:
config = toml.load(conffile)
return parse_toml(directory, config)

2
src/towncrier/_shell.py

@ -11,9 +11,11 @@ from click_default_group import DefaultGroup
from .build import _main as _build_cmd
from .check import _main as _check_cmd
from .create import _main as _create_cmd
from ._version import __version__
@click.group(cls=DefaultGroup, default="build", default_if_no_args=True)
@click.version_option(__version__.public())
def cli():
pass

2
src/towncrier/_version.py

@ -7,5 +7,5 @@ Provides towncrier version information.
from incremental import Version
__version__ = Version("towncrier", 21, 3, 0, dev=4)
__version__ = Version("towncrier", 21, 9, 1, dev=0)
__all__ = ["__version__"]

1
src/towncrier/_writer.py

@ -38,7 +38,6 @@ def append_to_newsfile(
if start_string:
f.write((u"\n\n" + start_string + u"\n").encode("utf8"))
f.write(top_line.encode("utf8"))
f.write(content.encode("utf8"))
if existing_content:
if existing_content[0]:

2
src/towncrier/check.py

@ -66,8 +66,6 @@ def __main(comparewith, directory, config):
click.echo("{}. {}".format(n, change))
click.echo("----")
fragments = set()
if config.get("directory"):
fragment_base_directory = os.path.abspath(config["directory"])
fragment_directory = None

1
src/towncrier/newsfragments/126.feature

@ -1 +0,0 @@
Ticket number from file names will be stripped down to avoid ticket links such as ``#007``.

1
src/towncrier/newsfragments/163.bugfix

@ -1 +0,0 @@
Invoking towncrier as `python -m towncrier` works.

2
src/towncrier/newsfragments/165.feature.rst

@ -1,2 +0,0 @@
Allow definition of the project ``version`` and ``name`` in the configuration file.
This allows use of towncrier seamlessly with non-Python projects.

1
src/towncrier/newsfragments/167.misc

@ -1 +0,0 @@

2
src/towncrier/newsfragments/172.doc.rst

@ -1,2 +0,0 @@
The README now mentions the possibility to name the configuration file
``towncrier.toml`` (in addition to ``pyproject.toml``).

3
src/towncrier/newsfragments/173.feature.rst

@ -1,3 +0,0 @@
Improve news fragment file name parsing to allow using file names like
``123.feature.1.ext`` which are convenient when one wants to use an appropriate
extension (e.g. ``rst``, ``md``) to enable syntax highlighting.

2
src/towncrier/newsfragments/175.bugfix.rst

@ -1,2 +0,0 @@
``check`` subcommand defaults to UTF-8 encoding when ``sys.stdout.encoding`` is ``None``.
This happens, for example, with Python 2 on GitHub Actions or when the output is piped.

1
src/towncrier/newsfragments/180.bugfix

@ -1 +0,0 @@
Specifying ``title_format`` disables default top line creation to avoid duplication.

1
src/towncrier/newsfragments/275.feature

@ -1 +0,0 @@
The new ``--edit`` option of the ``create`` subcommand launches an editor for entering the contents of the newsfragment.

1
src/towncrier/newsfragments/277.doc.rst

@ -1 +0,0 @@
``start_line`` corrected to ``start_string`` in the readme to match the long standing implementation.

0
src/towncrier/newsfragments/279.misc.rst

0
src/towncrier/newsfragments/286.misc.rst

0
src/towncrier/newsfragments/287.misc.rst

1
src/towncrier/newsfragments/291.feature.rst

@ -1 +0,0 @@
CPython 3.8 and 3.9 are now part of our automated test matrix and are officially supported.

0
src/towncrier/newsfragments/291.misc.rst

0
src/towncrier/newsfragments/293.misc.rst

0
src/towncrier/newsfragments/295.misc.rst

2
src/towncrier/newsfragments/297.feature.rst

@ -1,2 +0,0 @@
When searching for the project, first check for an existing importable instance.
This helps if the version is only available in the installed version and not the source.

0
src/towncrier/newsfragments/299.misc.rst

0
src/towncrier/newsfragments/305.misc.rst

1
src/towncrier/newsfragments/314.feature.rst

@ -1 +0,0 @@
Support building with PEP 517.

0
src/towncrier/newsfragments/315.misc.rst

1
src/towncrier/newsfragments/316.misc.rst

@ -1 +0,0 @@

0
src/towncrier/newsfragments/317.misc.rst

1
src/towncrier/newsfragments/324.misc.rst

@ -1 +0,0 @@

0
src/towncrier/newsfragments/327.misc.rst

1
src/towncrier/newsfragments/329.misc.rst

@ -1 +0,0 @@

0
src/towncrier/newsfragments/331.misc

1
src/towncrier/newsfragments/84.bugfix.rst

@ -1 +0,0 @@
Configuration errors found during command line execution now trigger a message to stderr and no longer show a traceback.

1
src/towncrier/newsfragments/85.bugfix.rst

@ -1 +0,0 @@
A configuration error is triggered when the newsfragment files couldn't be discovered.

9
src/towncrier/test/test_project.py

@ -116,6 +116,13 @@ class InvocationTests(TestCase):
os.makedirs("news")
out = check_output([sys.executable, "-m", "towncrier", "--help"])
self.assertIn(b"[OPTIONS] COMMAND [ARGS]...", out)
self.assertIn(b"--help Show this message and exit.", out)
self.assertRegex(out, br".*--help\s+Show this message and exit.")
finally:
os.chdir(orig_dir)
def test_version(self):
"""
`--version` command line option is available to show the current production version.
"""
out = check_output(["towncrier", "--version"])
self.assertTrue(out.startswith(b"towncrier, version 2"))

Loading…
Cancel
Save