Module

cli.commands.upgrade.installers

Installer detection for bengal upgrade command.

Detects how Bengal was installed and generates appropriate upgrade command. Supports: uv, pip, pipx, conda, and fallback to pip with --user.

Detection priority:

  1. uv.lock exists → uv
  2. pipx list shows bengal → pipx
  3. Virtual environment active → pip in venv
  4. CONDA_PREFIX set → conda
  5. Fallback → pip (user install)

Related:

  • bengal/cli/commands/upgrade/command.py: Uses this for upgrade execution

Classes

InstallerInfo 4
Information about detected installer.

Information about detected installer.

Attributes

Name Type Description
name str
command list[str]
display_command str

Methods

is_available 0 bool
Check if the installer executable is available in PATH.
property
def is_available(self) -> bool
Returns
bool

Functions

detect_installer 0 InstallerInfo
Detect how Bengal was installed. **Attempts detection in priority order:** 1. …
def detect_installer() -> InstallerInfo

Detect how Bengal was installed.

Attempts detection in priority order:

  1. uv (preferred for Bengal projects)
  2. pipx (isolated CLI tools)
  3. conda (Anaconda/Miniconda environments)
  4. pip in venv (standard virtual environments)
  5. pip --user (fallback for global installs)
Returns
InstallerInfo
_is_uv_project 0 bool
Check if current directory is a uv-managed project. **Looks for:** - uv.lock i…
def _is_uv_project() -> bool

Check if current directory is a uv-managed project.

Looks for:

  • uv.lock in current directory or parent directories
  • UV_* environment variables (UV_CACHE_DIR, UV_PYTHON)
Returns
bool
_is_pipx_install 0 bool
Check if Bengal was installed via pipx. Runs `pipx list --short` and checks if…
def _is_pipx_install() -> bool

Check if Bengal was installed via pipx.

Runspipx list --shortand checks if 'bengal' appears in output. Uses a 5s timeout to avoid hanging on slow systems.

Returns
bool