See scverse/scanpy#3964:
reproducer:
# /// script
# dependencies = [ "pyproject-fmt==2.12.0" ]
# ///
import sys
import difflib
from pyproject_fmt._lib import Settings, format_toml
settings = Settings(
column_width=120,
indent=4,
keep_full_version=True,
max_supported_python=(3, 14),
min_supported_python=(3, 14),
generate_python_version_classifiers=False,
table_format="short",
expand_tables=["project.optional-dependencies"],
collapse_tables=[],
)
content = """\
[project]
name = "test"
[project.optional-dependencies]
a = [ "b", "c" ]
"""
sys.stdout.writelines(difflib.unified_diff(
content.splitlines(keepends=True),
format_toml(content, settings).splitlines(keepends=True),
fromfile="input",
tofile="output",
))
prints
--- input
+++ output
@@ -1,5 +1,4 @@
[project]
name = "test"
-[project.optional-dependencies]
-a = [ "b", "c" ]
+optional-dependencies.a = [ "b", "c" ]
See scverse/scanpy#3964:
reproducer:
prints