Skip to content

dbx_patch.patches.sys_path_init_patch

source module dbx_patch.patches.sys_path_init_patch

sys_path_init Patch for Editable Installs.

This module monkey-patches sys_path_init.patch_sys_path_with_developer_paths() to automatically process .pth files and add editable install paths to sys.path.

This is more elegant than manually calling process_all_pth_files() because it hooks into Databricks' existing sys.path initialization logic.

Classes

  • SysPathInitPatch — Patch for sys_path_init.patch_sys_path_with_developer_paths.

source class SysPathInitPatch(verbose: bool = True)

Bases : BasePatch

Patch for sys_path_init.patch_sys_path_with_developer_paths.

Wraps Databricks' sys.path initialization to automatically process .pth files and add editable install paths to sys.path.

Initialize the patch (called only once due to singleton).

Parameters

  • verbose : bool — Enable verbose logging

Methods

  • patch — Apply the sys_path_init patch.

  • remove — Remove the patch and restore original sys_path_init behavior.

  • is_applied — Check if the sys_path_init patch is currently applied.

source method SysPathInitPatch.patch() → PatchResult

Apply the sys_path_init patch.

Returns

source method SysPathInitPatch.remove() → bool

Remove the patch and restore original sys_path_init behavior.

Returns

  • bool — True if unpatch was successful, False otherwise

source method SysPathInitPatch.is_applied() → bool

Check if the sys_path_init patch is currently applied.

Returns

  • bool — True if patched, False otherwise