Merge pull request #2431 from RonnyPfannschmidt/towncrier

initial addition of towncrier
This commit is contained in:
Bruno Oliveira 2017-05-30 12:41:37 -03:00 committed by GitHub
commit ee0844dbd8
13 changed files with 124 additions and 15 deletions

View File

@ -2,13 +2,14 @@ Thanks for submitting a PR, your contribution is really appreciated!
Here's a quick checklist that should be present in PRs:
- [ ] Target: for bug or doc fixes, target `master`; for new features, target `features`;
- [ ] Add a new news fragment into the changelog folder
* name it `$issue_id.$type` for example (588.bug)
* if you don't have an issue_id change it to the pr id after creating the pr
* ensure type is one of `removal`, `feature`, `bugfix`, `vendor`, `doc` or `trivial`
* Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."
- [ ] Target: for `bugfix`, `vendor`, `doc` or `trivial` fixes, target `master`; for removals or features target `features`;
- [ ] Make sure to include reasonable tests for your change if necessary
Unless your change is trivial documentation fix (e.g., a typo or reword of a small section) please:
Unless your change is a trivial or a documentation fix (e.g., a typo or reword of a small section) please:
- [ ] Make sure to include one or more tests for your change;
- [ ] Add yourself to `AUTHORS`;
- [ ] Add a new entry to `CHANGELOG.rst`
* Choose any open position to avoid merge conflicts with other PRs.
* Add a link to the issue you are fixing (if any) using RST syntax.
* The pytest team likes to have people to acknowledged in the `CHANGELOG`, so please add a thank note to yourself ("Thanks @user for the PR") and a link to your GitHub profile. It may sound weird thanking yourself, but otherwise a maintainer would have to do it manually before or after merging instead of just using GitHub's merge button. This makes it easier on the maintainers to merge PRs.

View File

@ -1,9 +1,13 @@
3.1.1 (unreleased)
==================
..
You should *NOT* be adding new change log entries to this file, this
file is managed by towncrier. You *may* edit previous change logs to
fix problems like typo corrections or such.
To add a new change log entry, please see
https://pip.pypa.io/en/latest/development/#adding-a-news-entry
we named the news folder changelog
* Fix encoding errors for unicode warnings in Python 2. (towncrier: 2436.bugfix)
* Fix issue with non-ascii contents in doctest text files. (towncrier: 2434.bugfix)
.. towncrier release notes start
3.1.0 (2017-05-22)

View File

@ -1,6 +1,7 @@
include CHANGELOG.rst
include LICENSE
include AUTHORS
include pyproject.toml
include README.rst
include CONTRIBUTING.rst
@ -9,6 +10,7 @@ include HOWTORELEASE.rst
include tox.ini
include setup.py
recursive-include changelog *
recursive-include scripts *.py
recursive-include scripts *.bat

1
changelog/2390.doc Normal file
View File

@ -0,0 +1 @@
initial addition of towncrier

1
changelog/2434.bugfix Normal file
View File

@ -0,0 +1 @@
Fix issue with non-ascii contents in doctest text files.

1
changelog/2436.bugfix Normal file
View File

@ -0,0 +1 @@
Fix encoding errors for unicode warnings in Python 2.

38
changelog/_template.rst Normal file
View File

@ -0,0 +1,38 @@
{% for section in sections %}
{% set underline = "-" %}
{% if section %}
{{section}}
{{ underline * section|length }}{% set underline = "~" %}
{% endif %}
{% if sections[section] %}
{% for category, val in definitions.items() if category in sections[section] and category != 'trivial' %}
{{ definitions[category]['name'] }}
{{ underline * definitions[category]['name']|length }}
{% if definitions[category]['showcontent'] %}
{% for text, values in sections[section][category]|dictsort(by='value') %}
- {{ text }}{% if category != 'vendor' %} ({{ values|sort|join(', ') }}){% endif %}
{% endfor %}
{% else %}
- {{ sections[section][category]['']|sort|join(', ') }}
{% endif %}
{% if sections[section][category]|length == 0 %}
No significant changes.
{% else %}
{% endif %}
{% endfor %}
{% else %}
No significant changes.
{% endif %}
{% endfor %}

35
pyproject.toml Normal file
View File

@ -0,0 +1,35 @@
[tool.towncrier]
package = "pytest"
filename = "CHANGELOG.rst"
directory = "changelog/"
template = "changelog/_template.rst"
[[tool.towncrier.type]]
directory = "removal"
name = "Deprecations and Removals"
showcontent = true
[[tool.towncrier.type]]
directory = "feature"
name = "Features"
showcontent = true
[[tool.towncrier.type]]
directory = "bugfix"
name = "Bug Fixes"
showcontent = true
[[tool.towncrier.type]]
directory = "vendor"
name = "Vendored Libraries"
showcontent = true
[[tool.towncrier.type]]
directory = "doc"
name = "Improved Documentation"
showcontent = true
[[tool.towncrier.type]]
directory = "trivial"
name = "Trivial Changes"
showcontent = false

View File

@ -11,10 +11,10 @@ from __future__ import print_function
import os
import subprocess
import sys
from check_manifest import main
if os.path.isdir('.git'):
sys.exit(subprocess.call('check-manifest', shell=True))
sys.exit(main())
else:
print('No .git directory found, skipping checking the manifest file')
sys.exit(0)

11
scripts/check-rst.py Normal file
View File

@ -0,0 +1,11 @@
from __future__ import print_function
import subprocess
import glob
import sys
sys.exit(subprocess.call([
'rst-lint', '--encoding', 'utf-8',
'CHANGELOG.rst', 'HOWTORELEASE.rst', 'README.rst',
] + glob.glob('changelog/[0-9]*.*')))

View File

@ -99,6 +99,7 @@ def pre_release(ctx, version, user, password=None):
"""Generates new docs, release announcements and uploads a new release to devpi for testing."""
announce(ctx, version)
regen(ctx)
changelog(ctx, version, write_out=True)
msg = 'Preparing release version {}'.format(version)
check_call(['git', 'commit', '-a', '-m', msg])
@ -146,3 +147,16 @@ def publish_release(ctx, version, user, pypi_name):
print(' ', ','.join(emails))
print()
print('And announce it on twitter adding the #pytest hash tag.')
@invoke.task(help={
'version': 'version being released',
'write_out': 'write changes to the actial changelog'
})
def changelog(ctx, version, write_out=False):
if write_out:
addopts = []
else:
addopts = ['--draft']
check_call(['towncrier', '--version', version] + addopts)

View File

@ -1,3 +1,4 @@
invoke
tox
gitpython
towncrier

View File

@ -61,7 +61,7 @@ deps =
commands =
{envpython} scripts/check-manifest.py
flake8 pytest.py _pytest testing
rst-lint CHANGELOG.rst HOWTORELEASE.rst README.rst --encoding utf-8
{envpython} scripts/check-rst.py
[testenv:py27-xdist]
deps=pytest-xdist>=1.13