data-apis / array-api-typing

Static typing support for the array API standard
MIT License
4 stars 1 forks source link

💄 Add a `black`-compatible `.editorconfig` #5

Closed jorenham closed 2 days ago

jorenham commented 2 days ago

https://editorconfig.org/

jorenham commented 2 days ago

Is there a way to set configurations, e.g. max_line_length = 88 from pyproject.toml ? It would be best to have a single source of truth.

ruff uses these settings by default 🤷🏻

jorenham commented 2 days ago

Is there a way to set configurations, e.g. max_line_length = 88 from pyproject.toml ? It would be best to have a single source of truth.

and to answer your question; no, I don't think the editorconfig spec supports dynamic settings

nstarman commented 2 days ago

Nor the reverse, unfortunately: https://github.com/astral-sh/ruff/issues/1530

nstarman commented 2 days ago

That being said, if we treat .editorconfig as the SSoT and have comments on all related configs warning that the two should be kept in sync, then it's fine 🤞 .

nstarman commented 2 days ago

OTOH. Doesn't pre-commit fix most of these automatically? What's the added benefit over running pre-commit run [-a] / having it auto fix when git committing ?

jorenham commented 2 days ago

I wasn't aware that pre-commit looked at this?

nstarman commented 2 days ago

not this config file specifically, but hooks can fix line endings, tab-size, etc.

jorenham commented 2 days ago

Oh btw, the max_line_length = 88 is in the editorconfig spec, but I've seen it used in several other places (such as numpy) 🤷🏻

jorenham commented 2 days ago

not this config file specifically, but hooks can fix line endings, tab-size, etc.

Yea, there's hooks for most of these. This config is mostly useful for IDE's

nstarman commented 2 days ago

hmm.. I get why it's useful. I just have the same concern as https://github.com/astral-sh/ruff/issues/1530#issuecomment-1546176355. Especially if we have pre-commit.ci / pre-commit in a GH Action for CI with hooks that cover everything.

jorenham commented 2 days ago

hmm.. I get why it's useful. I just have the same concern as astral-sh/ruff#1530 (comment)

Yea I can see that; I prefer a minimal amount of files in the root myself as well. But in practice, this is one of those configs that you shouldn't have to touch ever again. And if I remember correctly, repo-review also requires this.

jorenham commented 2 days ago

But I'm also fine with not having an editorconfig; I can configure vscode myself just fine 🤷🏻

nstarman commented 2 days ago

With git-exclude you can have it and the ignore won't be forced on others...

nstarman commented 2 days ago

But with good code comments in pyproject.toml & editorconfig & pre-commit.yaml discussing any overlaps, I'm also fine to merge this.

jorenham commented 2 days ago

With git-exclude you can have it and the ignore won't be forced on others...

Yea, I use that for a bunch of cache dirs. But I don't think I even use editorconfig; I only added it because others might use it.

jorenham commented 2 days ago

Let's close this then; we could always reconsider later if someone asks for it