stanbkt.utils.compile_stan_model#
- stanbkt.utils.compile_stan_model(stan_file, cpp_options=None, stanc_options=None, print_fn=None)#
Compile or reuse a cached Stan executable and return a CmdStan model.
- Parameters:
- Returns:
Model instance backed by a cached compiled executable.
- Return type:
- Raises:
RuntimeError – If CmdStanPy finishes compilation without reporting an executable path.
Notes
Compilation is performed inside a temporary directory so the exe is never written into the installed package tree (e.g. site-packages inside a venv). Only the compiled executable is stored in the platform cache directory; Stan source files are not cached.
CmdStanPy mutates the
stanc_options/cpp_optionsdicts it receives (addinginclude-pathsbased on the Stan file location). This function always passes shallow copies so the caller’s dicts are never modified.