Skip to content

Latest commit

 

History

History
102 lines (72 loc) · 4.11 KB

python_coding_guidelines_and_tools.md

File metadata and controls

102 lines (72 loc) · 4.11 KB

2 Python coding guidelines and tools

This section covers python coding style guidelines followed.

PEP 8- Style guide for python code:

PEP8 covers python code style guide and helps to maintain consistency in code. A style guide is about consistency. Consistency within a project or module or function is most important. Complete specification available at https://www.python.org/dev/peps/pep-0008/

PEP 257- Docstring Conventions:

PEP257 covers semantics and conventions associated with python docstrings. The aim of PEP257 to standardize the high-level structure of docstrings. Complete specification available at https://www.python.org/dev/peps/pep-0257/

PEP 484- Type Hints:

PEP484 introduces a provisional module to provide the standard definitions and tools, along with some conventions for situations where annotations are not available. More details on PEP484 available at https://www.python.org/dev/peps/pep-0484/

Flake8:

Flake8 is a Python library wrapper around PyFlakes, pycodestyle and Ned Batchelder’s McCabe script

PyFlakes:

Pydcodestyle:

McCabe:

pytest:

It is important to validate the classes, methods, and functions we write. This will help to miniate the core software functionality of the modules. This is possible by writing a unit test which is the first level of software functionality validation. The pytest framework helps to write small test, yet scales to support complex functional testing for applications and libraries.

Complete features and documentation available at: https://docs.pytest.org/en/latest/contents.html

mypy:

The mypy tool aims to combine the benefits of dynamic and static typing. mypy combines a powerful type system and compile-time type checking. It is an optional static type checker for python. Mypy type checks standard Python programs; run them using any Python VM with basically no runtime overhead. More details available at https://mypy.readthedocs.io/en/stable/