runway.module.base module

Base classes for runway modules.

class runway.module.base.RunwayModule(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)[source]

Bases: object

Base class for Runway modules.

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 or module_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.

deploy()None[source]

Abstract method called when running deploy.

destroy()None[source]

Abstract method called when running destroy.

plan()None[source]

Abstract method called when running plan.

__getitem__(key: str)typing.Any[source]

Make the object subscriptable.

Parameters

key – Attribute to get.

class runway.module.base.RunwayModuleNpm(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)[source]

Bases: runway.module.base.RunwayModule

Base class for Runway modules that use npm.

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 or module_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.

npm_install()None[source]

Run npm install.

__getitem__(key: str)typing.Any

Make the object subscriptable.

Parameters

key – Attribute to get.

deploy()None

Abstract method called when running deploy.

destroy()None

Abstract method called when running destroy.

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

bool

plan()None

Abstract method called when running plan.

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.

class runway.module.base.ModuleOptions[source]

Bases: object

Base class for Runway module options.

get(name: str, default: Optional[typing.Any] = None)typing.Any[source]

Get a value or return the default.

__eq__(other: typing.Any)bool[source]

Assess equality.