Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pyproject pre-commit hooks #9840

Merged
merged 4 commits into from
Dec 3, 2024
Merged

Conversation

VeckoTheGecko
Copy link
Contributor

@VeckoTheGecko VeckoTheGecko commented Nov 29, 2024

Changes:

  • add taplo (toml formatting) hook
  • add validate-pyproject hook

Heyo! Looks like Taplo (https://github.com/tamasfe/taplo) would be a good option (same project as VScode extension Even Better TOML with 2.3M downloads) . They don't have an official hook (tamasfe/taplo#535) but there's an unofficial one at https://github.com/ComPWA/taplo-pre-commit. I don't think they'll get an official one soon as they would need to set up a mirror repo (and best to transfer both repos to an org for that).

@VeckoTheGecko
Copy link
Contributor Author

a72decf was because taplo defaults to align_comments=true (which is nice for the tool.ruff.lint.extend-select block, but means that once off inline comments aren't as nice).

See formatter options for more.

Keeping with the default due to the smaller diff

@max-sixty
Copy link
Collaborator

I'm up for merging ... unless we decide to go with prettier, which covers all of these.

I've had a good experience with prettier, because it's a single file manages the formatting for all these formats where we only have a few files. A long track record over at PRQL.

But no particularly strong preference...

@VeckoTheGecko
Copy link
Contributor Author

VeckoTheGecko commented Nov 30, 2024

We already have prettier in precommit, and prettier doesn't support TOML (https://prettier.io/docs/en/). Unless you mean via a prettier plugin like https://www.npmjs.com/package/prettier-plugin-toml, but that is just a wrapper for taplo

@keewis
Copy link
Collaborator

keewis commented Nov 30, 2024

👍 for taplo, as prettier plugins are not upgraded by pre-commit autoupdate (I think?). I'd probably add validate-pyproject together with it, though.

@max-sixty
Copy link
Collaborator

Ah, thanks, definitely +1 to this, then

@VeckoTheGecko
Copy link
Contributor Author

VeckoTheGecko commented Dec 1, 2024

I'd probably add validate-pyproject together with it, though.

Done (using a suggested config in their readme)

@VeckoTheGecko VeckoTheGecko changed the title Add TOML format pre-commit hook Add Pyproject pre-commit hooks Dec 1, 2024
@@ -327,7 +336,9 @@ filterwarnings = [
"default:the `pandas.MultiIndex` object:FutureWarning:xarray.tests.test_variable",
"default:Using a non-tuple sequence for multidimensional indexing is deprecated:FutureWarning",
"default:Duplicate dimension names present:UserWarning:xarray.namedarray.core",
"default:::xarray.tests.test_strategies", # TODO: remove once we know how to deal with a changed signature in protocols

Copy link
Collaborator

Choose a reason for hiding this comment

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

Didn't know that empty lines are allowed, nice.

@max-sixty max-sixty merged commit 99ee8c6 into pydata:main Dec 3, 2024
29 checks passed
@max-sixty
Copy link
Collaborator

Thanks @VeckoTheGecko !

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.

4 participants