rcmpy.environment package — docs

Skip to main content
`Ctrl`+`K`

# rcmpy.environment package

## Submodules

## rcmpy.environment.base module

A module implementing a basic environment interface.

class rcmpy.environment.base.BaseEnvironment(state: State, stack: ExitStack)

  Bases: `LoggerMixin`

  A class implementing this package’s base runtime environment.

  property config: Config

    Get this environment’s configuration object.

  property config_loaded: bool

    Determine if this environment has loaded a config.

rcmpy.environment.base.load_if_single_candidate(path: Path | str | None, logger: Logger | LoggerAdapter[Any] = None) → LoadResult | None

  Attempt to load a configuration file if a candidate exists at the given path.

rcmpy.environment.base.load_manifest(root: Path, variant: str, logger: Logger | LoggerAdapter[Any]) → LoadResult | None

  Load the top-level data repository configuration.

## rcmpy.environment.data module

A module for exposing useful information from the current system to templates.

rcmpy.environment.data.system_data() → Dict[str, Any]

  Obtain useful system configuration data.

## rcmpy.environment.template module

An environment extension for working with template files.

class rcmpy.environment.template.EnvTemplate(name: str, path: Path, subdir: str, template: Template | None = None)

  Bases: `NamedTuple`

  A data structure for keeping track of environment templates. If ‘template’ is None, it signals that the template does not require rendering.

  name: str

    Alias for field number 0

  path: Path

    Alias for field number 1

  subdir: str

    Alias for field number 2

  template: Template | None

    Alias for field number 3

class rcmpy.environment.template.TemplateEnvironment(state: State, stack: ExitStack)

  Bases: `BaseEnvironment`

  A class implementing template management for this package’s runtime environment.

  is_updated(file: ManagedFile) → bool

    Determine if a managed file is updated or not (based on template changes).

  jinja: Environment
  templates: Dict[Path, EnvTemplate]
  templates_by_name: Dict[str, EnvTemplate]

rcmpy.environment.template.template_name(name: str) → Tuple[bool, str]

  Determine if a name is a template and remove the template suffix if applicable.

## Module contents

A module implementing the package’s runtime environment.

class rcmpy.environment.Environment(state: State, stack: ExitStack)

  Bases: `TemplateEnvironment`

  A class implementing this package’s runtime environment.

rcmpy.environment.load_environment(root: Path | str | None = None, name: str = 'state.json') → Iterator[Environment]

  A wrapper for loading an environment with default state data.