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
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-written pyproject.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 for pyproject-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.
The text was updated successfully, but these errors were encountered:
I am not sure what you mean by compliance with PEP 621, because given that that does not specify a specific style, we are already compliant. As for which is more common or readable, I think we'll need to agree to disagree. I actually did a poll about this a while back on Twitter and from like 100 answers it was 50-50 the distribution. I think this argument between one and another is really just a personal preference thing.
That being said I'm open to someone to create a pull request to support both styles. But I am not gonna do the work so guest contributions are welcome.
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 ifpyproject-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:
[project.scripts]
as a dedicated table (more readable and common in hand-writtenpyproject.toml
files)[project] scripts.*
entries (current behavior)Possible Implementation Ideas:
--prefer-expanded-tables
)pyproject.toml
forpyproject-fmt
Rationale:
pyproject.toml
Thanks for considering this! I’m happy to help test or contribute if needed.
The text was updated successfully, but these errors were encountered: