News for hackers. Stuff that matters.
Re:How to create a Python package in 2022 by carso on Thursday July 28, 2022 @10:04AM (#32264436)
Pre-commit running tools in it's own virtual environment is a feature, not a bug, in my book -- it means that the dependencies for my linter tools aren't mixed in with the dependencies for the code I'm writing.

And, keeping things separate from setup.cfg or pyproject.toml is optional: The tools still look for configuration in their usual places, so it's still possible have your black options in pyproject.toml and just a bare-bones entry to call black in your .pre-commit file if you prefer.

Re:How to create a Python package in 2022 by wyuenho on Thursday July 28, 2022 @10:09AM (#32264510)
Except your usual configuration don't necessarily work for your pre-commit hooks. A prime example is mypy.
Re:How to create a Python package in 2022 by js2 on Thursday July 28, 2022 @11:21AM (#32265534)
Sure it can. The pre-commit tool is just a framework for running multiple hooks at commit time against just the files which are modified in that commit. You can configure those hooks however you want.

You also don't have to run the hooks at pre-commit time. Just don't hook pre-commit into your checkout. The pre-commit tool can also be configured to run its checks at a different stages than, well, the pre-commit stage:

https://pre-commit.com/#top_level-default_stages