_platform
System and environment detection. All functions are pure. No side effects, no R environment mutation.
Attributes¶
ENCODING_LOCALE = locale.getpreferredencoding()
module-attribute
¶
PREBUILT_FINGERPRINTS = set()
module-attribute
¶
Classes¶
SystemInfo
dataclass
¶
Immutable snapshot of the system environment relevant to runtime selection.
Attributes:
| Name | Type | Description |
|---|---|---|
os |
str
|
Operating system identifier (for example |
arch |
str
|
CPU architecture (for example |
r_version |
tuple[int, int, int] or None
|
Detected R version as |
fingerprint |
str
|
Fingerprint used for runtime lookup and caching (for example |
glibc_version |
tuple[int, int] or None
|
Linux-only: glibc major/minor version used for compatibility checks. |
clang_version |
tuple[int, int] or None
|
macOS-only: clang major/minor version. |
gxx_version |
tuple[int, int] or None
|
C++ compiler major/minor version if detected. |
has_rtools |
bool
|
Windows-only: whether Rtools is available. |
Source code in brmspy/types/runtime.py
Attributes¶
os
instance-attribute
¶
arch
instance-attribute
¶
r_version
instance-attribute
¶
fingerprint
instance-attribute
¶
glibc_version
instance-attribute
¶
clang_version
instance-attribute
¶
gxx_version
instance-attribute
¶
has_rtools
instance-attribute
¶
Functions¶
__init__(os, arch, r_version, fingerprint, glibc_version, clang_version, gxx_version, has_rtools)
¶
Functions¶
log_error(msg, method_name=None)
¶
Log an error message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
msg
|
str
|
The error message to log |
required |
method_name
|
str
|
The name of the method/function. If None, will auto-detect from call stack. |
None
|
Source code in brmspy/helpers/log.py
log_warning(msg, method_name=None)
¶
Log a warning message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
msg
|
str
|
The warning message to log |
required |
method_name
|
str
|
The name of the method/function. If None, will auto-detect from call stack. |
None
|
Source code in brmspy/helpers/log.py
get_os()
¶
Returns 'linux', 'macos', or 'windows'.
get_arch()
¶
Returns 'x86_64' or 'arm64'.
_resolve_r_binary()
¶
Return path to R binary, preferring R_HOME if set.
Source code in brmspy/_runtime/_platform.py
r_version_from_subprocess()
¶
Source code in brmspy/_runtime/_platform.py
get_r_version()
¶
Returns R version tuple or None if R not available.
Source code in brmspy/_runtime/_platform.py
system_fingerprint()
¶
Returns '{os}-{arch}-r{major}.{minor}' string.
Source code in brmspy/_runtime/_platform.py
get_glibc_version()
¶
Linux only. Parse from ldd --version.
Source code in brmspy/_runtime/_platform.py
get_clang_version()
¶
macOS only. Parse from clang --version.
Source code in brmspy/_runtime/_platform.py
get_gxx_version(out=None)
¶
Parse from g++ --version.
Source code in brmspy/_runtime/_platform.py
get_system_info()
¶
Collect all system info into immutable dataclass.
Source code in brmspy/_runtime/_platform.py
is_platform_supported()
¶
True if OS/arch combination is supported.
Source code in brmspy/_runtime/_platform.py
is_r_available()
¶
is_r_supported(min_version=(4, 0))
¶
True if R version meets minimum.
Source code in brmspy/_runtime/_platform.py
is_linux_toolchain_ok()
¶
True if glibc >= 2.27 and g++ >= 9.
Source code in brmspy/_runtime/_platform.py
is_macos_toolchain_ok()
¶
True if Xcode CLT installed and clang >= 11.
Source code in brmspy/_runtime/_platform.py
is_windows_toolchain_ok()
¶
True if Rtools with g++ >= 9.
Source code in brmspy/_runtime/_platform.py
is_toolchain_compatible()
¶
Route to OS-specific check.
Source code in brmspy/_runtime/_platform.py
can_use_prebuilt()
¶
Master check: platform + R + toolchain.
is_prebuilt_available(fingerprint)
¶
True if we publish prebuilt for this fingerprint.
Source code in brmspy/_runtime/_platform.py
get_compatibility_issues()
¶
Return list of human-readable compatibility issues.
Source code in brmspy/_runtime/_platform.py
require_platform_supported()
¶
Raise RuntimeError with actionable message if unsupported.
Source code in brmspy/_runtime/_platform.py
require_r_available(min_version=(4, 0))
¶
Raise RuntimeError if R missing or too old.
Source code in brmspy/_runtime/_platform.py
require_toolchain_compatible()
¶
Raise RuntimeError with install instructions if toolchain insufficient.
Source code in brmspy/_runtime/_platform.py
require_prebuilt_compatible()
¶
Raise RuntimeError if system can't use prebuilt runtimes.