by Martin KavalarOct 10 2019
Making science reproducible @nextjournal

Incremental Environments

Problem

Currently a runtime always starts from the clean filesystem state of its parent environment. This is good for eliminating hidden state but can be cumbersome in practice. Our often proposed solution to add a installation runtime and a second runtime that uses the exported environment is a lot of work.

Solution

Until we implement an easy solution to this, there's a trick to make a runtime resume from its own filesystem state:

  1. Create a python cell
  2. Create a bash installation cell and run it
  3. Lock the installation cell via the gutter menu
  4. Check the Export the environment box in the runtime settings and name the runtime
  5. Save the runtime
  6. Choose the own runtime to use it's own environment
  7. Optionally uncheck the Export the environment box
  8. Next time you want to save a new version (because you added more packages) check the Export the environment box again, save it and uncheck it.

Example

Locked installation cell:

pip install svgwrite

Python cell:

import svgwrite