Skip to content

blackbull.server.reload

blackbull.server.reload

Master re-exec with inherited listening sockets.

Re-import code by replacing the master, not importlib.reload. Keep listeners open across exec and close temporary event loops before fork.

FileChangeWatcher

Daemon-thread wrapper around watchfiles.watch.

Parameters

paths: Iterable of filesystem paths to watch. Each path can be a file or a directory; directories are watched recursively. on_change: Zero-argument callable invoked exactly once per debounced batch of file events. Runs on the watcher thread, so must be cheap and threadsafe — typical use is to set a threading.Event the master's main loop polls. watch_filter: Optional watchfiles watch_filter callable. Defaults to *.py-only.

start()

Start the watcher thread. No-op if already running.

exec_self_with_sockets(sockets, argv=None)

Re-execute without returning on success, preserving listening descriptors.

The caller must terminate subprocesses holding copies first. Preserve the original interpreter options and invocation unless argv overrides them. sys.executable is always the executable.