From 89363b2d9b67c30a04dc9aa3ef2ad6e1ad1b1709 Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Mon, 25 Nov 2019 12:28:05 -0800 Subject: [PATCH] Add internal type for release notes --- newsfragments/README.md | 3 ++- newsfragments/validate_files.py | 17 ++++++++++++++--- pyproject.toml | 11 +++++++---- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/newsfragments/README.md b/newsfragments/README.md index 09c1cc8..09a10dd 100644 --- a/newsfragments/README.md +++ b/newsfragments/README.md @@ -12,6 +12,7 @@ Each file should be named like `..rst`, where * `bugfix` * `performance` * `doc` +* `internal` * `removal` * `misc` @@ -23,4 +24,4 @@ then open up the PR first and use the PR number for the newsfragment. Note that the `towncrier` tool will automatically reflow your text, so don't try to do any fancy formatting. Run `towncrier --draft` to get a preview of what the release notes entry - will look like in the final release notes. \ No newline at end of file + will look like in the final release notes. diff --git a/newsfragments/validate_files.py b/newsfragments/validate_files.py index c6695bc..c0e9b28 100755 --- a/newsfragments/validate_files.py +++ b/newsfragments/validate_files.py @@ -5,11 +5,13 @@ import os import pathlib +import sys ALLOWED_EXTENSIONS = { '.bugfix.rst', '.doc.rst', '.feature.rst', + '.internal.rst', '.misc.rst', '.performance.rst', '.removal.rst', @@ -22,11 +24,20 @@ ALLOWED_FILES = { THIS_DIR = pathlib.Path(__file__).parent +num_args = len(sys.argv) - 1 +assert num_args in {0, 1} +if num_args == 1: + assert sys.argv[1] in ('is-empty', ) + for fragment_file in THIS_DIR.iterdir(): if fragment_file.name in ALLOWED_FILES: continue - - full_extension = "".join(fragment_file.suffixes) - if full_extension not in ALLOWED_EXTENSIONS: + elif num_args == 0: + full_extension = "".join(fragment_file.suffixes) + if full_extension not in ALLOWED_EXTENSIONS: + raise Exception(f"Unexpected file: {fragment_file}") + elif sys.argv[1] == 'is-empty': raise Exception(f"Unexpected file: {fragment_file}") + else: + raise RuntimeError("Strange: arguments {sys.argv} were validated, but not found") diff --git a/pyproject.toml b/pyproject.toml index 42a4130..a9724ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,8 +6,6 @@ directory = "newsfragments" underlines = ["-", "~", "^"] issue_format = "`#{issue} /issues/{issue}>`__" -# Configure all default sections plus an extra one for performance improvements. - [[tool.towncrier.type]] directory = "feature" name = "Features" @@ -33,7 +31,12 @@ directory = "removal" name = "Deprecations and Removals" showcontent = true +[[tool.towncrier.type]] +directory = "internal" +name = "Internal Changes - for Contributors" +showcontent = true + [[tool.towncrier.type]] directory = "misc" -name = "Miscellaneous internal changes" -showcontent = false \ No newline at end of file +name = "Miscellaneous changes" +showcontent = false