Skip to content

Commit ee0844d

Browse files
authored
Merge pull request #2431 from RonnyPfannschmidt/towncrier
initial addition of towncrier
2 parents 6117930 + b74c626 commit ee0844d

13 files changed

+124
-15
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ Thanks for submitting a PR, your contribution is really appreciated!
22

33
Here's a quick checklist that should be present in PRs:
44

5-
- [ ] Target: for bug or doc fixes, target `master`; for new features, target `features`;
5+
- [ ] Add a new news fragment into the changelog folder
6+
* name it `$issue_id.$type` for example (588.bug)
7+
* if you don't have an issue_id change it to the pr id after creating the pr
8+
* ensure type is one of `removal`, `feature`, `bugfix`, `vendor`, `doc` or `trivial`
9+
* Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."
10+
- [ ] Target: for `bugfix`, `vendor`, `doc` or `trivial` fixes, target `master`; for removals or features target `features`;
11+
- [ ] Make sure to include reasonable tests for your change if necessary
612

7-
Unless your change is trivial documentation fix (e.g., a typo or reword of a small section) please:
13+
Unless your change is a trivial or a documentation fix (e.g., a typo or reword of a small section) please:
814

9-
- [ ] Make sure to include one or more tests for your change;
1015
- [ ] Add yourself to `AUTHORS`;
11-
- [ ] Add a new entry to `CHANGELOG.rst`
12-
* Choose any open position to avoid merge conflicts with other PRs.
13-
* Add a link to the issue you are fixing (if any) using RST syntax.
14-
* 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.

CHANGELOG.rst

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
3.1.1 (unreleased)
2-
==================
1+
..
2+
You should *NOT* be adding new change log entries to this file, this
3+
file is managed by towncrier. You *may* edit previous change logs to
4+
fix problems like typo corrections or such.
5+
To add a new change log entry, please see
6+
https://pip.pypa.io/en/latest/development/#adding-a-news-entry
7+
we named the news folder changelog
38
4-
* Fix encoding errors for unicode warnings in Python 2. (towncrier: 2436.bugfix)
59

6-
* Fix issue with non-ascii contents in doctest text files. (towncrier: 2434.bugfix)
10+
.. towncrier release notes start
711
812
913
3.1.0 (2017-05-22)

MANIFEST.in

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
include CHANGELOG.rst
22
include LICENSE
33
include AUTHORS
4+
include pyproject.toml
45

56
include README.rst
67
include CONTRIBUTING.rst
@@ -9,6 +10,7 @@ include HOWTORELEASE.rst
910
include tox.ini
1011
include setup.py
1112

13+
recursive-include changelog *
1214
recursive-include scripts *.py
1315
recursive-include scripts *.bat
1416

changelog/2390.doc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
initial addition of towncrier

changelog/2434.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix issue with non-ascii contents in doctest text files.

changelog/2436.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix encoding errors for unicode warnings in Python 2.

changelog/_template.rst

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{% for section in sections %}
2+
{% set underline = "-" %}
3+
{% if section %}
4+
{{section}}
5+
{{ underline * section|length }}{% set underline = "~" %}
6+
7+
{% endif %}
8+
{% if sections[section] %}
9+
{% for category, val in definitions.items() if category in sections[section] and category != 'trivial' %}
10+
11+
{{ definitions[category]['name'] }}
12+
{{ underline * definitions[category]['name']|length }}
13+
14+
{% if definitions[category]['showcontent'] %}
15+
{% for text, values in sections[section][category]|dictsort(by='value') %}
16+
- {{ text }}{% if category != 'vendor' %} ({{ values|sort|join(', ') }}){% endif %}
17+
18+
{% endfor %}
19+
{% else %}
20+
- {{ sections[section][category]['']|sort|join(', ') }}
21+
22+
23+
{% endif %}
24+
{% if sections[section][category]|length == 0 %}
25+
26+
No significant changes.
27+
28+
29+
{% else %}
30+
{% endif %}
31+
{% endfor %}
32+
{% else %}
33+
34+
No significant changes.
35+
36+
37+
{% endif %}
38+
{% endfor %}

pyproject.toml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[tool.towncrier]
2+
package = "pytest"
3+
filename = "CHANGELOG.rst"
4+
directory = "changelog/"
5+
template = "changelog/_template.rst"
6+
7+
[[tool.towncrier.type]]
8+
directory = "removal"
9+
name = "Deprecations and Removals"
10+
showcontent = true
11+
12+
[[tool.towncrier.type]]
13+
directory = "feature"
14+
name = "Features"
15+
showcontent = true
16+
17+
[[tool.towncrier.type]]
18+
directory = "bugfix"
19+
name = "Bug Fixes"
20+
showcontent = true
21+
22+
[[tool.towncrier.type]]
23+
directory = "vendor"
24+
name = "Vendored Libraries"
25+
showcontent = true
26+
27+
[[tool.towncrier.type]]
28+
directory = "doc"
29+
name = "Improved Documentation"
30+
showcontent = true
31+
32+
[[tool.towncrier.type]]
33+
directory = "trivial"
34+
name = "Trivial Changes"
35+
showcontent = false

scripts/check-manifest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
import os
1212
import subprocess
1313
import sys
14-
14+
from check_manifest import main
1515

1616
if os.path.isdir('.git'):
17-
sys.exit(subprocess.call('check-manifest', shell=True))
17+
sys.exit(main())
1818
else:
1919
print('No .git directory found, skipping checking the manifest file')
2020
sys.exit(0)

scripts/check-rst.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
from __future__ import print_function
3+
4+
import subprocess
5+
import glob
6+
import sys
7+
8+
sys.exit(subprocess.call([
9+
'rst-lint', '--encoding', 'utf-8',
10+
'CHANGELOG.rst', 'HOWTORELEASE.rst', 'README.rst',
11+
] + glob.glob('changelog/[0-9]*.*')))

tasks/generate.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,10 @@ def devpi_upload(ctx, version, user, password=None):
9696
'(if not given assumed logged in)',
9797
})
9898
def pre_release(ctx, version, user, password=None):
99-
"""Generates new docs, release announcements and uploads a new release to devpi for testing."""
99+
"""Generates new docs, release announcements and uploads a new release to devpi for testing."""
100100
announce(ctx, version)
101101
regen(ctx)
102+
changelog(ctx, version, write_out=True)
102103

103104
msg = 'Preparing release version {}'.format(version)
104105
check_call(['git', 'commit', '-a', '-m', msg])
@@ -146,3 +147,16 @@ def publish_release(ctx, version, user, pypi_name):
146147
print(' ', ','.join(emails))
147148
print()
148149
print('And announce it on twitter adding the #pytest hash tag.')
150+
151+
152+
@invoke.task(help={
153+
'version': 'version being released',
154+
'write_out': 'write changes to the actial changelog'
155+
})
156+
def changelog(ctx, version, write_out=False):
157+
if write_out:
158+
addopts = []
159+
else:
160+
addopts = ['--draft']
161+
check_call(['towncrier', '--version', version] + addopts)
162+

tasks/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
invoke
22
tox
33
gitpython
4+
towncrier

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ deps =
6161
commands =
6262
{envpython} scripts/check-manifest.py
6363
flake8 pytest.py _pytest testing
64-
rst-lint CHANGELOG.rst HOWTORELEASE.rst README.rst --encoding utf-8
64+
{envpython} scripts/check-rst.py
6565

6666
[testenv:py27-xdist]
6767
deps=pytest-xdist>=1.13

0 commit comments

Comments
 (0)