cornellius-gp / linear_operator

A LinearOperator implementation to wrap the numerical nuts and bolts of GPyTorch
MIT License
95 stars 28 forks source link

Cleaned up configuration for isort and black #43

Closed JonathanWenger closed 1 year ago

JonathanWenger commented 1 year ago

In a Nutshell

Configuration between linters isort and black was only handled in pre-commit hooks and could lead to conflicts.

In Detail

When running pre-commit hooks and also locally installing black via the instructions in CONTRIBUTING.md one could end up with different versions / settings leading to reformatting from the pre-commit hooks every commit. I also fixed the exclusions in the pre-commit configuration along the way, since it was throwing warnings:

 ▶ git commit -m "foo"
[WARNING] The 'exclude' field in hook 'flake8' is a regex, not a glob -- matching '/*' probably isn't what you want here
[WARNING] The 'exclude' field in hook 'black' is a regex, not a glob -- matching '/*' probably isn't what you want here
[WARNING] The 'exclude' field in hook 'isort' is a regex, not a glob -- matching '/*' probably isn't what you want here
[WARNING] The 'exclude' field in hook 'require-ascii' is a regex, not a glob -- matching '/*' probably isn't what you want here
[WARNING] The 'exclude' field in hook 'forbid-binary' is a regex, not a glob -- matching '/*' probably isn't what you want here
JonathanWenger commented 1 year ago

It seems like there are some inconsistencies in the import formatting in the current library. Let me know if you're fine with me just reformatting the imports in this PR.

Balandat commented 1 year ago

How do you (and @gpleiss, @jacobrgardner) feel about using µfmt (https://ufmt.omnilib.dev/en/stable/)? This takes care of the conflicts between black and isort, we've been using it without issues in BoTorch for a long time now.

gpleiss commented 1 year ago

I am 100% in favor of any dev practices you all use for BoTorch :)

Balandat commented 1 year ago

Done in #56.