spacr.version¶
The installed spaCR version, and the environment report built from it.
Resolves the version from installed package metadata rather than a hard-coded string, so a source checkout and an installed wheel agree.
Copyright © 2025 olafsson lab
Functions¶
|
Resolve |
|
Return a human-readable multi-line summary of the current environment. |
|
Return the installed PyTorch version, or |
|
Return the installed spacr package version, or |
|
Return a dict of spacr, platform, Python, and torch version strings. |
Module Contents¶
- spacr.version.__getattr__(name: str)[source]¶
Resolve
version_strlazily (PEP 562).- Parameters:
name – Module attribute requested by Python’s fallback lookup.
- Returns:
The formatted environment report for
version_str.- Raises:
AttributeError – If
nameis notversion_str.
format_version_info()callsget_torch_version(), which imports torch — roughly 0.94 s. Evaluating it at module scope meant everyimport spacrpaid for torch whether or not anything needed it, which defeated the point of light entry points likespacr.validate, whose whole value is answering in about a second before a run starts.from spacr.version import version_strstill works unchanged; the cost is now paid only by the caller that actually asks for it.
- spacr.version.format_version_info() str[source]¶
Return a human-readable multi-line summary of the current environment.
- Returns:
Tab-aligned version report suitable for CLI display.
- spacr.version.get_torch_version() str[source]¶
Return the installed PyTorch version, or
"not available"if torch is missing.- Returns:
torch.__version__when importable, otherwise a placeholder string.