:py:mod:`httpstan.models` ========================= .. py:module:: httpstan.models .. autoapi-nested-parse:: Compile a Stan model extension module given code written in Stan. These functions manage the process of compiling a Python extension module from C++ code generated and loading the resulting module. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: httpstan.models.calculate_model_name httpstan.models.import_services_extension_module httpstan.models.build_services_extension_module Attributes ~~~~~~~~~~ .. autoapisummary:: httpstan.models.PACKAGE_DIR httpstan.models.logger .. py:data:: PACKAGE_DIR .. py:data:: logger .. py:function:: calculate_model_name(program_code: str) -> str Calculate model name from Stan program code. Names look like this: ``models/2uxewutp``. Name uses a hash of the concatenation of the following: - UTF-8 encoded Stan program code - UTF-8 encoded string recording the httpstan version - UTF-8 encoded string identifying the system platform - UTF-8 encoded string identifying the system bit architecture - UTF-8 encoded string identifying the Python version - UTF-8 encoded string identifying the Python executable :param program_code: Stan program code. :returns: model name :rtype: str .. py:function:: import_services_extension_module(model_name: str) -> types.ModuleType Load an existing model-specific stan::services extension module. :param model_name: :returns: loaded module handle. :rtype: module :raises KeyError: Model not found. .. py:function:: build_services_extension_module(program_code: str, extra_compile_args: Optional[List[str]] = None) -> str :async: Compile a model-specific stan::services extension module. Since compiling an extension module takes a long time, compilation takes place in a different thread. Messages generated by the compiler—normally sent to stderr—are collected and saved. These messages are returned by the function. Returns compiler messages. This is a coroutine function. IMPORTANT NOTE: This function builds the extension module in the cache directory, making it available for later `import`ing. This "side-effect" is why there are no functions called `load_services_extension_module` and `dump_services_extension_module`.