packflow.loaders package
Submodules
packflow.loaders.base module
- class packflow.loaders.base.InferenceBackendLoader(path)[source]
Bases:
ABC- classmethod from_project(project_path='.', **backend_kwargs)[source]
Load an InferenceBackend from a Packflow directory/packflow.yaml.
- Return type:
- load(**backend_kwargs)[source]
Load the inference backend.
- Parameters:
**backend_kwargs – Optional Keyword arguments to pass to the backend if the provided path leads to a non-instantiated class.
- Returns:
An instantiated InferenceBackend that is ready to produce inferences.
- Return type:
- abstract load_backend_module()[source]
Load the backend module from its source. This method should not handle instantiation or error handling, as it is wrapped with error handling and general validation checks at runtime.
- Return type:
Notes
The base class handles determining if the loaded object is already instantiated and validation checks for if the loaded object is not in fact an InferenceBackend object. This method should focus solely on loading the object from its source.
packflow.loaders.config module
- pydantic model packflow.loaders.config.PackflowConfig[source]
Bases:
BaseModelShow JSON schema
{ "title": "PackflowConfig", "type": "object", "properties": { "name": { "pattern": "^[A-Za-z_]+$", "title": "Name", "type": "string" }, "version": { "default": "", "title": "Version", "type": "string" }, "description": { "default": "", "title": "Description", "type": "string" }, "maintainers": { "default": [], "items": { "type": "string" }, "title": "Maintainers", "type": "array" }, "inference_backend": { "default": "inference:Backend", "pattern": "^[^:]+:[^:]+$", "title": "Inference Backend", "type": "string" }, "loader": { "default": "local", "enum": [ "local", "module" ], "title": "Loader", "type": "string" }, "python_version": { "default": "3.11.14", "title": "Python Version", "type": "string" } }, "additionalProperties": true, "required": [ "name" ] }
- Config:
extra: str = allow
- Fields:
-
field description:
str= ''
-
field inference_backend:
Annotated[str] = 'inference:Backend' - Constraints:
pattern = ^[^:]+:[^:]+$
-
field loader:
Literal['local','module'] = 'local'
-
field maintainers:
list[str] = []
-
field name:
Annotated[str] [Required] - Constraints:
pattern = ^[A-Za-z_]+$
func = <function normalize_name at 0x11d380540>
json_schema_input_type = PydanticUndefined
-
field python_version:
str= '3.11.14'
-
field version:
str= ''
- packflow.loaders.config.get_python_version()[source]
Extract semantic version of the current process’ python
packflow.loaders.local module
- class packflow.loaders.local.LocalLoader(path)[source]
Bases:
InferenceBackendLoader- load_backend_module(**backend_kwargs)[source]
Load the backend module from its source. This method should not handle instantiation or error handling, as it is wrapped with error handling and general validation checks at runtime.
- Return type:
Notes
The base class handles determining if the loaded object is already instantiated and validation checks for if the loaded object is not in fact an InferenceBackend object. This method should focus solely on loading the object from its source.
packflow.loaders.module module
- class packflow.loaders.module.ModuleLoader(path)[source]
Bases:
InferenceBackendLoader
packflow.loaders.utils module
- packflow.loaders.utils.inference_backend_parts(path)[source]
Utility for splitting the inference_backend to the module and object parts
- Parameters:
path (str) – The path to the backend to load. Notation should follow ‘module.submodule:object’
- Returns:
Parts the first will be the path to the module and the second will be the object within the module that will be loaded.
- Return type:
list[str]
Example
- ‘foo.bar:baz’ would return [‘foo.bar’, ‘baz’] and can be interpreted as:
from foo.bar import baz