Monday, July 9 at 1:30 PM
As a user of scientific Python libraries like NumPy, Pandas, and matplotlib it’s worth asking how the maintainers of those libraries manage to keep the codebases running quickly and correctly when there are large codebases, many features, and many contributors. Those developers have to think deliberately about the design of their code; they use a number of techniques to make their lives easier, among them testing, debugging, profiling, and packaging. Exactly as these techniques are useful to library maintainers, they can also be useful to researchers, data scientists, and analysts who are trying keep code fast and correct as it undergoes changes. This tutorial will introduce attendees to deliberate code design, testing using the pytest framework, Python’s debugging tools, profiling code to understand performance, and how to reuse code in multiple places.
See the tutorial description on the conference website here.
This tutorial will require editing Python and other text files. If you don't already have a preferred editor, we recommend one of the following (each may not work on all platforms):
- VS Code
- Sublime Text
- Atom
- Notepad++ (Windows Only)
Please do at least the download and install of Anaconda before coming to the tutorial! We can help with further setup at the tutorial.
If you don't already have Anaconda installed, download and install Anaconda for Python 3: https://www.anaconda.com/download. If you're prompted to install VS Code we recommend you do install it unless you already have a code editor you prefer (or you picked one above).
If you'd like to do your own setup, we'll be using the following Python libraries:
The basic Anaconda install has almost all that's needed for this tutorial,
but if you'd like to create an isolated environment for this tutorial you
can use the conda create
command:
conda create --name scipy2018-swe python=3.6 jupyter pytest snakeviz conda-build
You can test your Anaconda installation using these instructions.
In this tutorial you'll be running code at the command line, so please make sure you can run Python there. As an example, try running the following command at the command line:
python -c 'print("This works!")'
Or, on Windows, try the following:
py -c 'print("This works!")'
You will see This works!
printed when it works.
- Running Python on Windows: https://docs.python.org/3.6/using/windows.html
- Python Argparse Tutorial (standard library Command Line Interface module)
- pdb - The Python Debugger
- pytest Documentation - a useful testing library
- Python Logging Tutorial
- Conda
- setuptools tutorial
Below are some useful references to help you get more acquainted with Python and other programming fundamentals.