taplo icon indicating copy to clipboard operation
taplo copied to clipboard

Bug in "Even Better Toml" v0.21.2. False negative. "Additional properties are not allowed ('ext-modules' was unexpected)"

Open JamesParrott opened this issue 7 months ago • 2 comments

# pyproject.toml
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "spammodule"  # as it would appear on PyPI
version = "0.42"

[tool.setuptools]
ext-modules = [
  {name = "spam", sources = ["spammodule.c"]}
]

Image

[{
	"..../pyproject.toml",
	"owner": "_generated_diagnostic_collection_name_#4",
	"severity": 8,
	"message": "Additional properties are not allowed ('ext-modules' was unexpected)",
	"source": "Even Better TOML",
	"startLineNumber": 10,
	"startColumn": 7,
	"endLineNumber": 10,
	"endColumn": 17
}]

JamesParrott avatar May 06 '25 09:05 JamesParrott

This error is pretty annoying. Technically this field is of course optional, but when you need it to build extension modules you need it. It cannot be removed without breaking the build.

Is there a way to disable this specific error in the project?

phw avatar May 27 '25 06:05 phw

Also, adding source attribute to dependencies causes a false positive:

[tool.poetry.dependencies]
requests = { source = "private-source" }
{"source":"private-source"} is not valid under any of the schemas listed in the 'anyOf' keyword

See poetry documentation: https://python-poetry.org/docs/dependency-specification/#projectdependencies-and-toolpoetrydependencies

hafoertsch avatar Oct 13 '25 07:10 hafoertsch