ersilia.tools.bentoml.configuration package¶
Submodules¶
ersilia.tools.bentoml.configuration.configparser module¶
- class ersilia.tools.bentoml.configuration.configparser.BentoMLConfigParser(default_config: str, *args, **kwargs)[source]¶
Bases:
ConfigParser
BentoML configuration parser.
- Parameters:
default_config (str) – Serve as default value when conf key not presented in environment var or user local config file.
- as_dict(display_source: bool = False) dict [source]¶
Convert the configuration to a dictionary.
- Parameters:
display_source (bool, optional) – If True, include the source of the configuration value (default is False).
- Returns:
The configuration as a dictionary.
- Return type:
dict
- get(section: str, key: str | None = None, **kwargs) str [source]¶
A simple hierarchical config access, priority order: 1. environment var 2. user config file 3. bentoml default config file
- Parameters:
section (str) – The section of the configuration.
key (str, optional) – The key within the section of the configuration. If not provided, the section is used as the key.
- Returns:
The value of the configuration.
- Return type:
str
- Raises:
BentoMLConfigException – If the section/key is not found in the configuration.
Module contents¶
- ersilia.tools.bentoml.configuration.expand_env_var(env_var)[source]¶
Expands potentially nested env var by repeatedly applying expandvars and expanduser until interpolation stops having any effect.
- ersilia.tools.bentoml.configuration.get_bentoml_deploy_version()[source]¶
BentoML version to use for generated docker image or serverless function bundle to be deployed, this can be changed to an url to your fork of BentoML on github, or an url to your custom BentoML build, for example:
bentoml_deploy_version = git+https://github.com/{username}/bentoml.git@{branch}
- ersilia.tools.bentoml.configuration.parameterized_config(template)[source]¶
Generates a configuration from the provided template + variables defined in current scope
:param : param template: a config content templated with {{variables}}
- Returns:
config content after templated with locals() and globals()
- Return type:
string