mkdocstrings / griffe

Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API.
https://mkdocstrings.github.io/griffe
ISC License
261 stars 38 forks source link

feature: Pre-commit integration #266

Closed bswck closed 2 weeks ago

bswck commented 2 weeks ago

Is your feature request related to a problem? Please describe.

Make the Griffe repo provide pre-commit hook(s).

Describe the solution you'd like

Let's provide a .pre-commit-hooks.yaml to be able to run Griffe as a pre-commit hook.

pawamoy commented 2 weeks ago

Ha, I'm not a fan of the pre-commit tool. I'm not sure I want to maintain hooks here for a tool I don't use :sweat_smile: Isn't there a central repository for that (asking everytime) :thinking: Or, could this be provided in a third-party repository? Like in a pre-commit-griffe repository maintained by someone else :smile:?

bswck commented 2 weeks ago

A separate repository could be made, like https://github.com/astral-sh/ruff-pre-commit.

I could maintain it and see if it's worth it.

pawamoy commented 2 weeks ago

Thanks, I'd much prefer that :slightly_smiling_face:

Or that pre-commit hosts a community hooks repository or something. As shared privately, I think it's unfair to put some burden on every project that your users want to use your tool (pre-commit) with.

If pre-commit allows its users to easily host project hooks in third-party repos, that's great, but apparently it's not the case, as I can see in https://github.com/astral-sh/ruff-pre-commit where they actually have to configure a new Python package (pyproject.toml) for that. Well, their use-case is for pre-built wheels, which shows another limitation of pre-commit I guess (can it only install from source?).

pawamoy commented 2 weeks ago

I'll close, feel free to try and change my mind :smile: