Metadata-Version: 2.1
Name: topless
Version: 0.1.0
Summary: Tailored OPerations for serverLESS
Author: Rafael Izidoro
Author-email: izidoro.me@gmail.com
Requires-Python: >=3.11,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: alembic (>=1.12.1,<2.0.0)
Requires-Dist: aws-lambda-powertools (>=2.26.0,<3.0.0)
Requires-Dist: boto3 (>=1.28.67,<2.0.0)
Requires-Dist: jinja2 (>=3.1.2,<4.0.0)
Requires-Dist: marshmallow (>=3.20.1,<4.0.0)
Requires-Dist: marshmallow-dataclass[enum,union] (>=8.6.0,<9.0.0)
Requires-Dist: pg8000 (>=1.30.3,<2.0.0)
Requires-Dist: pluralizer (>=1.2.0,<2.0.0)
Requires-Dist: requests (>=2.31.0,<3.0.0)
Requires-Dist: requests-aws-sign (>=0.1.6,<0.2.0)
Requires-Dist: rich (>=13.7.0,<14.0.0)
Requires-Dist: ruamel-yaml (>=0.18.5,<0.19.0)
Requires-Dist: sqlalchemy (>=2.0.23,<3.0.0)
Requires-Dist: strenum (>=0.4.15,<0.5.0)
Requires-Dist: stringcase (>=1.2.0,<2.0.0)
Requires-Dist: tomli (>=2.0.1,<3.0.0)
Requires-Dist: typer (>=0.9.0,<0.10.0)
Requires-Dist: uuid6 (>=2023.5.2,<2024.0.0)
Description-Content-Type: text/markdown

## Action Execution Model

The Topless actionexecution model is processed in two different steps:

1. Action Handler Registration
Every action created with one of the provided decorators (route, schedule, bucket or topic) is registered on the main Topless app instance. The instance is created on the client side (main.py file), and is shared throghouth the framework modules by a singleton pattern.

Flow of execution: 
```mermaid
sequenceDiagram
    box Client
    participant C1 as bootstrap.py
    participant C2 as main.py
    end

    box Core
    participant T1 as bootstrap.py
    participant T2 as app.py
    participant T3 as handler.py
    end


    C1->>C2: Import main.py
    C2-->>C1: Topless instance and registrations
    C1->>T1: Start framework bootstrap
    T1->>T2: Load all modules
    T2->>T3: Map action handlers
    T1-->>C1: Finish setup
    
```

2. Action Handler Execution
When lambda is called, the client bootstrap.py handle method is executed. Every lambda resource on the template.yaml (dinamically generated by topless framework), will call this method at first, which will dispatch the bootstrap.handle method, to localize the action handler that is needed on that call.

```mermaid
sequenceDiagram
    participant L as Lambda Event
    participant CA as app.py (Client)
    participant CB as bootstrap.py (Client)
    participant TA as app.py (Core)
    participant TB as bootstrap.py (Core)
    participant TD as dispatcher.py (Core)
    participant TH as handler.py (Core)

    L->>CB: Trigger Lambda Function
    CB->>TB: Call framework bootstrap handler
    TB->>TD: Execute Dispatcher
    TD-->>TB: Construct action envelope and look for the correct action to be executed

```

