params

Parameter Management System for AWS CDK

This module provides a type-safe, extendable parameter system for AWS CDK constructs and stacks using Python dataclasses. The motivation for this system is to address limitations when subclassing CDK constructs like cdk.Stack:

  1. Because cdk Python uses def __init__(self, ...):, subclassing requires

    repeating parameter definitions to maintain type hints

  2. Using **kwargs loses type information and IDE completion support

  3. Validation of required parameters is handled manually and inconsistently

class cdkit.params.ConstructParams(id: str = REQ)[source]

Parameter dataclass for CDK Construct initialization.

How to extend:

import dataclasses
from func_args.api import REQ

@dataclasses.dataclass
class MyConstructParams(ConstructParams):
    your_custom_param_1: int = dataclasses.field(default=REQ)
    your_custom_param_2: str = dataclasses.field(default="my_default_value")
to_construct_kwargs() Dict[str, Any][source]

Generate keyword arguments for CDK construct initialization.

Note

To generate keyword arguments for all declared attributes, use the .to_kwargs() method.

class cdkit.params.StackParams(id: str = REQ, analytics_reporting: bool = OPT, cross_region_references: bool = OPT, description: str = OPT, env: cdk.Environment | dict[str, Any] = OPT, notification_arns: Sequence[str] = OPT, permissions_boundary: cdk.PermissionsBoundary = OPT, stack_name: str = OPT, suppress_template_indentation: bool = OPT, synthesizer: cdk.IStackSynthesizer = OPT, tags: Mapping[str, str] = OPT, termination_protection: bool = OPT)[source]

Parameter dataclass for CDK Stack initialization.

How to extend:

import dataclasses
from func_args.api import REQ

@dataclasses.dataclass
class MyStackParams(StackParams):
    your_custom_param_1: int = dataclasses.field(default=REQ)
    your_custom_param_2: str = dataclasses.field(default="my_default_value")
to_stack_kwargs() Dict[str, Any][source]

Generate keyword arguments for CDK Stack initialization.

Note

To generate keyword arguments for all declared attributes, use the .to_kwargs() method.