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.
Until we implement an easy solution to this, there's a trick to make a runtime resume from its own filesystem state:
- Create a python cell
- Create a bash installation cell and run it
- Lock the installation cell via the gutter menu
- Check the Export the environment box in the runtime settings and name the runtime
- Save the runtime
- Choose the own runtime to use it's own environment
- Optionally uncheck the Export the environment box
- 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.
Locked installation cell:
pip install svgwrite