runway.module.base module
Base classes for runway modules.
- class runway.module.base.RunwayModule[source]
Bases:
object
Base class for Runway modules.
- __init__(context: RunwayContext, *, explicitly_enabled: Optional[bool] = False, logger: RunwayLogger = <RunwayLogger runway.module.base (WARNING)>, module_root: Path, name: Optional[str] = None, options: Optional[Union[Dict[str, Any], ModuleOptions]] = None, parameters: Optional[Dict[str, Any]] = None, **_: Any) None [source]
Instantiate class.
- Parameters
context – Runway context object for the current session.
explicitly_enabled – Whether or not the module is explicitly enabled. This is can be set in the event that the current environment being deployed to matches the defined environments of the module/deployment.
logger – Used to write logs.
module_root – Root path of the module.
name – Name of the module.
options – Options passed to the module class from the config as
options
ormodule_options
if coming from the deployment level.parameters – Values to pass to the underlying infrastructure as code tool that will alter the resulting infrastructure being deployed. Used to templatize IaC.
- __getitem__(key: str) Any [source]
Make the object subscriptable.
- Parameters
key – Attribute to get.
- __new__(**kwargs)
- class runway.module.base.RunwayModuleNpm[source]
Bases:
runway.module.base.RunwayModule
Base class for Runway modules that use npm.
- __init__(context: RunwayContext, *, explicitly_enabled: Optional[bool] = False, logger: RunwayLogger = <RunwayLogger runway.module.base (WARNING)>, module_root: Path, name: Optional[str] = None, options: Optional[Union[Dict[str, Any], ModuleOptions]] = None, parameters: Optional[Dict[str, Any]] = None, **_: Any) None [source]
Instantiate class.
- Parameters
context – Runway context object for the current session.
explicitly_enabled – Whether or not the module is explicitly enabled. This is can be set in the event that the current environment being deployed to matches the defined environments of the module/deployment.
logger – Used to write logs.
module_root – Root path of the module.
name – Name of the module.
options – Options passed to the module class from the config as
options
ormodule_options
if coming from the deployment level.parameters – Values to pass to the underlying infrastructure as code tool that will alter the resulting infrastructure being deployed. Used to templatize IaC.
- log_npm_command(command: List[str]) None [source]
Log an npm command that is going to be run.
- Parameters
command – List that will be passed into a subprocess.
- __new__(**kwargs)
- package_json_missing() bool [source]
Check for the existence for a package.json file in the module.
- Returns
True if the file was not found.
- Return type
- static check_for_npm(*, logger: Union[logging.Logger, PrefixAdaptor, RunwayLogger] = <RunwayLogger runway.module.base (WARNING)>) None [source]
Ensure npm is installed and in the current path.
- Parameters
logger – Optionally provide a custom logger to use.
- static warn_on_boto_env_vars(env_vars: Dict[str, str], *, logger: Union[logging.Logger, PrefixAdaptor, RunwayLogger] = <RunwayLogger runway.module.base (WARNING)>) None [source]
Inform user if boto-specific environment variables are in use.
- Parameters
env_vars – Environment variables to check.
logger – Optionally provide a custom logger to use.