-
-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Yamlfix throws an error when readon unrelated section from pyproject.toml
Steps to reproduce
Add this mixed list to pyproject.toml
serve = {sequence = ["_build_rendercv_tmp", {cmd = "mkdocs serve"}]}no yamlfix sections needed. The error:
[+] YamlFix: Fixing files
Traceback (most recent call last):
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/toml/decoder.py", line 511, in loads
ret = decoder.load_line(line, currentlevel, multikey,
multibackslash)
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/toml/decoder.py", line 778, in load_line
value, vtype = self.load_value(pair[1], strictly_valid)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/toml/decoder.py", line 883, in load_value
self.load_inline_object(v, inline_object)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/toml/decoder.py", line 679, in load_inline_object
status = self.load_line(group, currentlevel, multikey,
multibackslash)
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/toml/decoder.py", line 778, in load_line
value, vtype = self.load_value(pair[1], strictly_valid)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/toml/decoder.py", line 880, in load_value
return (self.load_array(v), "array")
~~~~~~~~~~~~~~~^^^
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/toml/decoder.py", line 1029, in load_array
raise ValueError("Not a homogeneous array")
ValueError: Not a homogeneous array
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/maison/config_sources/toml_source.py", line 35, in _load_file
return dict(toml.load(self.filepath))
~~~~~~~~~^^^^^^^^^^^^^^^
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/toml/decoder.py", line 134, in load
return loads(ffile.read(), _dict, decoder)
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/toml/decoder.py", line 514, in loads
raise TomlDecodeError(str(err), original, pos)
toml.decoder.TomlDecodeError: Not a homogeneous array (line 34 column 1 char 1074)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/bin/yamlfix", line 8, in <module>
sys.exit(cli())
~~~^^
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/click/core.py", line 1442, in __call__
return self.main(*args, **kwargs)
~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/click/core.py", line 1363, in main
rv = self.invoke(ctx)
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/click/core.py", line 1226, in invoke
return ctx.invoke(self.callback, **ctx.params)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/click/core.py", line 794, in invoke
return callback(*args, **kwargs)
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/yamlfix/entrypoints/cli.py", line 115, in cli
configure_yamlfix(
~~~~~~~~~~~~~~~~~^
config, config_file, _parse_env_vars_as_yamlfix_config(env_prefix.lower())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/yamlfix/config.py", line 25, in configure_yamlfix
config: UserConfig = UserConfig(
~~~~~~~~~~^
schema=YamlfixConfig,
^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
starting_path=config_path,
^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/maison/config.py", line 57, in __init__
self._values = self._generate_config_dict()
~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/maison/config.py", line 186, in _generate_config_dict
return reduce(lambda a, b: deep_merge(a, b), source_dicts)
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/maison/config.py", line 185, in <genexpr>
source_dicts = (source.to_dict() for source in self._sources)
~~~~~~~~~~~~~~^^
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/maison/config_sources/pyproject_source.py", line 21, in to_dict
return dict(self._load_file().get("tool", {}).get(self.package_name, {}))
~~~~~~~~~~~~~~~^^
File "/home/jga/.cache/pre-commit/repomtz4bxzi/py_env-python3/lib/python3.13/site-packages/maison/config_sources/toml_source.py", line 37, in _load_file
raise BadTomlError(
f"Error trying to load toml file '{self.filepath}'"
) from exc
maison.errors.BadTomlError: Error trying to load toml file '/home/jga/Documents/docs/pyproject.toml'Current behavior
Toml should be read for config, but not parsed or tried to be fixed. The toml is valid. Poe and other tools that read the file does not complain.
Desired behavior
No error
Environment
[dependency-groups]
dev = [
"poethepoet>=0.36.0",
"pre-commit>=4.3.0"
]
❯ python -V
Python 3.13.0Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working