_state
All singletons in one place: R packages and stored environment. This is the ONLY module with global mutable state.
Attributes¶
_brms = None
module-attribute
¶
_cmdstanr = None
module-attribute
¶
_rstan = None
module-attribute
¶
_base = None
module-attribute
¶
_posterior = None
module-attribute
¶
_stored_env = None
module-attribute
¶
Classes¶
StoredEnv
dataclass
¶
Captured R environment used for deactivation/restoration.
Attributes:
| Name | Type | Description |
|---|---|---|
lib_paths |
list[str]
|
|
cmdstan_path |
str or None
|
CmdStan path captured before activation. |
Source code in brmspy/types/runtime.py
Functions¶
get_brms()
¶
Get brms R package, importing on first access.
Source code in brmspy/_runtime/_state.py
get_cmdstanr()
¶
Get cmdstanr R package or None if not available.
Source code in brmspy/_runtime/_state.py
get_rstan()
¶
Get rstan R package or None if not available.
get_base()
¶
get_posterior()
¶
invalidate_packages()
¶
Clear all cached package singletons.
capture_current_env()
¶
Capture current R environment (lib_paths, cmdstan_path).
store_env(env)
¶
Store environment for later restoration.