aws_codeseeder.codeseeder

Module Contents

Classes

CodeSeederConfig

Configuration dataclass

ModuleImporterEnum

str(object='') -> str

Functions

configure(seedkit_name: str, deploy_if_not_exists: bool = False) → aws_codeseeder._classes.ConfigureDecorator

Decorator marking a Configuration Function

deploy_seedkit(seedkit_name: str, managed_policy_arns: Optional[List[str]] = None, deploy_codeartifact: bool = False, session: Optional[Union[Callable[[], boto3.Session], boto3.Session]] = None, vpc_id: Optional[str] = None, subnet_ids: Optional[List[str]] = None, security_group_ids: Optional[List[str]] = None) → None

Deploys the seedkit resources into the environment.

remote_function(seedkit_name: str, *, function_module: Optional[str] = None, function_name: Optional[str] = None, timeout: Optional[int] = None, codebuild_log_callback: Optional[Callable[[str], None]] = None, extra_python_modules: Optional[List[str]] = None, extra_local_modules: Optional[Dict[str, str]] = None, extra_requirements_files: Optional[Dict[str, str]] = None, codebuild_image: Optional[str] = None, codebuild_role: Optional[str] = None, codebuild_environment_type: Optional[str] = None, codebuild_compute_type: Optional[str] = None, npm_mirror: Optional[str] = None, pypi_mirror: Optional[str] = None, extra_install_commands: Optional[List[str]] = None, extra_pre_build_commands: Optional[List[str]] = None, extra_pre_execution_commands: Optional[List[str]] = None, extra_build_commands: Optional[List[str]] = None, extra_post_build_commands: Optional[List[str]] = None, extra_dirs: Optional[Dict[str, str]] = None, extra_files: Optional[Dict[str, str]] = None, extra_env_vars: Optional[Dict[str, Union[str, aws_codeseeder._classes.EnvVar]]] = None, extra_exported_env_vars: Optional[List[str]] = None, prebuilt_bundle: Optional[str] = None, abort_phases_on_failure: Optional[bool] = None, runtime_versions: Optional[Dict[str, str]] = None, bundle_id: Optional[str] = None, boto3_session: Optional[Union[Callable[[], boto3.Session], boto3.Session]] = None) → aws_codeseeder._classes.RemoteFunctionDecorator

Decorator marking a Remote Function

seedkit_deployed(seedkit_name: str, session: Optional[Union[Callable[[], boto3.Session], boto3.Session]] = None) → Tuple[bool, str, Dict[str, str]]

Checks for existence of the Seedkit CloudFormation Stack

Attributes

ConfigureDecorator

RemoteFunctionDecorator

aws_codeseeder.codeseeder.ConfigureDecorator
aws_codeseeder.codeseeder.RemoteFunctionDecorator
class aws_codeseeder.codeseeder.CodeSeederConfig

Configuration dataclass

Parameters
  • timeout (Optional[int], optional) – Set the CodeBuild execution timeout, by default 30

  • python_modules (Optional[List[str]], optional) – List of python modules to install during CodeBuild exection, by default None

  • local_modules (Optional[Dict[str, str]], optional) – Name and Location of local python modules to bundle and install during CodeBuild execution, by default None

  • requirements_files (Optional[Dict[str, str]], optional) – Local requirements.txt files to bundle and install during CodeBuild execution, by default None

  • codebuild_image (Optional[str], optional) – Alternative container image to use during CodeBuild execution, by default None

  • codebuild_role (Optional[str], optional) – Alternative IAM Role to use during CodeBuild execution, by default None

  • codebuild_environment_type (Optional[str], optional) – Alternative Environment to use for the CodeBuild execution (e.g. LINUX_CONTAINER), by default None

  • codebuild_compute_type (Optional[str], optional) – Alternative Compute to use for the CodeBuild execution (e.g. BUILD_GENERAL1_SMALL), by default None

  • npm_mirror (Optional[str]) – Global config for the npm mirror to use, by default None

  • pypi_mirror (Optional[str]) – Global config for the pypi mirror to use, by default None

  • install_commands (Optional[List[str]], optional) – Commands to execute during the Install phase of the CodeBuild execution, by default None

  • pre_build_commands (Optional[List[str]], optional) – Commands to execute during the PreBuild phase of the CodeBuild execution, by default None

  • pre_execution_commands (Optional[List[str]], optional) – Commands to execute during the Build phase of the CodeBuild execution prior to calling the remote_function, by default None

  • build_commands (Optional[List[str]], optional) – Commands to execute during the Build phase of the CodeBuild execution after calling the remote_functin, by default None

  • post_build_commands (Optional[List[str]], optional) – Commands to execute during the PostBuild phase of the CodeBuild execution, by default None

  • dirs (Optional[Dict[str, str]], optional) – Name and Location of local directories to bundle and include in the CodeBuild exeuction,by default None

  • files (Optional[Dict[str, str]], optional) – Name and Location of local files to bundle and include in the CodeBuild execution, by default None

  • env_vars (Optional[Dict[str, Union[str, EnvVar]]], optional) – Environment variables to set in the CodeBuild execution, by default None

  • exported_env_vars (Optional[List[str], optional) – Environment variables to export from the CodeBuild execution, by default None

  • abort_phases_on_failure (bool) – Toggle aborting CodeBuild Phases when an execution failure occurs, by default True

  • runtime_versions (Optional[Dict[str, str]], optional) – Runtime versions (e.g. python, nodejs) to install, by default {"python": "3.7", "nodejs": "12", "docker": "19"}

  • prebuilt_bundle (Optional[str]) – Provide S3 path to a prebuild bundle to use to deploy

abort_phases_on_failure :bool = True
build_commands :Optional[List[str]]
codebuild_compute_type :Optional[str]
codebuild_environment_type :Optional[str]
codebuild_image :Optional[str]
codebuild_role :Optional[str]
dirs :Optional[Dict[str, str]]
env_vars :Optional[Dict[str, Union[str, EnvVar]]]
exported_env_vars :Optional[List[str]]
files :Optional[Dict[str, str]]
install_commands :Optional[List[str]]
local_modules :Optional[Dict[str, str]]
npm_mirror :Optional[str]
post_build_commands :Optional[List[str]]
pre_build_commands :Optional[List[str]]
pre_execution_commands :Optional[List[str]]
prebuilt_bundle :Optional[str]
pypi_mirror :Optional[str]
python_modules :Optional[List[str]]
requirements_files :Optional[Dict[str, str]]
runtime_versions :Optional[Dict[str, str]]
timeout :Optional[int] = 30
class aws_codeseeder.codeseeder.ModuleImporterEnum

Bases: str, enum.Enum

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

CODESEEDER_CLI = codeseeder-cli
OTHER = other
aws_codeseeder.codeseeder.configure(seedkit_name: str, deploy_if_not_exists: bool = False) aws_codeseeder._classes.ConfigureDecorator

Decorator marking a Configuration Function

Decorated Configuration Functions are executed lazily when a remote_function for a particular Seedkit is called. The Configuration Function sets the default configuration for the Seedkit.

Parameters
  • seedkit_name (str) – The name of the previously deployed Seedkit to associate this configuration with

  • deploy_if_not_exists (bool) – Deploy a Seedkit of seedkit_name if it does not exist, by default False

Returns

The decorated function

Return type

ConfigureDecorator

aws_codeseeder.codeseeder.deploy_seedkit(seedkit_name: str, managed_policy_arns: Optional[List[str]] = None, deploy_codeartifact: bool = False, session: Optional[Union[Callable[[], boto3.Session], boto3.Session]] = None, vpc_id: Optional[str] = None, subnet_ids: Optional[List[str]] = None, security_group_ids: Optional[List[str]] = None) None

Deploys the seedkit resources into the environment.

Resources deployed include: S3 Bucket, CodeArtifact Domain, CodeArtifact Repository, CodeBuild Project, IAM Role, IAM Managed Policy, and KMS Key. All resource names will include the seedkit_name and IAM Role and Policy grant least privilege access to only the resources associated with this Seedkit. Seedkits are deployed to an AWS Region, names on global resources (S3, IAM) include a region identifier to avoid conflicts and ensure the same Seedkit name can be deployed to multiple regions.

Parameters
  • seedkit_name (str) – Name of the seedkit to deploy. All resources will include this in their naming conventions

  • managed_policy_arns (Optional[List[str]]) – List of Managed Policy to ARNs to attach to the default IAM Role created and used by the CodeBuild Project

  • deploy_codeartifact (bool) – Trigger optional deployment of CodeArtifact Domain and Repository for use by the Seedkit and its libraries

  • session (Optional[Union[Callable[[], Session], Session]], optional) – Optional Session or function returning a Session to use for all boto3 operations, by default None

  • vpc_id (Optional[str]) – If deploying codebuild in a VPC, the VPC-ID to use (must have vpc-id, subnets, and security_group_ids)

  • subnet_ids (Optional[List[str]]) – If deploying codebuild in a VPC, a list of Subnets to use (must have vpc-id, subnets, and security_group_ids)

  • security_group_ids (Optional[List[str]]) – If deploying codebuild in a VPC, a list of Security Group IDs to use (must have vpc-id, subnets, and security_group_ids)

aws_codeseeder.codeseeder.remote_function(seedkit_name: str, *, function_module: Optional[str] = None, function_name: Optional[str] = None, timeout: Optional[int] = None, codebuild_log_callback: Optional[Callable[[str], None]] = None, extra_python_modules: Optional[List[str]] = None, extra_local_modules: Optional[Dict[str, str]] = None, extra_requirements_files: Optional[Dict[str, str]] = None, codebuild_image: Optional[str] = None, codebuild_role: Optional[str] = None, codebuild_environment_type: Optional[str] = None, codebuild_compute_type: Optional[str] = None, npm_mirror: Optional[str] = None, pypi_mirror: Optional[str] = None, extra_install_commands: Optional[List[str]] = None, extra_pre_build_commands: Optional[List[str]] = None, extra_pre_execution_commands: Optional[List[str]] = None, extra_build_commands: Optional[List[str]] = None, extra_post_build_commands: Optional[List[str]] = None, extra_dirs: Optional[Dict[str, str]] = None, extra_files: Optional[Dict[str, str]] = None, extra_env_vars: Optional[Dict[str, Union[str, aws_codeseeder._classes.EnvVar]]] = None, extra_exported_env_vars: Optional[List[str]] = None, prebuilt_bundle: Optional[str] = None, abort_phases_on_failure: Optional[bool] = None, runtime_versions: Optional[Dict[str, str]] = None, bundle_id: Optional[str] = None, boto3_session: Optional[Union[Callable[[], boto3.Session], boto3.Session]] = None) aws_codeseeder._classes.RemoteFunctionDecorator

Decorator marking a Remote Function

Decorated Remote Functions are intercepted on execution and seeded to a CodeBuild Project for remote execution.

Parameters
  • seedkit_name (str) – The name of the previously deployed Seedkit to seed execution to.

  • function_module (Optional[str], optional) – Name of the module in the seeded code to execute. If None, then inferred from the decorated function’s module, by default None

  • function_name (Optional[str], optional) – Name of the function in the seeded code to execute. If None, the inferred from the decorated function’s name, by default None

  • timeout (Optional[int], optional) – Override the CodeBuild execution timeout, by default None

  • codebuild_log_callback (Optional[Callable[[str], None]], optional) – Callback function executed as CodeBuild execution logs are pulled, by default None

  • extra_python_modules (Optional[List[str]], optional) – List of additional python modules to install during CodeBuild exection, by default None

  • extra_local_modules (Optional[Dict[str, str]], optional) – Name and Location of additional local python modules to bundle and install during CodeBuild execution, by default None

  • extra_requirements_files (Optional[Dict[str, str]], optional) – Additional local requirements.txt files to bundle and install during CodeBuild execution, by default None

  • codebuild_image (Optional[str], optional) – Alternative container image to use during CodeBuild execution, by default None

  • codebuild_role (Optional[str], optional) – Alternative IAM Role to use during CodeBuild execution, by default None

  • codebuild_environment_type (Optional[str], optional) – Alternative Environment to use for the CodeBuild execution (e.g. LINUX_CONTAINER), by default None

  • codebuild_compute_type (Optional[str], optional) – Alternative Compute to use for the CodeBuild execution (e.g. BUILD_GENERAL1_SMALL), by default None

  • npm_mirror (Optional[str]) – Global config for the npm mirror to use

  • pypi_mirror (Optional[str]) – Global config for the pypi mirror to use

  • extra_install_commands (Optional[List[str]], optional) – Additional commands to execute during the Install phase of the CodeBuild execution, by default None

  • extra_pre_build_commands (Optional[List[str]], optional) – Additional commands to execute during the PreBuild phase of the CodeBuild execution, by default None

  • extra_pre_execution_commands (Optional[List[str]], optional) – Additional commands to execute during the Build phase of the CodeBuild execution prior to calling the remote_function, by default None

  • extra_build_commands (Optional[List[str]], optional) – Additional commands to execute during the Build phase of the CodeBuild execution after calling the remote_function, by default None

  • extra_post_build_commands (Optional[List[str]], optional) – Additional commands to execute during the PostBuild phase of the CodeBuild execution, by default None

  • extra_dirs (Optional[Dict[str, str]], optional) – Name and Location of additional local directories to bundle and include in the CodeBuild exeuction, by default None

  • extra_files (Optional[Dict[str, str]], optional) – Name and Location of additional local files to bundle and include in the CodeBuild execution, by default None

  • extra_env_vars (Optional[Dict[str, Union[str, EnvVar]]], optional) – Additional environment variables to set in the CodeBuild execution, by default None

  • extra_exported_env_vars (Optional[List[str]], optional) – Additional environment variables to export from the CodeBuild execution, by default None

  • abort_phases_on_failure (Optional[bool], optional) – Override default abort of CodeBuild Phases when an execution failure occurs, by default None

  • runtime_versions (Optional[Dict[str, str]], optional) – Override default runtime versions (e.g. python, nodejs) to install, by default None

  • bundle_id (Optional[str], optional) – Optional identifier to uniquely identify a bundle locally when multiple remote_functions are executed concurrently, by default None

  • boto3_session (Optional[Union[Callable[[], Session], Session]], optional) – Optional Session or function returning a Session to use for all boto3 operations, by default None

Returns

The decorated function

Return type

RemoteFunctionDecorator

aws_codeseeder.codeseeder.seedkit_deployed(seedkit_name: str, session: Optional[Union[Callable[[], boto3.Session], boto3.Session]] = None) Tuple[bool, str, Dict[str, str]]

Checks for existence of the Seedkit CloudFormation Stack

If the Stack exists, then the Stack Outputs are also returned to eliminate need for another roundtrip call to CloudFormation.

Parameters
  • seedkit_name (str) – Named of the seedkit to check.

  • session (Optional[Union[Callable[[], Session], Session]], optional) – Optional Session or function returning a Session to use for all boto3 operations, by default None

Returns

Returns a Tuple with a bool indicating existence of the Stack, the Stack name, and a dict with the Stack Outputs

Return type

Tuple[bool, str, Dict[str, str]]