Skip to content

Conversation

flying-sheep
Copy link

Fixes #5 when ready

)

parser.add_argument(
"--do-not-collapse",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I am on board with selective collapse I think I said in the issue too I would really prefer this to be on or off like rather than selective...

Copy link
Author

@flying-sheep flying-sheep Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I didn’t interpret the line

I was thinking something along the line of --tables flag with short or long values.

as you meant it. Can you please describe what you meant by that?

what’s a “short or long value”?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not want configurable collapse. It should be either collapse all or expand all 😊

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t understand what you mean! Expand/collapse can happen on multiple levels and neither “collapsing all” nor “expanding all” makes sense, as nobody would want that.

Currently, pyproject-fmt has an algorithm determining which collapsed table headers exist:

  • [project]
  • [build-system]
  • [tool.*]

Everything below these gets expanded.

“expanding all” means to me that there are no table headers, and project.name = "..." exists together with tool.ruff.lint.… = .... Nobody wants that.

“collapsing all” could mean that only table headers can contain dots, like the many many [ruff.lint.…] headers here:

[tool.ruff.lint.flake8-annotations]
suppress-none-returning = true
[tool.ruff.lint.flake8-bandit]
hardcoded-tmp-directory = ['Bar', 'ALPHA']
[tool.ruff.lint.flake8-boolean-trap]
extend-allowed-calls = ['Bar', 'ALPHA']
[tool.ruff.lint.flake8-bugbear]
extend-immutable-calls = ['Bar', 'ALPHA']
[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = ['Bar', 'ALPHA']

Nobody wants that either.

Everyone using pyproject-fmt likes expanding things, except for a handful of super long collapsed tables, like described in #5 and #35

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expand/collapse can happen on multiple levels and neither “collapsing all” nor “expanding all” makes sense, as nobody would want that.

Ignore level 1. The project today collapses all supported table configurations of level 2+ into level 2. This is what I call collapse all.

Expand all would be to expand all configurations to be tables.

Everyone using pyproject-fmt likes expanding things, except for a handful of super long collapsed tables, like described in #5 and #35

Interesting idea, though I'm not sure how you surveyed everyone. I think this is a personal stylistic choice, and this is an opinionated formatter after all.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tool.ruff.lint.flake8-tidy-imports.banned-api."some.import".msg is just ridiculous, but that doesn’t mean I want to see dozens of table headers with a single entry each.

Can we find a rule that respects that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a personal opinion but I don't find it that bad. 🤔

That being said I'm not totally opposed to this idea, but I'm also not invested in making it happen, as I find the status quo alright. If someone puts together a well tested PR I'll review, but I'll not invest time in trying to make it happen.

PS. Your tone is a bit aggressive here, I'd recommend stop throwing around harsh words like everyone, nobody or ridiculous; and choose some that respect the fact that we all have different tastes and opinions, and that's alright.

Copy link
Author

@flying-sheep flying-sheep Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m German, I tend to be a bit more direct than what Americans are accustomed to, and quite thankful when it’s pointed out that something could be perceived as harsh.

However, that requires the other side to assume the same humility. My tone isn’t aggressive, you perceive it as such. I’m not thankful for tone-policing that portrays such subjective matters as a fact.

I'm not totally opposed to this idea, but I'm also not invested in making it happen

Yeah, I think we’d need to come up with a rule/preset that makes sense. I totally get it that you don’t want total customizability.

To elaborate on my motivation for the current approach: I was thinking that the 1–2 levels you’re referring to above are not a numerical cutoff but semantic: we know there’s only build-system (1 level), project (1 level) and tool.* (2 levels). But we don’t know every single tool’s layering. That’s why I thought that hard-coding would be too much maintenance effort, and I can think of no heuristic that makes sense, and therefore opted for customizability.

So how would a rule look like that you could get behind?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, that requires the other side to assume the same humility. My tone isn’t aggressive, you perceive it as such. I’m not thankful for tone-policing that portrays such subjective matters as a fact.

It seems we’re not making progress here, so I’ll take a step back from this conversation for now.

@flying-sheep
Copy link
Author

OK, no clue how that code works, seems like just continueing when you want to skip collapsing a table level is not enough.

can someone explain it to me?

otherwise feel free to use my code as a starting point and implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Featur Request: use expanded tables for larger entrypoint mapping

2 participants