keewis / blackdoc

run black on documentation code snippets
https://blackdoc.readthedocs.io
MIT License
47 stars 4 forks source link

pin `black` in the hook definition file #123

Closed keewis closed 2 years ago

keewis commented 2 years ago

In order to avoid running into issues with versions of black that are not updated unless the hook is installed / updated (which causes differences in formatting), this pins black in the hook definition.

I'm not sure if it wouldn't be better to do that in each project's .pre-commit-config.yaml (as it is recommended by the author of pre-commit), but updating of additional_dependencies is a unsolved issue: pre-commit supports multiple languages / package managers, and parsing whatever the package manager accepts is a hard problem. And according to the issue tracker, it will probably never implemented. Which is why auto-updating the pinned version would require a separate hook / CI job to update.

In this PR we go with pinning black in the hook definition, but I could just as well imagine running a hook that extracts the version of the black hook and updates the pinned version with it.

keewis commented 2 years ago

since it's probably better to not be tied to the black release schedule I'm going to close this in favor of #124