Let's Write an IPython Extension (in IPython)
summary
A live-built IPython extension that prints execution time for every cell is implemented entirely inside IPython using the events API and a single file in .IPython/extensions/timer.py The code registers callbacks on pre_run_cell and post_run_cell, implements load_ipython_extension and unload_ipython_extension, handles a None timer, and fixes duplicate registrations by keeping one instance and by clearing the event callbacks manually; the extension ends up working in the same session.
AI-written summary · about
chapters (9)
- 0:00Start
- 0:44Write an Extension for Ipython
- 1:22Extensions
- 2:03Make an Ipython Extension
- 2:54Edit Magic
- 3:29Python Events
- 4:34The Load Ipython Extension Function
- 6:14Unload an Extension
- 7:36The Ipython Object
related talks
32mWriting Extension Modules To Be Interruptible
28mCreating custom engines for flexible notebook execution
09m9 Jupyter Notebook Tricks for Your Next Advent of Code
15mExtending Python Into the Future
35mCustomizing JupyterLab using extensions
34mPython ate my Homework!
42mMaking your code faster: Cython and parallel processing in the Jupyter Notebook
03h 21mIntroduction to Decorators: Power Up Your Python Code
