python-guide icon indicating copy to clipboard operation
python-guide copied to clipboard

Recommend pre-commit in Code Style section

Open tommorris opened this issue 8 years ago • 1 comments

The Code Style section discusses the use of PEP8 and autopep8. Yelp's pre-commit framework allows you to formalise the use of PEP8 in a project by ensuring that PEP8/PyFlakes is run on Python code (as well as equivalent tools for other languages like JSHint). Pre-commit is not mandatory: it is something which individual developers on a project can install if they feel like it - the pre-commit framework simply allows you to share around a common set of pre-commit scripts in a sensible way.

If it is desirable to follow "Pythonicity" in a project, it is probably a good idea to suggest people enforce it at the level of version control.

If there's interest in this, I can draft some text for inclusion and submit a PR.

tommorris avatar Oct 29 '15 13:10 tommorris

The guide is not quite of the opinion that people have to enforce it. I'm on the fence about adding mention of the pre-commit framework. I'm encouraged by the fact that their website says:

pre-commit only runs on the staged contents of files by temporarily saving the contents of your files at commit time and stashing the unstaged changes while running hooks.

That said, with the exception of autopep8 and autoflake (for PyFlakes), the number of auto$(styleguide) tools that exist for python is not so high. All of this to say: I don't know. I'll let @kennethreitz decide.

sigmavirus24 avatar Oct 29 '15 13:10 sigmavirus24