nentConfig class here.

Base Abstraction 3: Flavorfrom zenml.enums import StackComponentType

from zenml.stack import Flavor

class LocalArtifactStore(BaseArtifactStore):

...

class LocalArtifactStoreConfig(BaseArtifactStoreConfig):

...

class LocalArtifactStoreFlavor(Flavor):

@property

def name(self) -> str:

"""Returns the name of the flavor."""

return "local"

@property

def type(self) -> StackComponentType:

"""Returns the flavor type."""

return StackComponentType.ARTIFACT_STORE

@property

def config_class(self) -> Type[LocalArtifactStoreConfig]:

"""Config class of this flavor."""

return LocalArtifactStoreConfig

@property

def implementation_class(self) -> Type[LocalArtifactStore]:

"""Implementation class of this flavor."""

return LocalArtifactStore

See the full code of the base Flavor class definition here.

Implementing a Custom Stack Component Flavor

Let's recap what we just learned by reimplementing the S3ArtifactStore from the aws integration as a custom flavor.

We can start with the configuration class: here we need to define the SUPPORTED_SCHEMES class variable introduced by the BaseArtifactStore. We also define several additional configuration values that users can use to configure how the artifact store will authenticate with AWS:

from zenml.artifact_stores import BaseArtifactStoreConfig

from zenml.utils.secret_utils import SecretField

class MyS3ArtifactStoreConfig(BaseArtifactStoreConfig):

"""Configuration for the S3 Artifact Store."""

SUPPORTED_SCHEMES: ClassVar[Set[str]] = {"s3://"}

key: Optional[str] = SecretField(default=None)

secret: Optional[str] = SecretField(default=None)

token: Optional[str] = SecretField(default=None)

client_kwargs: Optional[Dict[str, Any]] = None

config_kwargs: Optional[Dict[str, Any]] = None

s3_additional_kwargs: Optional[Dict[str, Any]] = None

You can pass sensitive configuration values as secrets by defining them as type SecretField in the configuration class.