keewis / blackdoc

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

add a hook to autoupdate `black` in user configuration #124

Closed keewis closed 2 years ago

keewis commented 2 years ago

As an alternative to #123, here's a hook to automate synchronizing the black hook and the additional_dependencies entry of blackdoc.

I'm not sure if the way I implemented that hook (a regex) is particularly reliable (besides the fact that multi-line regexes are clearly not something I'm comfortable with), but using pyyaml for this would strip any comments / reformat some entries, and ruamel.yaml / ruyaml seem to struggle with maintenance (at least, that's the impression I get).