Code review is essential to write clean and maintainable code. In large code base, most code is purposed to be read than written. The following are a summary of reference for code review in our team collaboration project.
General Code review guide by Google
PEP 8 -- Style Guide for Python Code
- Descriptive: Naming Styles: eg single_leading_underscore: weak "internal use" indicator.
- [Python Call Graph: Python module that creates call graph visualizations for Python applications] (https://github.com/gak/pycallgraph/blob/master/docs/index.rst)
- Flame Graphs
- py-spy: Sampling profiler for Python programs
pydoc django
- Using Sphinx
- There is an official Django coding style which provides a recommended ordering for models:
- choices
- database fields
- custom manager attributes
- Meta
- def str()
- def save()
- def get_absolute_url()
- custom methods
- An app's name should follow Pep 8 Guidelines, namely it should be short, all-lowercase and not include numbers, dashes, periods, spaces, or special characters. It also, in general, should be the plural of an app's main model, so our posts app would have a main model called Post.
- Reference by Django Best Practices: Projects vs Apps
Effective Go
Save you and your teammates time: