Open
Description
Following up on Issue #293, I’d like to propose an enhancement:
While it's clear that PEP 621 does not enforce a specific TOML layout and that [project.scripts]
and [project] scripts.*
are semantically equivalent, it would be very useful if pyproject-fmt
provided an optional configuration setting to prefer one formatting style over the other during formatting.
Specifically, it would be helpful to offer users the ability to:
- Prefer expanding
[project.scripts]
as a dedicated table (more readable and common in hand-writtenpyproject.toml
files) - Or, alternatively, prefer flattening into
[project] scripts.*
entries (current behavior)
Possible Implementation Ideas:
- A CLI flag (e.g.,
--prefer-expanded-tables
) - A configuration setting in
pyproject.toml
forpyproject-fmt
- Default behavior could remain unchanged if no preference is specified
Rationale:
- Improves readability and consistency for users who manually maintain
pyproject.toml
- Reduces diffs when working across teams that expect a particular style
- Enhances user control without sacrificing compliance with PEP 621
Thanks for considering this! I’m happy to help test or contribute if needed.
Metadata
Metadata
Assignees
Labels
No labels