Currently there are some conventions informally agreed on that have not been documented.
This aims to document the current conventions.
https://wiki.blender.org/wiki/Style_Guide/Python should include a section for "Startup & Core Scripts"
Blender comes with scripts which are at the core of Blenders functionality:
- release/scripts/startup/, as the name suggests these run on startup and maintained by developers who work across many areas of Blender.
- release/scripts/modules/bpy/ the bpy module, the primary way Blender is exposed to Python.
For this reason, scripts that load on startup are intended to be kept fast and simple where possible.
There are some conventions not enforced in other areas of Blender's Python code-base.
- Delay imports.
Importing modules not loaded as startup have been moved inside methods to delay loading additional files at startup.
- Percentage style string formatting (as opposed to the format method or f-strings).
This creates strings more appropriate for interface translators.
- No type hinting.
While this may be evaluated in the future, most UI scripts are simple and don't gain so much from type hints.
- Single quotes for RNA rnums such as icon='WARNING' or ob.type == MESH double quotes for text descriptions (all other strings), such as layout.label(text="Text description")