Exploration-Oriented Programming
By Moshe Zadka

Can Jupyter change how we develop software? Instead of having an edit-debug cycle, we can iterativey build up code snippets with confidence, seeing how they process their inputs. Jupyter lets us refine ideas in real time, integrating testing with development. Exploration-oriented programming is developing inside an interactive environment.

Saturday 2:05 p.m.–2:35 p.m.

Jupyter Basics (7m)

Jupyter is an interactive development environment based on the read-edit-eval loop. We will examine a bit of its history, and show-case how it works for those new to Jupyter -- while also showing a few tricks even experienced Jupyterians will appreciate.

Incremental Development (7m)

Next we will discuss best practices for incremental development. Incremental development is slightly different from writing code in Python modules. The global namespace matters a lot more, and must be managed carefully. Writing code with less side-effects allows using the same data structure multiple times, increasing iteration speed. Finally, it is often useful to write little snippets which will crawl intermediate results and verify them for correctness.

Collaboration (7m)

There are things to keep in mind when collaborating with Jupyter notebooks. Since they are edited by an automatic tool, they can often accumulate "cruft" which confuses version control systems. Having utilities for cleaning notebooks pre-commit, as well as linting them in a continuous integration environment post-commit, allows managing such cruft, and getting usable, reviewable, diffs. It is useful, as well, to be able to "run" notebooks in continuous integration, verifying correctness.

Production (7m)

If we develop our code in Jupyter, we need to somehow get it to run in production. Luckily, modern Python import machinery is flexible enough that we can write packages that look, to the users, like regular Python code. We will cover how to mark cells appropriately as "tests" or "code", and how to set up such machinery -- all the way to building PyPI-ready wheels.

Summary (2m)

If we recognize that writing code is a process of successive approximation, we can stop having "IDE-envy" of static languages with all their facilities and develop with the Python grain: interactively, using the dynamicity to make the programming environment better, not worse.

Moshe Zadka

Moshe has been in the open source community since 1995 and in the Python community since 1999. He has been a core contributor to Python, and is a core contributor, and an early member, of the Twisted project.

Twitter

Sponsors