Skip to content

API Reference

metaxy

The top-level metaxy module provides the main public API for Metaxy.

Initialization

init_metaxy

init_metaxy(config_file: Path | None = None, search_parents: bool = True) -> MetaxyConfig

Main user-facing initialization function for Metaxy. It loads the configuration and features.

Features are discovered from installed Python packages metadata.

Parameters:

  • config_file (Path | None, default: None ) –

    Path to the configuration file. Defaults to None.

  • search_parents (bool, default: True ) –

    Whether to search parent directories for configuration files. Defaults to True.

Returns:

  • MetaxyConfig ( MetaxyConfig ) –

    The initialized Metaxy configuration.

Source code in src/metaxy/__init__.py
def init_metaxy(
    config_file: Path | None = None, search_parents: bool = True
) -> MetaxyConfig:
    """Main user-facing initialization function for Metaxy. It loads the configuration and features.

    Features are [discovered](../../learn/feature-discovery.md) from installed Python packages metadata.

    Args:
        config_file (Path | None, optional): Path to the configuration file. Defaults to None.
        search_parents (bool, optional): Whether to search parent directories for configuration files. Defaults to True.

    Returns:
        MetaxyConfig: The initialized Metaxy configuration.
    """
    cfg = MetaxyConfig.load(
        config_file=config_file,
        search_parents=search_parents,
    )
    load_features(cfg.entrypoints)
    return cfg

Metadata Stores

Metaxy abstracts interactions with metadata through the MetadaStore interface.

Dependency Specification

Metaxy has a declarative feature specification system that allows users to express dependencies between their features and their versioned fields.