dbx_patch.patches.python_path_hook_patch
source module dbx_patch.patches.python_path_hook_patch
PythonPathHook Patch for Editable Installs.
This module monkey-patches dbruntime.pythonPathHook.PythonPathHook to preserve editable install paths when sys.path is modified by the Databricks runtime.
The PythonPathHook manages sys.path updates when changing notebooks or working directories. Without this patch, editable install paths can be lost during these updates.
Classes
-
PythonPathHookPatch — Patch for PythonPathHook to preserve editable install paths.
source class PythonPathHookPatch(verbose: bool = True)
Bases : BasePatch
Patch for PythonPathHook to preserve editable install paths.
Preserves editable install paths when sys.path is modified by the Databricks runtime during notebook or working directory changes.
Initialize the patch (called only once due to singleton).
Parameters
-
verbose : bool — Enable verbose logging
Methods
-
patch — Apply the PythonPathHook patch.
-
remove — Remove the patch and restore original PythonPathHook behavior.
-
is_applied — Check if the PythonPathHook patch is currently applied.
source method PythonPathHookPatch.patch() → PatchResult
source method PythonPathHookPatch.remove() → bool
Remove the patch and restore original PythonPathHook behavior.
Returns
-
bool — True if unpatch was successful, False otherwise
source method PythonPathHookPatch.is_applied() → bool
Check if the PythonPathHook patch is currently applied.
Returns
-
bool — True if patched, False otherwise