Use good tools¶
Use the tools introduced in each section¶
For your convenience, here is a list of tools and packages discussed in each section of the book.
Set up your project¶
- git
a command line tool for code versioning
- github
a website where you can share code
- conda
a command line package manager and virtual environment manager
- setuptools
a Python library to define pip installable packages
- cookiecutter
a command line tool to create projects from templates
Keep things tidy¶
- flake8 and pylint
command line linters for Python
- black
a command line auto-formatter for Python code, with plugins for popular IDEs
- vulture
a Python package to identify dead code in your codebase
- jupytext
a command line tool to seamlessly translate between regular jupyter notebooks and a markdown-based representation
Write decoupled code¶
- pandas
a Python library to represent columnar data
- xarray
a Python library to represent multidimensional tensors with named dimensions
- collections
a Python standard library of containers, including defaultdict, counter, etc.
Write good docs¶
- argparse
a Python library to parse command-line arguments, part of the Python standard library
- shellcheck
a command-line tool that checks for common errors in bash scripts, with plugins for popular IDEs
- make
a command-line tool to define and run directed acyclic graphs of computation
- sphinx
a command-line tool to generate documentation from Python code and text files
- readthedocs
a website to host documentation
Make it social¶
- vscode live share
IDE extension for code sharing
- deepnote and cocalc
collaborative jupyter notebooks in the browser
- replit
collaborative IDE in the browser
Choose an IDE¶
Integrated development environments (IDE) can help you develop faster and make it easy to implement some of the productivity tips I’ve discussed previously. Preferred IDEs change from year to year, as new editors become favored while others are shunned. Don’t be surprised if in three years you’ll be using a different IDE.
I’ve evaluated many IDEs, and overall, I like vscode best. It’s open source, free, and fast. It has very good integrated Python development tools, and it has an impressive array of plugins for almost any imaginable use case. The git and github tools are particularly well integrated, which makes it easy to do source control outside of the command line. There is an integrated debugger, as well as a terminal, so it’s one-stop shop for development.
Others recommend PyCharm - it has best-in-class code understanding, and scales well to large codebases. It’s free for academics.
Use WSL on Windows¶
Windows’ basic terminal lacks basic features. Powershell is powerful but it is very different from other platforms. For a while, the best way to get a Unix-style shell on Windows was to use the git bash tool. In my opinion, these days the best-in-class terminal to use on Windows is Windows subsystem for Linux (WSL).
WSL is an emulation layer that allows you to run a full Linux kernel inside of a Windows terminal window. Once installed, you can install any Linux OS you like - Ubuntu being the de facto standard.
You won’t be able to run GUI applications. However, many tools you’ll want to use run webservers, for example jupyter - you’ll be able to access these through your your normal Windows-based web browser, such as Chrome, Firefox or Edge. Your Linux installation will run in a virtual filesystem, which you can access through Windows explorer by typing explorer
inside a WSL terminal. code .
will fire up a version of vscode in your current directory.