towncrier
towncrier copied to clipboard
traceback on missing configuration
I think Incremental moved from towncrier.ini to pyproject.toml and now I get this when I run it
Traceback (most recent call last):
File "/Users/glyph/.virtualenvs/incremental/bin/towncrier", line 8, in <module>
sys.exit(cli())
File "/Users/glyph/.virtualenvs/incremental/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Users/glyph/.virtualenvs/incremental/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/glyph/.virtualenvs/incremental/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/glyph/.virtualenvs/incremental/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/glyph/.virtualenvs/incremental/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/glyph/.virtualenvs/incremental/lib/python3.10/site-packages/towncrier/build.py", line 89, in _main
return __main(
File "/Users/glyph/.virtualenvs/incremental/lib/python3.10/site-packages/towncrier/build.py", line 115, in __main
base_directory, config = load_config_from_options(directory, config_file)
File "/Users/glyph/.virtualenvs/incremental/lib/python3.10/site-packages/towncrier/_settings/load.py", line 32, in load_config_from_options
config = load_config(base_directory)
File "/Users/glyph/.virtualenvs/incremental/lib/python3.10/site-packages/towncrier/_settings/load.py", line 59, in load_config
return load_config_from_file(directory, config_file)
File "/Users/glyph/.virtualenvs/incremental/lib/python3.10/site-packages/towncrier/_settings/load.py", line 66, in load_config_from_file
return parse_toml(directory, config)
File "/Users/glyph/.virtualenvs/incremental/lib/python3.10/site-packages/towncrier/_settings/load.py", line 73, in parse_toml
config = config["tool"]["towncrier"]
KeyError: 'towncrier'
(The config is moved in the incremental release candidate branch, but it would be nice to fix this for others upgrading.)
I don’t get it, what exactly would you like to have fixed? Do you want a better error message on missing config?
Note that I was planning to remove incremental from towncrier - https://github.com/twisted/towncrier/pull/398 :) while still supporting projects using incremental.
I've got an updated version of removing incremental here #491.
But the issue here is load.py
shouldn't be assuming that config['tool']
has a towncrier
section. This is fixed in my rewrite of parse_toml
in #483
Fixed now #483 is merged 🎉
I think that this is now fixed.
I have removed pyproject.toml
12:30 $ git status
On branch test
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted: pyproject.toml
no changes added to commit (use "git add" and/or "git commit -a")
(venv) ✔ ~/chevah/towncrier [test L|● 1]
12:30 $ towncrier build
No configuration file found.
Looked back from: /home/adi/chevah/towncrier
I have also removed towncrie section from pyproject and I got
$ towncrier build
No [tool.towncrier] section.
$ git diff
diff --git a/pyproject.toml b/pyproject.toml
index 4e46bdc..f737cb6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -71,39 +71,6 @@ exclude = [
]
-[tool.towncrier]
- package = "towncrier"
- package_dir = "src"
- filename = "NEWS.rst"
- issue_format = "`#{issue} <https://github.com/twisted/towncrier/issues/{issue}>`_"
-
- [[tool.towncrier.section]]
- path = ""
-
- [[tool.towncrier.type]]
- directory = "feature"
- name = "Features"
- showcontent = true
-
- [[tool.towncrier.type]]
- directory = "bugfix"
- name = "Bugfixes"
- showcontent = true
-
- [[tool.towncrier.type]]
- directory = "doc"
- name = "Improved Documentation"
- showcontent = true
-
- [[tool.towncrier.type]]
- directory = "removal"
- name = "Deprecations and Removals"
- showcontent = true
-
- [[tool.towncrier.type]]
- directory = "misc"
- name = "Misc"
- showcontent = false
I am closing this as I think this is fixed