Skip to content

Module coyaml

coyaml: Package for managing YAML configuration

This package provides classes for working with configurations: - YConfig: Class for working with configuration, supporting various data sources. - YConfigFactory: Factory for creating and managing configuration singletons using optional keys.

Usage example

from coyaml import YConfig, YConfigFactory

Create configuration and load data from files

config = YConfig() config.add_yaml_source('config.yaml') config.add_env_source('.env')

Set configuration in factory

YConfigFactory.set_config(config)

Get configuration from factory

config = YConfigFactory.get_config() print(config.get('some_key'))

coyaml(_func=None, *, mask=None, unique=True)

coyaml(func: Callable[P, R]) -> Callable[..., R]
coyaml(*, mask: str | list[str] | None = ..., unique: bool = ...) -> Callable[[Callable[P, R]], Callable[..., R]]

Public shim for the internal decorator to make docs and typing happy.

Source code in coyaml/__init__.py
51
52
53
def coyaml(_func=None, *, mask: str | list[str] | None = None, unique: bool = True):  # type: ignore
    """Public shim for the internal decorator to make docs and typing happy."""
    return _inject.coyaml(_func, mask=mask, unique=unique)