Skip to main content

Flytekit OmegaConf Plugin

Flytekit python natively supports serialization of many data types for exchanging information between tasks. The Flytekit OmegaConf Plugin extends these by the DictConfig type from the OmegaConf package as well as related types that are being used by the hydra package for configuration management.

Task example

from dataclasses import dataclass
import flytekitplugins.omegaconf  # noqa F401
from flytekit import task, workflow
from omegaconf import DictConfig

@dataclass
class MySimpleConf:
    _target_: str = "lightning_module.MyEncoderModule"
    learning_rate: float = 0.0001

@task
def my_task(cfg: DictConfig) -> None:
    print(f"Doing things with {cfg.learning_rate=}")


@workflow
def pipeline(cfg: DictConfig) -> None:
    my_task(cfg=cfg)


if __name__ == "__main__":
    from omegaconf import OmegaConf

    cfg = OmegaConf.structured(MySimpleConf)
    pipeline(cfg=cfg)

Transformer configuration

The transformer can be set to one of three modes:

Dataclass - This mode should be used with a StructuredConfig and will reconstruct the config from the matching dataclass during deserialisation in order to make typing information from the dataclass and continued validation thereof available. This requires the dataclass definition to be available via python import in the Flyte execution environment in which objects are (de-)serialised.

DictConfig - This mode will deserialize the config into a DictConfig object. In particular, dataclasses are translated into DictConfig objects and only primitive types are being checked. The definition of underlying dataclasses for structured configs is only required during the initial serialization for this mode.

Auto - This mode will try to deserialize according to the Dataclass mode and fall back to the DictConfig mode if the dataclass definition is not available. This is the default mode.

You can set the transformer mode globally or for the current context only the following ways:

from flytekitplugins.omegaconf import set_transformer_mode, set_local_transformer_mode, OmegaConfTransformerMode

# Set the global transformer mode using the new function
set_transformer_mode(OmegaConfTransformerMode.DictConfig)

# You can also the mode for the current context only
with set_local_transformer_mode(OmegaConfTransformerMode.Dataclass):
    # This will use the Dataclass mode
    pass
Since the DictConfig is flattened and keys transformed into dot notation, the keys of the DictConfig must not contain
dots.

Metadata

Release files for flytekitplugins-omegaconf 1.16.29

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flytekitplugins-omegaconf 1.16.29
File Size Uploaded
flytekitplugins_omegaconf-1.16.29.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flytekitplugins-omegaconf 1.16.29
File Interpreter ABI Platform
flytekitplugins_omegaconf-1.16.29-py3-none-any.whl Python 3 none any Details

Total release size: 23.1 kB

Release files / flytekitplugins_omegaconf-1.16.29.tar.gz

Download URL flytekitplugins_omegaconf-1.16.29.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c21bb4de55fc3937fa3310dfa3e1e9494dde4f9481647732a5499af1c35563b1
BLAKE2b-256 checksum
How to use checksums
e4f607e514285df1ee1fee3a3063369a9d303298ab0d2fecadb34b1b0dac78af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / flytekitplugins_omegaconf-1.16.29-py3-none-any.whl

Download URL flytekitplugins_omegaconf-1.16.29-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6961ddb1a24d3083be0988f8ade8c13f1491b6887bd6b10c39263a29703bd229
BLAKE2b-256 checksum
How to use checksums
f044fadc02b660d236061ea4519b792efdee1b3859c8fc01e986e14d16730597
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

1.16.29 This release

2 release files

1.16.8

2 release files

1.16.7

2 release files

1.16.6

2 release files

1.16.5

2 release files

1.16.4

2 release files

1.16.3

2 release files

1.16.2

2 release files

1.16.1

2 release files

1.16.0

2 release files

1.15.4

2 release files

1.15.3

2 release files

1.15.2

2 release files

1.15.0

2 release files

1.14.9

2 release files

1.14.8

2 release files

1.14.7

2 release files

1.14.6

2 release files

1.14.5

2 release files

1.14.4

2 release files

1.14.3

2 release files

1.14.2

2 release files

1.14.1

2 release files

1.13.10

1 release file

1.13.9

2 release files

1.13.5

2 release files

1.13.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page