You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
codespell has issues when pyproject.toml includes multiple sections of [[tool.uv.index]] #3852
codespell fails to parse pyproject.toml with TOML array of tables syntax [[...]] (e.g. multiple sections of [[tool.uv.index]]) and throws an error indicating the section "already exists".
Using latest codespell release 2.4.1.
Steps to Reproduce
Create a pyproject.toml with multiple entries using TOML array of tables syntax, for example:
[[tool.uv.index]]
name = "custom-index"
url = "https://example.com/simple/"
explicit = true
[[tool.uv.index]]
name = "pypi"
url = "https://pypi.org/simple"
Run codespell
Expected Behavior
codespell should correctly parse the TOML array of tables syntax [[...]] as defined in the [TOML specification]. Multiple [[section]] entries are valid TOML and represent an array of tables.
This syntax is commonly used by modern Python tooling like [uv] for defining multiple package indexes. The TOML file is valid and works correctly with other tools (uv, pip, ruff, etc.).
Activity
DimitriPapadopoulos commentedon Dec 19, 2025
How does it fail? Any error messages?
We use the Python
tomlpackage to read TOML files:codespell/codespell_lib/_codespell.py
Lines 694 to 699 in a9fe3fe
jhoelzl commentedon Dec 19, 2025
The command
produces this error:
DimitriPapadopoulos commentedon Dec 19, 2025
Option
--configis for INI files. Use option--tomlfor TOML files.Perhaps the documentation could be better worded. Eventually, these options could be unified, by testing file type prior to reading the configuration.
jhoelzl commentedon Dec 19, 2025
Oh sorry, i missed that! Thanks!