mlrun.package

mlrun.package#

The mlrun.package module provides MLRun's packagers system — classes that automatically serialize and deserialize Python objects moving in and out of MLRun functions. Your function code stays pure Python; type hints and log hints are all that's needed.

Packagers perform two tasks:

  1. Parsing inputs — cast inputs values to the type-hinted Python type (e.g. pd.DataFrame, dict, np.ndarray).

  2. Logging outputs — serialize returned objects and log them as artifacts or results based on the provided log hints (returns).

For a full introduction — including usage patterns, log hints, configuration, and built-in packagers — see Packagers. To create a custom packager, see Creating custom packagers.

log_hint.LogHint(*, key[, tag, itemized, ...])

A log hint is a configuration to log an object returned from an MLRun function.

packager.Packager()

The abstract base class for a packager.

packagers.default_packager.DefaultPackager()

A default packager that handles all types and packs them as pickle files.

packagers_manager.PackagersManager([...])

A packager manager holds the project's packagers and sends them objects to pack, and data items to unpack.

Built-in packager modules

MLRun includes the following built-in packager modules. All built-in packagers subclass DefaultPackager and are registered automatically at the start of each run.