~/talk

Hooking into the import system

Talkat PyCon US 2022 · 2022-04-27..05-03· [python]
links:none on file
slides:none on file

Explains a concrete import-hook system used at Bloomberg that blocks imports like socket via a custom finder, loads modules from a database with a finder+loader pair that execs code into module.__dict__, and supports immediate deployment by writing to sqlite3 (demo uses an in‑memory DB). Claims the loader+finder is ~about 30 lines of Python, registers in sys.meta_path, and returns the expected ModuleNotFoundError when absent. The demo runs and shows function calls returning correct values and fast availability.

AI-written summary · about

  1. 0:00Introduction
  2. 1:22Python import system
  3. 5:32Tracing finder example
  4. 7:24Implementing a block list
  5. 11:00Loading from a database
  6. 19:17Database loader demo
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.