Good Code#
Logging#
This is something I often use whenever I am in the process of building software and I think there are some key things that need to be documented. It is often much better than print statements. I often do this when I’m not really sure if what I did is correct in the process. It’s really important to log. Especially when you’re doing server computing and you need a history of what was going on.
Tip
My Style
INFO
- General stuff of where I am at in the program so I can follow the control of flowDEBUG
- Typically more about sizes/shapes of my matrices or possibly in the checksWARNING
- Where things could go wrong but I have ignored this part due to some reason.
Tip
Resources
Python Logging: A Stroll Through the Source Code - RealPython
Python Logging Cheat Sheet - gist
The Hitchhikers Guide to Python: Logging - blog
Good Logging Practice in Python - blog
Logging CookBook - Python Docs
Corey Schafer
Testing#
Something that we all should do but don’t always do. It’s important for the long run but it seems annoying for the short game. But overall, you cannot go wrong with tests; you just can’t.
Note
My Style
Package - PyTest
IDE - VSCode
Tip
Resources
Testing Python Applications with PyTest - Blog
Getting Started with Testing in Python - RealPython
Testing Your Python Code with PyTest - SciPy 2019
Learn PyTest in 60 Minutes: Python Unit Testing Framework - Youtube
Python Testing in VSCode - VSCode Docs
Eric Ma
Testing Data Science Code - YouTube
Best Testing Practices - PyCon 2017
Repository Organization#
Packaging#
Type Checking#
Continuous Integration#
WorkFlow#
JupyterLab - Prototyping, Remote Computing
VSCode - Package Management, Remote Computing
Remote Computing - SSH (JLab, VSCode)