PyCon Israel 2025

Code reloading: challanges, approaches & libraries
09-09, 13:00–13:20 (Asia/Jerusalem), Hall 1
Language: English

Code reloading is fun! Python's semantics for def, class complicate it. There are multiple approaches and multiple libraries; I don't think any is one-size-fits-all. This talk will teach you how they work to make informed choice for your code.


Edit->reload cycle on running software may be more fun & productive than exiting and losing state.
Python's semantics for class and defcreating a new object are not as friendly to reloading as Smalltalk/Lisp/Ruby which patch in-place. Reloading is still very possible, with multiple approaches and libraries but I believe you better understand the issues and implementation tradeoffs.
- What importlib.reload() does and does not.
- Copied references: from ... import ..., instances, callbacks & closures, etc.
- => Recording what-imported-what dependency graph.
- => Patching classes/functions in-place vs. Updating references? Limitations.
- A secret weapon: gc.get_referrers()
- What IPython's %autoreload, jurigged, limeade do?
- Renames/deletions. Problem of intent. => jurigged AST diffing?!
- Top-level code, singletons, derived values. => Hard. Idempotent try: except NameError: style.


Expected experience level of participants

Intermediate

Target audience

Developers, Data Scientists, R&D, DevOps

See also: WIP slides

Worked in Python, JS, Ruby, Go and more; nostalgic for Forth, Spreadsheets, Lisp Machines, Boxer.
Believe in FOSS as just the starting point of wider unsolved problem of making software transparent to, and modifiable by, end users. Love interpreters that you can peek & poke at runtime.
For now ignorant about AI; interested in human cognition & learning.