runway.module.base module¶
Base classes for runway modules.
- class runway.module.base.RunwayModule[source]¶
Bases:
Generic
[_ModuleOptionsTypeVar
]Base class for Runway modules.
- __getitem__(key: str) Any [source]¶
Make the object subscriptable.
- Parameters:
key – Attribute to get.
- __init__(context: RunwayContext, *, explicitly_enabled: bool | None = False, logger: RunwayLogger = <RunwayLogger runway.module.base (WARNING)>, module_root: Path, name: str | None = None, options: _ModuleOptionsTypeVar | None = None, parameters: dict[str, Any] | None = 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.
- class runway.module.base.RunwayModuleNpm[source]¶
Bases:
RunwayModule
[_ModuleOptionsTypeVar
]Base class for Runway modules that use npm.
- __init__(context: RunwayContext, *, explicitly_enabled: bool | None = False, logger: RunwayLogger = <RunwayLogger runway.module.base (WARNING)>, module_root: Path, name: str | None = None, options: _ModuleOptionsTypeVar | None = None, parameters: dict[str, Any] | None = 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.
- static check_for_npm(*, logger: 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.
- 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.
- 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 warn_on_boto_env_vars(env_vars: dict[str, str], *, logger: 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.