diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1191fad27..ad3fea61e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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. diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e6a6bd9b9..2de3c1ded 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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) diff --git a/MANIFEST.in b/MANIFEST.in index 51041f0c9..abf57fece 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -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 diff --git a/changelog/2390.doc b/changelog/2390.doc new file mode 100644 index 000000000..2d255b0e1 --- /dev/null +++ b/changelog/2390.doc @@ -0,0 +1 @@ +initial addition of towncrier diff --git a/changelog/2434.bugfix b/changelog/2434.bugfix new file mode 100644 index 000000000..a13d233ce --- /dev/null +++ b/changelog/2434.bugfix @@ -0,0 +1 @@ +Fix issue with non-ascii contents in doctest text files. diff --git a/changelog/2436.bugfix b/changelog/2436.bugfix new file mode 100644 index 000000000..2f12944bc --- /dev/null +++ b/changelog/2436.bugfix @@ -0,0 +1 @@ +Fix encoding errors for unicode warnings in Python 2. diff --git a/changelog/_template.rst b/changelog/_template.rst new file mode 100644 index 000000000..e0eb86a67 --- /dev/null +++ b/changelog/_template.rst @@ -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 %} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..138fd4ce6 --- /dev/null +++ b/pyproject.toml @@ -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 diff --git a/scripts/check-manifest.py b/scripts/check-manifest.py index 909e7519b..de1357685 100644 --- a/scripts/check-manifest.py +++ b/scripts/check-manifest.py @@ -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) diff --git a/scripts/check-rst.py b/scripts/check-rst.py new file mode 100644 index 000000000..57f717501 --- /dev/null +++ b/scripts/check-rst.py @@ -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]*.*'))) diff --git a/tasks/generate.py b/tasks/generate.py index cc4791736..fa8ee6557 100644 --- a/tasks/generate.py +++ b/tasks/generate.py @@ -96,9 +96,10 @@ def devpi_upload(ctx, version, user, password=None): '(if not given assumed logged in)', }) def pre_release(ctx, version, user, password=None): - """Generates new docs, release announcements and uploads a new release to devpi for testing.""" + """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) + diff --git a/tasks/requirements.txt b/tasks/requirements.txt index 35afc29c8..eb12df3e9 100644 --- a/tasks/requirements.txt +++ b/tasks/requirements.txt @@ -1,3 +1,4 @@ invoke tox gitpython +towncrier \ No newline at end of file diff --git a/tox.ini b/tox.ini index f30557a4b..ecde435da 100644 --- a/tox.ini +++ b/tox.ini @@ -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