context

Utilities for loading contexts from multiple types of sources including json files, python files, pickle files either as files on disk, or as packaged resources contained within installed python packages.

render_static.context.resolve_context(context)[source]

Resolve the context specifier into a context dictionary. Context specifier may be a packaged resource, a path-like object or a string path to a json file, a pickled dictionary or a python file on disk. The context specifier may itself be a dictionary context.

Note

Render static should never be part of operational execution flows, so its ok if it takes a little extra time to resolve things for convenience.

Parameters:

context (Dict | str | Path | Callable | ModuleType | None) – The context specifier

Returns:

The dictionary context the specifier resolved to

Raises:

InvalidContext – if there is a failure to produce a dictionary from the context specifier

Return type:

Dict