Skip to content

bioamla.system

System services behind the bioamla config commands: checking for the system tools bioamla needs, and reporting versions and compute devices.

bioamla.system

bioamla.system — system services (configuration, dependencies, environment).

Folds the former dependency / util services into plain raising functions and dataclasses:

  • :mod:bioamla.system.dependency — check/install system tools (FFmpeg, libsndfile, PortAudio).
  • :mod:bioamla.system.util — version and compute-device information.

These power the bioamla config CLI group. torch is imported lazily by :func:bioamla.system.util.get_device_info.

Dependencies

System dependency checking and installation.

Folds the former services/dependency.py into plain raising functions and dataclasses. Checks for system-level tools required by bioamla (FFmpeg, libsndfile, PortAudio) and can attempt to install them via the platform package manager.

DependencyInfo dataclass

Information about a system dependency.

DependencyReport dataclass

Report of all dependency statuses.

detect_os

detect_os() -> str

Detect the operating system / package-manager family.

Returns:

Type Description
str

One of: 'debian', 'fedora', 'rhel', 'arch', 'macos', 'windows',

str

'unknown-linux', 'unknown'.

check_ffmpeg

check_ffmpeg() -> DependencyInfo

Check if FFmpeg is installed.

check_libsndfile

check_libsndfile() -> DependencyInfo

Check if libsndfile is installed.

check_portaudio

check_portaudio() -> DependencyInfo

Check if PortAudio is installed.

get_install_commands

get_install_commands(os_type: str) -> dict[str, str]

Get per-dependency install commands for an OS family.

get_full_install_command

get_full_install_command(os_type: str) -> str | None

Get a single command to install all dependencies for an OS family.

check_all

check_all() -> DependencyReport

Check all system dependencies and return an aggregated report.

run_install

run_install(os_type: str | None = None) -> tuple[bool, str]

Attempt to install system dependencies via the platform package manager.

Returns a (success, message) tuple. Use :func:install for a raising variant.

install

install(os_type: str | None = None) -> str

Install system dependencies, raising on failure.

Returns:

Type Description
str

Success message string.

Raises:

Type Description
ProcessingError

If installation fails or is unsupported.

install_missing

install_missing() -> dict

Install whatever system libraries are missing, then check again.

Returns:

Type Description
dict

{"installed": message or None (nothing was missing), "report": the check}.

Raises:

Type Description
BioamlaError

If the install fails.

Versions and devices

System information utilities (version, compute devices).

Folds the former services/util.py into plain raising functions and dataclasses. Device info uses torch (imported lazily for fast startup).

DeviceInfo dataclass

Information about a compute device.

DevicesData dataclass

Available compute devices.

VersionData dataclass

Version information for bioamla and key dependencies.

get_version

get_version() -> VersionData

Return version information for bioamla and key dependencies.

get_device_info

get_device_info() -> DevicesData

Return available compute devices (CUDA, MPS, CPU).

Without torch (the [ml] extra) only the CPU is reported.