This article provides a definition of ready to enable a development team to decide when a task is ready to be started with.
The target audience are Python developers contributing to one of my projects, be it open source or commercial. It can also be of interest for people who are looking for a basis for their own guidelines.
This document is distributed under the CC BY 4.0 license.
As a starting point for your own pre-commit hook, you can use pygount's .pre-commit-config.yaml.
In general, use the PEP8 naming conventions. Concerning upper/lower/camel/snake case, they are a mess, but almost every Python projects conforms to them, therefor consistency trumps reason.
Exception: For package names consisting of multiple words, use an underscore
(_
) to separate them.
Rationale: The pain of garbled, illegible packaged names is just too much.
For acronyms use treat only the first character as upper case.
Avoid abbreviations unless you can save at least 4 letters. Example for popular abbreviations that could be rephrased better:
| Instead of... | meaning... | better use... | |---------------|-------------|---------------| | dir | directory | folder | | dst | destination | target | | src | source | source |
Split up long functions into multiple sub-functions or a class with multiple methods.
This guideline deliberately does not include an exact definition of long. For more details on this topic, refer to the book "Clean code", chapter 3, "Functions".