Python
This is a list of best practices to be applied in developments with the goal of increasing the standardization of our code and quality:
- The main set of conventions used in Python is PEP8
The inline docs follow the Google docs which has exaplanation, args, return and exception fields Imports must be alfabetically ordered, splitted in 3 sections(standard, third part, local) and separated by a blank line A row has a maximum lenght of 79 columns Every module's scope function and class must be surrounded by 2 blank lines. The class's scope function only by 1 Strings should always be enclosed in double quotes Path must be handled with pathlib.Path to have correct evaluation in different systems Always use logger instead of print, to have a more structured visibility of the execution Handling max login attempts in scraping, with a notify (ex, email) to avoid credential blacklisting and alert users Install private packages
Writing unit test to avoid change request/bug resolution/refactor from creating a development malfunction. This can be done easily writing atomic functions and test every core function of the development
Package versioning tags are a key to release correct versions for different scopes (ex. 1.0.0.dev, 1.0.
Store semversioning in developments too, in files like setup.toml, .version and commits. To update new version
to get a cleaner visibility in Grafana Use a common formatter for logging: "%(asctime)s - %(name)s - %(levelname)s - %(message)s" with thread_name if needed