Skip to content

Index

zocrates

__version__ module-attribute

__version__ = version('zocrates')

__getattr__

__getattr__(name)

Lazily resolve module-level attributes to avoid circular imports at startup.

Parameters:

Name Type Description Default
name str

The attribute name being accessed on this module.

required

Returns:

Type Description
Any

The requested attribute value (currently only "app" is supported).

Raises:

Type Description
AttributeError

If name is not a recognised lazy attribute.

Source code in zocrates/__init__.py
def __getattr__(name: str) -> Any:
    """Lazily resolve module-level attributes to avoid circular imports at startup.

    Args:
        name: The attribute name being accessed on this module.

    Returns:
        The requested attribute value (currently only ``"app"`` is supported).

    Raises:
        AttributeError: If ``name`` is not a recognised lazy attribute.
    """
    if name == "app":
        from zocrates.agents.app import app

        return app
    raise AttributeError(f"module {__name__} has no attribute {name}")