system_info
sleap.system_info
¶
System information and startup banner for SLEAP.
Classes:
| Name | Description |
|---|---|
BinaryInfo |
Information about a CLI binary. |
CondaInfo |
Information about conda environment. |
GPUInfo |
Information about GPU. |
PackageInfoData |
Information about an installed Python package. |
UVInfo |
Information about uv installation and configuration. |
Functions:
| Name | Description |
|---|---|
analyze_path |
Analyze PATH for conflicts. |
get_all_package_info |
Get info for all relevant SLEAP packages. |
get_binary_info |
Get detailed information about a CLI binary. |
get_conda_info_data |
Get conda environment information. |
get_default_python_version |
Get the default Python version from .python-version files or UV_PYTHON. |
get_detailed_package_info |
Get detailed package info including git status for editables. |
get_disk_info |
Get disk usage info for path: (used, available, total). |
get_ffmpeg_info |
Get ffmpeg binary information from PATH and imageio-ffmpeg. |
get_git_info |
Get git information for a directory. |
get_memory_info |
Get RAM usage info: (used, available, total). Cross-platform. |
get_nvidia_info |
Get NVIDIA driver version, CUDA version, and GPU info. |
get_package_info |
Get package version, location, and install source without importing. |
get_pytorch_info |
Get PyTorch version and device information. |
get_pytorch_info_detailed |
Get PyTorch version, accelerator, and CUDA version. |
get_sleap_commit |
Get the short git commit SHA the installed SLEAP was built from. |
get_uv_config_value |
Get a uv config value by checking config files and env vars. |
get_uv_info_data |
Get comprehensive uv information including config settings. |
print_startup_banner |
Print the SLEAP startup banner with version info. |
resolve_tag_commit |
Resolve a release version to its commit SHA via the GitHub REST API. |
run_command |
Run a command and return (returncode, stdout, stderr). |
short_sha |
Shorten a git commit SHA for display. |
BinaryInfo
dataclass
¶
CondaInfo
dataclass
¶
Information about conda environment.
Source code in sleap/system_info.py
GPUInfo
dataclass
¶
PackageInfoData
dataclass
¶
Information about an installed Python package.
Source code in sleap/system_info.py
UVInfo
dataclass
¶
Information about uv installation and configuration.
Source code in sleap/system_info.py
analyze_path()
¶
Analyze PATH for conflicts.
Source code in sleap/system_info.py
get_all_package_info()
¶
Get info for all relevant SLEAP packages.
Returns:
| Type | Description |
|---|---|
Dict
|
Dict mapping package names to their info dicts. Only includes packages that are installed. |
Source code in sleap/system_info.py
get_binary_info(name)
¶
Get detailed information about a CLI binary.
Source code in sleap/system_info.py
get_conda_info_data()
¶
Get conda environment information.
Source code in sleap/system_info.py
get_default_python_version()
¶
Get the default Python version from .python-version files or UV_PYTHON.
Source code in sleap/system_info.py
get_detailed_package_info(name)
¶
Get detailed package info including git status for editables.
Source code in sleap/system_info.py
714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 | |
get_disk_info(path)
¶
Get disk usage info for path: (used, available, total).
Source code in sleap/system_info.py
get_ffmpeg_info()
¶
Get ffmpeg binary information from PATH and imageio-ffmpeg.
Source code in sleap/system_info.py
1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 | |
get_git_info(path)
¶
Get git information for a directory.
Source code in sleap/system_info.py
get_memory_info()
¶
Get RAM usage info: (used, available, total). Cross-platform.
Source code in sleap/system_info.py
1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 | |
get_nvidia_info()
¶
Get NVIDIA driver version, CUDA version, and GPU info.
Source code in sleap/system_info.py
get_package_info(name)
¶
Get package version, location, and install source without importing.
Uses importlib.metadata so we don't have to import heavy packages just to check their versions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Package name (e.g., "sleap", "sleap-io", "numpy") |
required |
Returns:
| Type | Description |
|---|---|
Dict
|
Dict with version, location, source, and editable fields. If package is not installed, version will be None. |
Source code in sleap/system_info.py
get_pytorch_info()
¶
Get PyTorch version and device information.
Avoids importing torch at module level for fast startup.
Returns:
| Type | Description |
|---|---|
Dict
|
Dict with: - installed: bool - whether PyTorch is installed - version: str or None - PyTorch version - accelerator: str - "cuda", "mps", or "cpu" - cuda_version: str or None - CUDA version if available - driver_version: str or None - NVIDIA driver version if available - device_name: str or None - GPU name if available |
Source code in sleap/system_info.py
get_pytorch_info_detailed()
¶
Get PyTorch version, accelerator, and CUDA version.
Source code in sleap/system_info.py
get_sleap_commit(resolve_remote=False)
¶
Get the short git commit SHA the installed SLEAP was built from.
Works without a network for editable installs (live git checkout) and for
installs from a git URL (e.g. pip install git+https://github.com/talmolab/
sleap), where pip records the commit in direct_url.json.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolve_remote
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
Optional[str]
|
The shortened commit SHA, or |
Source code in sleap/system_info.py
get_uv_config_value(key)
¶
Get a uv config value by checking config files and env vars.
Source code in sleap/system_info.py
get_uv_info_data()
¶
Get comprehensive uv information including config settings.
Source code in sleap/system_info.py
print_startup_banner(verbose=False, console=None)
¶
Print the SLEAP startup banner with version info.
Displays a colorful ASCII art banner with SLEAP branding, version information, and helpful links for documentation and support.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
verbose
|
bool
|
If True, show detailed package table with versions and locations. |
False
|
console
|
Optional[Console]
|
Optional Rich Console instance. If None, creates a new one. |
None
|
Source code in sleap/system_info.py
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | |
resolve_tag_commit(repo, version, timeout=3)
¶
Resolve a release version to its commit SHA via the GitHub REST API.
Release installs (PyPI/conda) don't record a commit locally, but each release
is tagged vX.Y.Z. This looks that tag up on GitHub and returns the commit
it points to. It is fully offline-safe: any failure (no network, rate limit,
missing tag, unexpected response) returns None so callers degrade
gracefully.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo
|
str
|
GitHub "owner/name", e.g. |
required |
version
|
str
|
Package version, e.g. |
required |
timeout
|
int
|
Per-request timeout in seconds. |
3
|
Returns:
| Type | Description |
|---|---|
Optional[str]
|
The full commit SHA the tag points to, or |
Source code in sleap/system_info.py
run_command(cmd, timeout=5)
¶
Run a command and return (returncode, stdout, stderr).
Source code in sleap/system_info.py
short_sha(sha)
¶
Shorten a git commit SHA for display.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sha
|
Optional[str]
|
Full or short commit SHA, or None. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The first |