make#

statrl.experiments.utils.make(spec)[source]#

Instantiate an environment from a registry spec.

Imports the module named by the spec’s entrypoint from the file it sits next to and calls the class it names with the spec’s kwargs. Loading by file path rather than by import name is what lets a setting’s envs/ directory be a plain folder, with no package or installation.

Parameters:

spec (dict) – A registry entry as returned by load(), with keys entrypoint ("module:Class"), _base_dir, and optionally kwargs and displayname.

Returns:

The constructed environment, carrying a displayname attribute — the spec’s if given, otherwise its name. That value becomes the title of the regret figures.

Return type:

object

Raises:

ImportError – If the module named by the entrypoint cannot be loaded.

See also

load

Reads the registry this spec comes from.