runway.core.components package¶
Core Runway components.
- class runway.core.components.DeployEnvironment[source]¶
Bases:
DelCachedPropMixin
Runway deploy environment.
- __init__(*, environ: dict[str, str] | None = None, explicit_name: str | None = None, ignore_git_branch: bool = False, root_dir: Path | None = None) None [source]¶
Instantiate class.
- Parameters:
environ – Environment variables.
explicit_name – Explicitly provide the deploy environment name.
ignore_git_branch – Ignore the git branch when determining the deploy environment name.
root_dir – Root directory of the project.
- property aws_credentials: EnvVarsAwsCredentialsTypeDef¶
Get AWS credentials from environment variables.
- copy() DeployEnvironment [source]¶
Copy the contents of this object into a new instance.
- Returns:
New instance with the same contents.
- Return type:
- property max_concurrent_cfngin_stacks: int¶
Max number of CFNgin stacks that can be deployed concurrently.
This property can be set by exporting
RUNWAY_MAX_CONCURRENT_CFNGIN_STACKS
. If no value is specified, the value will be constrained based on the underlying graph.- Returns:
Value from environment variable or
0
.
- property max_concurrent_modules: int¶
Max number of modules that can be deployed to concurrently.
This property can be set by exporting
RUNWAY_MAX_CONCURRENT_MODULES
. If no value is specified,min(61, os.cpu_count())
is used.On Windows, this must be equal to or lower than
61
.IMPORTANT: When using
parallel_regions
andchild_modules
together, please consider the nature of their relationship when manually setting this value. (parallel_regions * child_modules
)- Returns:
Value from environment variable or
min(61, os.cpu_count())
- property max_concurrent_regions: int¶
Max number of regions that can be deployed to concurrently.
This property can be set by exporting
RUNWAY_MAX_CONCURRENT_REGIONS
. If no value is specified,min(61, os.cpu_count())
is used.On Windows, this must be equal to or lower than
61
.IMPORTANT: When using
parallel_regions
andchild_modules
together, please consider the nature of their relationship when manually setting this value. (parallel_regions * child_modules
)- Returns:
Value from environment variable or
min(61, os.cpu_count())
- class runway.core.components.Deployment[source]¶
Bases:
object
Runway deployment.
- __getitem__(name: str) Any [source]¶
Make the object subscriptable.
- Parameters:
name – Attribute to get.
- __init__(context: RunwayContext, definition: RunwayDeploymentDefinition, future: RunwayFutureDefinitionModel | None = None, variables: RunwayVariablesDefinition | None = None) None [source]¶
Instantiate class.
- Parameters:
context – Runway context object.
definition – A single deployment definition.
future – Future functionality configuration.
variables – Runway variables.
- property assume_role_config: _AssumeRoleConfigTypeDef¶
Parse the definition to get assume role arguments.
- property env_vars_config: dict[str, str]¶
Parse the definition to get the correct env_vars configuration.
- plan() None [source]¶
Plan for the next deploy of the deployment.
High level method for running a deployment.
- run(action: RunwayActionTypeDef, region: str) None [source]¶
Run a single deployment in a single region.
Low level API access to run a deployment object.
- Parameters:
action – Action to run (deploy, destroy, plan, etc.)
region – AWS region to run in.
- classmethod run_list(action: RunwayActionTypeDef, context: RunwayContext, deployments: list[RunwayDeploymentDefinition], future: RunwayFutureDefinitionModel, variables: RunwayVariablesDefinition) None [source]¶
Run a list of deployments.
- Parameters:
action – Name of action to run.
context – Runway context.
deployments – List of deployments to run.
future – Future definition.
variables – Runway variables for lookup resolution.
- validate_account_credentials(context: RunwayContext | None = None) None [source]¶
Exit if requested deployment account doesn’t match credentials.
- Parameters:
context – Context object.
- Raises:
SystemExit – AWS Account associated with the current credentials did not match the defined criteria.
- class runway.core.components.Module[source]¶
Bases:
object
Runway module.
- __getitem__(key: str) Any [source]¶
Make the object subscriptable.
- Parameters:
key – Attribute to get.
- __init__(context: RunwayContext, definition: RunwayModuleDefinition, deployment: RunwayDeploymentDefinition = None, future: RunwayFutureDefinitionModel = None, variables: RunwayVariablesDefinition = None) None [source]¶
Instantiate class.
- Parameters:
context – Runway context object.
definition – A single module definition.
deployment – Deployment that this module is a part of.
future – Future functionality configuration.
variables – Runway variables.
- property environment_matches_defined: bool | None¶
Environment matches one of the defined environments.
Will return None if there is nothing defined for the current environment.
- property environments: RunwayEnvironmentsType¶
Environments defined for the deployment and module.
- property path: ModulePath¶
Return resolve module path.
- plan() None [source]¶
Plan for the next deploy of the module.
High level method for running a module.
- run(action: RunwayActionTypeDef) None [source]¶
Run a single module.
Low level API access to run a module object.
- Parameters:
action – Name of action to run.
- classmethod run_list(action: RunwayActionTypeDef, context: RunwayContext, modules: list[RunwayModuleDefinition], variables: RunwayVariablesDefinition, deployment: RunwayDeploymentDefinition = None, future: RunwayFutureDefinitionModel | None = None) None [source]¶
Run a list of modules.
- Parameters:
action – Name of action to run.
context – Runway context.
modules – List of modules to run.
variables – Variable definition for resolving lookups in the module.
deployment – Deployment the modules are a part of.
future – Future functionality configuration.
- property type: RunwayModuleType¶
Determine Runway module type.
- class runway.core.components.ModulePath[source]¶
Bases:
object
Handler for the
path
field of a Runway module.- __init__(definition: Path | str | None = None, *, cache_dir: Path, deploy_environment: DeployEnvironment | None = None) None [source]¶
Instantiate class.
- Parameters:
definition – Path definition.
cache_dir – Directory to use for caching if needed.
deploy_environment – Current deploy environment object.
- property metadata: ModulePathMetadataTypeDef¶
Information that describes the module path.
- classmethod parse_obj(obj: Path | RunwayModuleDefinition | RunwayModuleDefinitionModel | str | None, *, cache_dir: Path, deploy_environment: DeployEnvironment | None = None) ModulePath [source]¶
Parse object.
- Parameters:
obj – Object to parse.
cache_dir – Directory to use for caching if needed.
deploy_environment – Current deploy environment object.
- Raises:
TypeError – Unsupported type provided.
- class runway.core.components.RunwayModuleType[source]¶
Bases:
object
Runway configuration
type
settings object.The
type
property of a Runway configuration can be used to explicitly specify what module type you are intending to deploy.Runway determines the type of module you are trying to deploy in 3 different ways. First, it will check for the
type
property as described here, next it will look for a suffix as described in Module Definition, and finally it will attempt to autodetect your module type by scanning the files of the project. If none of those settings produces a valid result an error will occur. The following are valid explicit types:Type
IaC Tool/Framework
cdk
AWS CDK
cloudformation
CloudFormation
serverless
Serverless Framework
terraform
Terraform
kubernetes
Kubernetes
static
Even when specifying a module
type
the module structure needs to be conducive with that type of project. If the files contained within don’t match the type then an error will occur.- __init__(path: Path, class_path: str | None = None, type_str: RunwayModuleTypeTypeDef | None = None) None [source]¶
Instantiate class.
- Keyword Arguments:
path – The required path to the module
class_path – A supplied class_path to override the autodetected one.
type_str – An explicit type to assign to the RunwayModuleType