Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

traceback on missing configuration #441

Closed
glyph opened this issue Oct 4, 2022 · 6 comments
Closed

traceback on missing configuration #441

glyph opened this issue Oct 4, 2022 · 6 comments

Comments

@glyph
Copy link
Member

glyph commented Oct 4, 2022

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'
glyph added a commit to twisted/incremental that referenced this issue Oct 4, 2022
@glyph
Copy link
Member Author

glyph commented Oct 4, 2022

(The config is moved in the incremental release candidate branch, but it would be nice to fix this for others upgrading.)

@hynek
Copy link
Member

hynek commented Oct 6, 2022

I don’t get it, what exactly would you like to have fixed? Do you want a better error message on missing config?

@adiroiban
Copy link
Member

Note that I was planning to remove incremental from towncrier - #398 :) while still supporting projects using incremental.

@SmileyChris
Copy link
Contributor

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

@SmileyChris
Copy link
Contributor

Fixed now #483 is merged 🎉

@adiroiban
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants