Implementation Guidelines
Writing Python Modules
Logging
Software Testing
Exception Handling
Program Design and QA
QA should explicitly address the following about the code being reviewed:
Creating and distributing Python packages
Architechtural Considerations
Configurations
Data Architectures
Data Ingestion
Effective Queries
Model Reproducibility
EC2 Cloud Service
Feedbacks
Implementation Guidelines
Writing Python Modules
__init__.py, we will discuss this in the Python package module).from module import *(except in__init__.py, we will discuss this in thePython package module).PYTHONPATHenv variable (not viasys.path.append()).argparseto define command-line options and arguments.Logging
DEBUGfor things you only want to log while developing.INFOfor things you want to monitor while in production.WARNINGfor things that would need attention in production.ERRORfor when an exception occurs .development and production.
logger = logging.getLogger(__name__)..gitignore.Software Testing
tests/folder.tests/folder the same as the code you’re testing (e.g. same structure assrc/).module_x.py, name the test file,test_module_x.py.function(), name the test function,test_function_<descriptor>.py, where<descriptor>describes what is being tested.
(this may not be sufficient in the real world).
pytestfor all class assignments.Exception Handling
except: as a final resort for errors that can not be expected ahead of time.raiseif possible in any calling code that will be deployed as this will break the code and end the application.tryclause to specific operations. For example, if you have to open a file andopen a database connection, then you should have two try-except blocks, one for the fileopening and one for the database connection.Program Design and QA
multiple functions to do a larger task).
QA should explicitly address the following about the code being reviewed:
Creating and distributing Python packages
Architechtural Considerations
Configurations
Data Architectures
Data Ingestion
Effective Queries
Model Reproducibility
EC2 Cloud Service
Feedbacks