ersilia.hub.bundle package¶
Submodules¶
ersilia.hub.bundle.bundle module¶
- class ersilia.hub.bundle.bundle.BundleDockerfileFile(model_id, config_json=None)[source]¶
Bases:
ErsiliaBase
Class to handle the Dockerfile for a model bundle.
It specifically provides methods to get the path to the Dockerfile, get the BentoML version required for the model, and more.
- Parameters:
model_id (str) – The ID of the model.
config_json (dict, optional) – Configuration settings in JSON format.
- get_bentoml_version() dict [source]¶
Get the BentoML version required for the model.
- Returns:
A dictionary containing the BentoML version, slim flag, and Python version.
- Return type:
dict
- class ersilia.hub.bundle.bundle.BundleEnvironmentFile(model_id, config_json=None)[source]¶
Bases:
ErsiliaBase
Class to handle the environment file for a model bundle.
Specifically provides methods to get the path, bundle Conda requirement, add model installation commands of environment file, and check if the environment file exists.
- Parameters:
model_id (str) – The ID of the model.
config_json (dict, optional) – Configuration settings in JSON format.
- class ersilia.hub.bundle.bundle.BundleRequirementsFile(model_id, config_json=None)[source]¶
Bases:
ErsiliaBase
Class to handle the requirements file for a model bundle.
Specifically provides methods to add model installation commands to the requirements file and check if the requirements file exists.
- Parameters:
model_id (str) – The ID of the model.
config_json (dict, optional) – Configuration settings in JSON format.
ersilia.hub.bundle.repo module¶
- class ersilia.hub.bundle.repo.DockerfileFile(path)[source]¶
Bases:
object
Class to handle Dockerfile operations for models.
This class provides methods to get the path to the Dockerfile, get the BentoML version required for the model, check if the Dockerfile contains RUN commands, check if the Dockerfile requires Conda, get installation commands, and more.
- Parameters:
path (str) – The directory path where the Dockerfile is located.
- append_run_command(cmd: str)[source]¶
Append a RUN command to the Dockerfile.
- Parameters:
cmd (str) – The RUN command to append.
- check() bool [source]¶
Check if the Dockerfile exists.
- Returns:
True if the Dockerfile exists, False otherwise.
- Return type:
bool
- get_bentoml_version() dict [source]¶
Get the BentoML version required for the model.
- Returns:
A dictionary containing the BentoML version, slim flag, and Python version.
- Return type:
dict
- get_file() str [source]¶
Get the path to the Dockerfile.
- Returns:
The path to the Dockerfile.
- Return type:
str
- get_install_commands() dict [source]¶
Get the installation commands from the Dockerfile.
- Returns:
A dictionary containing Conda requirement, commands, and exclusive Conda and pip flag.
- Return type:
dict
- get_install_commands_from_dockerfile(fn)[source]¶
Get the install commands from the Dockerfile.
- Parameters:
fn (str) – The path to the Dockerfile.
- Returns:
The list of RUN commands from the Dockerfile.
- Return type:
list
- class ersilia.hub.bundle.repo.Integrity(path)[source]¶
Bases:
object
Class to check the integrity of the model files.
It provides methods to check if the README file, service file, and pack file exist.
- Parameters:
path (str) – The directory path where the model files are located.
- has_pack() bool [source]¶
Check if the pack file exists.
- Returns:
True if the pack file exists, False otherwise.
- Return type:
bool
- class ersilia.hub.bundle.repo.PackFile(path)[source]¶
Bases:
object
Class to handle pack file operations.
This class provides methods to get the path to the pack file, check if the pack file needs a model, and check if the pack file exists.
- Parameters:
path (str) – The directory path where the pack file is located.
- class ersilia.hub.bundle.repo.ReadmeFile(path)[source]¶
Bases:
object
Class to handle README file operations.
- Parameters:
path (str) – The directory path where the README file is located.
- class ersilia.hub.bundle.repo.RepoUtils(path, config_json=None)[source]¶
Bases:
ErsiliaBase
Utility class for handling repository operations.
It provides methods to get the model ID, get the path to the Conda environment YAML file, get the Docker repository image, and rename the BentoML service.
- Parameters:
path (str) – The directory path where the repository is located.
config_json (dict, optional) – Configuration settings in JSON format.
- get_conda_env_yml_file() str [source]¶
Get the path to the Conda environment YAML file.
- Returns:
The path to the Conda environment YAML file.
- Return type:
str
- get_docker_repo_image(model_id: str) str [source]¶
Get the Docker repository image for the model.
- Parameters:
model_id (str) – The ID of the model.
- Returns:
The Docker repository image for the model.
- Return type:
str
- class ersilia.hub.bundle.repo.ServiceFile(path)[source]¶
Bases:
object
Class to handle service file operations for BentoML web apps.
This class provides methods to get the path to the service file, rename the service, add an info API, and check if the service file contains the Service class.
- Parameters:
path (str) – The directory path where the service file is located.
- add_info_api(information_file: str)[source]¶
Add an info API to the service.
- Parameters:
information_file (str) – The path to the information file to be used by the info API.
- check() bool [source]¶
Check if the service file contains the Service class.
- Returns:
True if the service file contains the Service class, False otherwise.
- Return type:
bool
ersilia.hub.bundle.status module¶
- class ersilia.hub.bundle.status.ModelStatus(config_json=None)[source]¶
Bases:
ErsiliaBase
Class to check the status of a model in terms of its installation and deployment.
It specifically provides methods to check if a model is downloaded, available as a Docker image, pulled from Docker Hub, available in a Conda environment, available as a pip package, available as a bundle, or available as a BentoML service.
- Parameters:
config_json (dict, optional) – Configuration settings in JSON format.
- is_bentoml(model_id: str) bool [source]¶
Check if the model is available as a BentoML service.
- Parameters:
model_id (str) – The ID of the model.
- Returns:
True if the model is available as a BentoML service, False otherwise.
- Return type:
bool
- is_bundle(model_id: str) bool [source]¶
Check if the model is available as a bundle.
- Parameters:
model_id (str) – The ID of the model.
- Returns:
True if the model is available as a bundle, False otherwise.
- Return type:
bool
- is_conda(model_id: str) bool [source]¶
Check if the model is available in a Conda environment.
- Parameters:
model_id (str) – The ID of the model.
- Returns:
True if the model is available in a Conda environment, False otherwise.
- Return type:
bool
- is_docker(model_id: str) bool [source]¶
Check if the model is available as a Docker image.
- Parameters:
model_id (str) – The ID of the model.
- Returns:
True if the model is available as a Docker image, False otherwise.
- Return type:
bool
- is_downloaded(model_id: str) bool [source]¶
Check if the model is downloaded.
- Parameters:
model_id (str) – The ID of the model.
- Returns:
True if the model is downloaded, False otherwise.
- Return type:
bool
- is_pip(model_id: str) bool [source]¶
Check if the model is available as a pip package.
- Parameters:
model_id (str) – The ID of the model.
- Returns:
True if the model is available as a pip package, False otherwise.
- Return type:
bool