Description
Motivation
Improve integration with pre-commit
Expected behavior
Can use the nbdev_clear without having a nbdev
config at settings.ini
or to implicit pass args: ['-fname', 'mydir/']
at pre-commit config.
Explanation
As I explain here, seems to be a workaround need to add the path
if you don't have a nbdev config. Mainly, because this will cause the command to be executed for all files at that path, which is unnecessary.
If the command accepts n
arguments (multiple filenames), we can use the pre-commit "normally", by letting it command in which files the hook should be executed -- only those that have been changed in the commit.
Consequently, this will improve the hook's execution speed, since it will not be checking for unnecessary files.
With this enhancement, we can update the .pre-commit-hooks.yaml
to:
--- a/.pre-commit-hooks.yaml
+++ b/.pre-commit-hooks.yaml
@@ -5,7 +5,8 @@
always_run: true
- pass_filenames: false
+ pass_filenames: true
+ types: [jupyter]