MCPcopy Index your code
hub / github.com/langchain-ai/deepagents / detect_install_method

Function detect_install_method

libs/code/deepagents_code/update_check.py:1023–1047  ·  view source on GitHub ↗

Detect how `deepagents-code` was installed. Checks `sys.prefix` against known paths for uv and Homebrew. Returns: The detected install method: `'uv'`, `'brew'`, `'other'`, or `'unknown'` (editable/dev installs).

()

Source from the content-addressed store, hash-verified

1021
1022
1023def detect_install_method() -> InstallMethod:
1024 """Detect how `deepagents-code` was installed.
1025
1026 Checks `sys.prefix` against known paths for uv and Homebrew.
1027
1028 Returns:
1029 The detected install method: `'uv'`, `'brew'`, `'other'`, or `'unknown'`
1030 (editable/dev installs).
1031 """
1032 from deepagents_code.config import _is_editable_install
1033
1034 prefix = sys.prefix
1035 # uv tool installs live under ~/.local/share/uv/tools/
1036 if "/uv/tools/" in prefix or "\\uv\\tools\\" in prefix:
1037 return "uv"
1038 # Homebrew prefixes
1039 if any(
1040 prefix.startswith(p)
1041 for p in ("/opt/homebrew", "/usr/local/Cellar", "/home/linuxbrew")
1042 ):
1043 return "brew"
1044 # Editable / dev installs — don't auto-upgrade
1045 if _is_editable_install():
1046 return "unknown"
1047 return "other"
1048
1049
1050def upgrade_command(

Callers 10

_collect_diagnosticsFunction · 0.90
upgrade_commandFunction · 0.85
detect_shadowed_dcodeFunction · 0.85
perform_upgradeFunction · 0.85
perform_install_extraFunction · 0.85
perform_install_packageFunction · 0.85

Calls 1

_is_editable_installFunction · 0.90

Used in the wild real call sites across dependent graphs

searching dependent graphs…