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

TOMLKitError when generating TOML config with tomlkit 0.11.8 #8632

Closed
ltm opened this issue Apr 27, 2023 · 1 comment · Fixed by #8638 or #9093
Closed

TOMLKitError when generating TOML config with tomlkit 0.11.8 #8632

ltm opened this issue Apr 27, 2023 · 1 comment · Fixed by #8638 or #9093
Labels
Crash 💥 A bug that makes pylint crash High priority Issue with more than 10 reactions python 3.11
Milestone

Comments

@ltm
Copy link

ltm commented Apr 27, 2023

Bug description

pylint fails to generate a TOML config using --generate-toml-config after upgrading tomlkit from 0.11.7 to 0.11.8.

Configuration

No response

Command used

pylint --generate-toml-config

Pylint output

Traceback (most recent call last):
  File "/Users/ltm/venv/bin/pylint", line 8, in <module>
    sys.exit(run_pylint())
             ^^^^^^^^^^^^
  File "/Users/ltm/venv/lib/python3.11/site-packages/pylint/__init__.py", line 36, in run_pylint
    PylintRun(argv or sys.argv[1:])
  File "/Users/ltm/venv/lib/python3.11/site-packages/pylint/lint/run.py", line 169, in __init__
    args = _config_initialization(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ltm/venv/lib/python3.11/site-packages/pylint/config/config_initialization.py", line 75, in _config_initialization
    parsed_args_list = linter._parse_command_line_configuration(args_list)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ltm/venv/lib/python3.11/site-packages/pylint/config/arguments_manager.py", line 278, in _parse_command_line_configuration
    self.config, parsed_args = self._arg_parser.parse_known_args(
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 1895, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 2107, in _parse_known_args
    start_index = consume_optional(start_index)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 2047, in consume_optional
    take_action(action, args, option_string)
  File "/opt/homebrew/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 1971, in take_action
    action(self, namespace, argument_values, option_string)
  File "/Users/ltm/venv/lib/python3.11/site-packages/pylint/config/callback_actions.py", line 286, in __call__
    print(self.run.linter._generate_config_file())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ltm/venv/lib/python3.11/site-packages/pylint/config/arguments_manager.py", line 708, in _generate_config_file
    toml_doc.add(tomlkit.key(["tool", "pylint"]), pylint_tool_table)
  File "/Users/ltm/venv/lib/python3.11/site-packages/tomlkit/container.py", line 114, in add
    return self.append(key, item)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ltm/venv/lib/python3.11/site-packages/tomlkit/container.py", line 157, in append
    self._handle_dotted_key(key, item)
  File "/Users/ltm/venv/lib/python3.11/site-packages/tomlkit/container.py", line 118, in _handle_dotted_key
    raise TOMLKitError("Can't add a table to a dotted key")
tomlkit.exceptions.TOMLKitError: Can't add a table to a dotted key

Expected behavior

pylint should print the generated TOML config.

Pylint version

pylint 2.17.3
astroid 2.15.4
Python 3.11.2 (main, Feb 16 2023, 02:55:59) [Clang 14.0.0 (clang-1400.0.29.202)]

OS / Environment

macOS 13.3.1 (22E261)

Additional dependencies

astroid==2.15.4
dill==0.3.6
isort==5.12.0
lazy-object-proxy==1.9.0
mccabe==0.7.0
platformdirs==3.4.0
pylint==2.17.3
tomlkit==0.11.8
wrapt==1.15.0
@ltm ltm added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Apr 27, 2023
@Pierre-Sassoulas Pierre-Sassoulas added Blocker 🙅 Blocks the next release Crash 💥 A bug that makes pylint crash High priority Issue with more than 10 reactions and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Apr 27, 2023
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.17.4 milestone Apr 27, 2023
@Pierre-Sassoulas
Copy link
Member

Thanks for the report. We're affected in all our own pipelines, readthedoc is failing with this error too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crash 💥 A bug that makes pylint crash High priority Issue with more than 10 reactions python 3.11
Projects
None yet
2 participants