Skip to content

Coding Tips

In this book, we focus on python-based deep learning projects. In the main chapters, we will focus on the theories and actual code. Thus all the tech stack related topics are shoved into this chapter as references.


This chapter is not aiming to be a comprehensive note on these technologies but a few key components that may be missing in many research-oriented tech stacks. We assume the readers have worked with the essential technologies in a python-based deep learning project.

Good References for Coding in Research

Some skills only take less than an hour to learn but people benefit from them for many years. Managing code exactly falls into this type of knowledge.

The Good Research Code Handbook is a very good and concise guide to build good coding habits. This should be a good first read.

The Alan Turing Institute also has a Research Software Engineering with Python course. This is a comprehensive generic course for boosting python coding skills in research.

A Checklist of Tech Stack

We provide a concise list of tools for coding. Most of them are probably already integrated into most people's workflows. Hence we provide no descriptions but only the list itself.

In the following diagrams, we highlight the recommended tools using orange color. Clicking on them takes us to the corresponding website.

The first set of checklists is to help us set up a good coding environment.

flowchart TD
classDef highlight fill:#f96;

env["Setting up Coding Environment"]
git["fa:fa-star Git"]:::highlight
ide["Integrated Development Environment (IDE)"]
vscode["Visual Studio Code"]:::highlight
jupyter["Jupyter Notebooks"]
python["Python Environment"]
py_env["Python Environment Management"]
pyenv_venv["Pyenv + venv"]

click git "" "Git"
click precommit "" "pre-commit"
click vscode "" "Visual Studio Code"
click jupyter "" "Jupyter Lab"
click pycharm "" "PyCharm"
click conda "" "Anaconda"
click pyenv "" "pyenv"
click venv "" "venv"
click poetry "" "poetry"

env --- git
git --- precommit

env --- ide
ide --- vscode
ide --- jupyter
ide --- pycharm

env --- python
python --- py_env
py_env --- conda
py_env --- pyenv_venv
py_env --- poetry

pyenv_venv --- pyenv
pyenv_venv --- venv

The second set of checklists is to boost our code quality.

flowchart TD
classDef highlight fill:#f96;

python["Python Code Quality"]
test["Test Your Code"]

click pytest "" "pytest"
click black "" "black"
click isort ""
click mypy ""
click pylint ""
click flake8 ""
click pylama ""

python --- test
test --- pytest

python --- formatter
formatter --- black
formatter --- isort

python --- linter
linter --- mypy
linter --- pylint
linter --- flake8
linter ---pylama

Finally, we also mention the primary python packages used here.

flowchart TD
classDef highlight fill:#f96;

dataml["Data and Machine Learning"]
lightning["PyTorch Lightning"]:::highlight

click pandas ""
click pytorch ""
click lightning ""

dataml --- pandas
dataml --- pytorch
dataml --- lightning

Contributors: LM