gws.config.parser

Configuration parser.

Convert configuration files (in different formats) or row config dicts into gws.Config objects by validating them against the specs.

Source code: gws.config.parser

Module Contents

gws.config.parser.CONFIG_PATH_PATTERN = '\\.(py|json|yaml|cx)$'
gws.config.parser.parse_app_dict(dct: dict | gws.Data, path: str, ctx: gws.ConfigContext) gws.Config | None

Parse application configuration given as python dict.

Parameters:
  • dct – Dictionary containing the application configuration.

  • path – Path to the configuration file (for error reporting).

  • ctx – Configuration context.

gws.config.parser.parse_app_from_path(path: str, ctx: gws.ConfigContext) gws.Config | None

Parse application configuration from a path.

Parameters:
  • path – Path to the application configuration file.

  • ctx – Configuration context.

gws.config.parser.parse_dict(dct: dict | gws.Data, path: str, as_type: str, ctx: gws.ConfigContext) gws.Config | None

Parse a configuration given as python dict.

Parameters:
  • dct – Dictionary containing the configuration.

  • path – Path to the configuration file (for error reporting).

  • as_type – Type of the configuration.

  • ctx – Configuration context.

gws.config.parser.parse_from_path(path: str, as_type: str, ctx: gws.ConfigContext) gws.Config | None

Parse a configuration from a path.

Parameters:
  • path – Path to the configuration file.

  • as_type – Type of the configuration (e.g., ‘gws.base.application.core.Config’).

  • ctx – Configuration context.

gws.config.parser.read_from_path(path: str, ctx: gws.ConfigContext) dict | None

Read a configuration file from a path, parse config formats.

Parameters:
  • path – Path to the configuration file.

  • ctx – Configuration context.