keewis / blackdoc

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

Would it be possible to only write files on changes? #127

Closed max-sixty closed 2 years ago

max-sixty commented 2 years ago

Often I run something like watchexec -- {some tests}. Including blackdoc in those tests causes this to loop forever, because it seems blackdoc writes to files even when it doesn't change them.

To the extent this would be an easy change, this would be great! (but also maybe it's just me and so no need to make changes in that case)

keewis commented 2 years ago

I thought that's what it already does, but apparently that's not true: https://github.com/keewis/blackdoc/blob/5049a7f97ebe59bd82a8b1b0bb1b5d729bb8cb1d/blackdoc/__main__.py#L37-L44 The fix would indeed be very simple: indent the with block by one level...