Nbdev_build hook for black code formatter

My project uses a GitHub Build CI workflow that incorporates a black code formatter check. Is it possible to incorporate an nbdev_build hook that runs output through the black formatter before writing the .py files?

1 Like

Would actually love to have this as a feature (maybe not just black but other formatters as well)

Have you seen https://github.com/nbQA-dev/nbQA? You could either add it as a precommit hook or run it as a GA. The only thing is you’d need to make sure you also update the export code after but you could add that as an extra step quite easily I think.

I have manually used this tool for a few projects and found it worked well so far.