monthly_energy_balance_resu.../PYGUIDE.md
2020-06-09 10:22:20 -04:00

1.2 KiB

Cerc Python Style Guide

What's coding style and why it matters

Coding style is just how the code looks, it's incredibly personal, and everyone has their style.

Your preferred architectures, variable and function naming style all of then impacts in your code style and how the others read and understand it, so it could become a significant burden if everyone is coding on his own.

At CERC we are following the PEP8 with two spaces indentation instead of four.

Tools.

We use PyCharm as an integrated development environment and follow the tool's overall advice but the space indentation, which we set to two spaces instead of default four spaces.

For code analysis, we enforce the usage of pylint with our own custom style definition

Naming convention

  • Name your folders and files in lowercase.
  • Your class names must start in capital letters and follow the python CapWords pattern.
  • Methods and properties that return lists must end in "s".
  • Constants names must be all capitals.
  • Avoid the usage of "get_" and "set_" methods whenever possible, by using @property and @variable.setter decorators instead.