hexastack-fastapi 0.12.0__tar.gz → 0.13.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/PKG-INFO +17 -15
  2. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/README.md +16 -14
  3. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/pyproject.toml +1 -1
  4. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/pyproject.toml.orig +1 -1
  5. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/__init__.py +0 -0
  6. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/__init__.py +0 -0
  7. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/db_session.py +0 -0
  8. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/dependencies.py +0 -0
  9. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/docs.py +0 -0
  10. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/health.py +0 -0
  11. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/metrics.py +0 -0
  12. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/openziti.py +0 -0
  13. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/ratelimit.py +0 -0
  14. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/routing.py +0 -0
  15. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/server.py +0 -0
  16. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/sse.py +0 -0
  17. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/websockets.py +0 -0
  18. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/domain/__init__.py +0 -0
  19. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/domain/config.py +0 -0
  20. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/__init__.py +0 -0
  21. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/app.py +0 -0
  22. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/autodiscovery.py +0 -0
  23. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/bootstrap.py +0 -0
  24. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/config.py +0 -0
  25. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/decorators.py +0 -0
  26. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/exception_handlers.py +0 -0
  27. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/middleware/__init__.py +0 -0
  28. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/middleware/correlation.py +0 -0
  29. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/middleware/logging.py +0 -0
  30. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/middleware/metrics.py +0 -0
  31. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/py.typed +0 -0
  32. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/testing/__init__.py +0 -0
  33. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/testing/cursor.py +0 -0
  34. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/testing/recorder.py +0 -0
  35. {hexastack_fastapi-0.12.0 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/testing/server.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hexastack-fastapi
3
- Version: 0.12.0
3
+ Version: 0.13.0
4
4
  Summary: FastAPI presentation adapter for Hexastack
5
5
  Author: Richard West
6
6
  Author-email: Richard West <dopplereffect.us@gmail.com>
@@ -32,7 +32,7 @@ Description-Content-Type: text/markdown
32
32
  > FastAPI presentation adapter for Hexastack: automatic CQRS routing, database session middleware, exception mapping, and health check endpoints.
33
33
 
34
34
  [![PyPI: hexastack-fastapi](https://img.shields.io/pypi/v/hexastack-fastapi.svg)](https://pypi.org/project/hexastack-fastapi/)
35
- [![Python 3.13+](https://img.shields.io/badge/python-3.13+-blue.svg)](https://www.python.org/downloads/)
35
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
36
36
  [![Coverage](https://codecov.io/github/TheTrueSCU/hexastack/graph/badge.svg?component=hexastack_fastapi)](https://codecov.io/github/TheTrueSCU/hexastack)
37
37
  [![Part of Hexastack](https://img.shields.io/badge/part%20of-hexastack-blueviolet.svg)](https://dopplereffect.us/hexastack/)
38
38
  [![Accessibility: WCAG 2.1 AA](https://img.shields.io/badge/accessibility-WCAG%202.1%20AA-brightgreen.svg)](https://www.w3.org/WAI/WCAG21/quickref/?levels=aa)
@@ -53,7 +53,7 @@ Description-Content-Type: text/markdown
53
53
  - **Standardized Exception Handlers**: Automatically translates domain exceptions (`EntityNotFoundError`, `UniqueConstraintViolationError`, `HexastackError`) into appropriate HTTP status codes (404, 409, 500) and structured JSON error envelopes.
54
54
  - **Observability & Correlation Middleware**: Injects `X-Correlation-ID` headers, logs HTTP request lifecycles, and captures HTTP RED metrics (`HttpMetricsMiddleware`) exposing a standard `/metrics` endpoint.
55
55
  - **Built-in Health Checks**: Configurable `/health` and `/ready` endpoints verifying container and subsystem readiness.
56
- - **NiceGUI Reactive UI & DevTools Dashboard**: Optional `[ui]` presentation adapter providing `ui_page`, `dispatch_command`, `dispatch_query`, and a zero-config interactive developer console (`mount_devtools_dashboard`) for inspecting CQRS buses, feature flags, and DI services.
56
+ - **NiceGUI DevTools Companion (`hexastack-ui`)**: Pair with [`hexastack-ui`](../hexastack_ui/README.md) (`pip install "hexastack[ui]"`) to mount the interactive NiceGUI DevTools dashboard (`mount_devtools_dashboard(app, container)`).
57
57
 
58
58
 
59
59
  ---
@@ -63,7 +63,7 @@ Description-Content-Type: text/markdown
63
63
  ```
64
64
  hexastack_fastapi/
65
65
  ├── domain/ # HealthStatus, HTTP error envelope models, HexastackFastApiConfig
66
- ├── adapters/ # routing decorators, SSE streaming, WebSockets, health endpoints, db_session middleware, dependencies, NiceGUI UI adapter
66
+ ├── adapters/ # routing decorators, SSE streaming, WebSockets, health endpoints, db_session middleware, dependencies, ratelimit
67
67
  └── infra/ # create_fastapi_app, FastApiBootstrapper (order=30), exception handlers, correlation/logging middlewares
68
68
  ```
69
69
 
@@ -79,7 +79,6 @@ hexastack_fastapi/
79
79
  | **Exception Handlers** | `register_exception_handlers`, `domain_exception_handler` |
80
80
  | **Middlewares** | `DbSessionMiddleware`, `AsyncDbSessionMiddleware`, `add_db_session_middleware`, `CorrelationMiddleware`, `HttpLoggingMiddleware` |
81
81
  | **Rate Limiting** | `SlowapiRateLimiterAdapter`, `get_remote_address`, `get_user_or_ip_key`, `RateLimitConfig` |
82
- | **Reactive UI (NiceGUI)** | `dispatch_command`, `dispatch_query`, `mount_devtools_dashboard`, `mount_ui_app`, `ui_page` |
83
82
  | **Real-Time Streaming (SSE & WebSockets)** | `EventSourceResponse`, `ServerSentEvent`, `WebSocketConnectionManager`, `WebSocketCqrsBridge` |
84
83
  | **Routing** | `CqrsRouter`, `autodiscover_routes` |
85
84
  | **Testing, E2E & Demo Narration** | `create_test_client`, `check_openapi_conformance`, `EphemeralServer`, `ephemeral_server`, `find_free_port`, `smart_click`, `DemoNarrator`, `VIRTUAL_CURSOR_SCRIPT` |
@@ -108,7 +107,7 @@ graph TD
108
107
 
109
108
  subgraph DecoupledProviders ["Decoupled Providers (via DI)"]
110
109
  DB_FACTORY["sessionmaker / async_sessionmaker (from hexastack-db)"]
111
- LOG_PORT["LoggerPort (from hexastack-logging)"]
110
+ LOG_PORT["LoggingPort (from hexastack-logging)"]
112
111
  end
113
112
 
114
113
  HTTP --> APP
@@ -118,7 +117,7 @@ graph TD
118
117
  ROUTER -->|dispatches to| QBUS
119
118
 
120
119
  MW -. consumes session factory from DI .-> DB_FACTORY
121
- MW -. consumes LoggerPort from DI .-> LOG_PORT
120
+ MW -. consumes LoggingPort from DI .-> LOG_PORT
122
121
  ```
123
122
 
124
123
  ### Explicit Dependencies (Direct)
@@ -128,7 +127,7 @@ graph TD
128
127
 
129
128
  ### Implied / Behavioral Relationships (DI-Mediated)
130
129
  - **Zero-Dependency DB Session Management**: `DbSessionMiddleware` dynamically resolves SQLAlchemy `sessionmaker` from DI without directly importing `hexastack-db`.
131
- - **Telemetry Integration**: `HttpLoggingMiddleware` outputs structured request telemetry through `LoggerPort`.
130
+ - **Telemetry Integration**: `HttpLoggingMiddleware` outputs structured request telemetry through `LoggingPort`.
132
131
  - **Exception Mapping**: Registers global exception handlers translating core domain errors into standard HTTP error responses.
133
132
 
134
133
  ---
@@ -139,8 +138,8 @@ graph TD
139
138
  # Standalone install
140
139
  pip install hexastack-fastapi
141
140
 
142
- # With Uvicorn development server
143
- pip install "hexastack-fastapi[web]" # or: pip install "hexastack[web]"
141
+ # With Uvicorn development server (or umbrella web bundle)
142
+ pip install "hexastack[web]" # or: pip install hexastack-fastapi "uvicorn[standard]"
144
143
 
145
144
  # Via umbrella package
146
145
  pip install "hexastack[fastapi]"
@@ -156,8 +155,11 @@ title = "Hexastack API"
156
155
  version = "1.0.0"
157
156
  docs_url = "/docs"
158
157
  openapi_url = "/openapi.json"
159
- cors_origins = ["*"]
160
- enable_correlation_header = true
158
+ correlation_header = "X-Correlation-ID"
159
+
160
+ [hexastack.fastapi.cors]
161
+ enable = true
162
+ allow_origins = ["*"]
161
163
  ```
162
164
 
163
165
  ---
@@ -167,10 +169,10 @@ enable_correlation_header = true
167
169
  ```python
168
170
  from dataclasses import dataclass
169
171
  from fastapi.testclient import TestClient
172
+ from hexastack_core.domain import Query
170
173
  from hexastack_core.infra.bootstrap import bootstrap
171
- from hexastack_cqrs.domain.query import Query
172
174
  from hexastack_cqrs.infra.decorators import query_handler
173
- from hexastack_fastapi.adapters.app import create_app
175
+ from hexastack_fastapi.infra.app import create_fastapi_app
174
176
 
175
177
 
176
178
  @dataclass(frozen=True)
@@ -185,7 +187,7 @@ class GetGreetingHandler:
185
187
 
186
188
 
187
189
  runtime = bootstrap(packages_to_scan=[__name__])
188
- app = create_app(runtime)
190
+ app = create_fastapi_app(container=runtime.container)
189
191
 
190
192
  client = TestClient(app)
191
193
  response = client.get("/health")
@@ -5,7 +5,7 @@
5
5
  > FastAPI presentation adapter for Hexastack: automatic CQRS routing, database session middleware, exception mapping, and health check endpoints.
6
6
 
7
7
  [![PyPI: hexastack-fastapi](https://img.shields.io/pypi/v/hexastack-fastapi.svg)](https://pypi.org/project/hexastack-fastapi/)
8
- [![Python 3.13+](https://img.shields.io/badge/python-3.13+-blue.svg)](https://www.python.org/downloads/)
8
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
9
9
  [![Coverage](https://codecov.io/github/TheTrueSCU/hexastack/graph/badge.svg?component=hexastack_fastapi)](https://codecov.io/github/TheTrueSCU/hexastack)
10
10
  [![Part of Hexastack](https://img.shields.io/badge/part%20of-hexastack-blueviolet.svg)](https://dopplereffect.us/hexastack/)
11
11
  [![Accessibility: WCAG 2.1 AA](https://img.shields.io/badge/accessibility-WCAG%202.1%20AA-brightgreen.svg)](https://www.w3.org/WAI/WCAG21/quickref/?levels=aa)
@@ -26,7 +26,7 @@
26
26
  - **Standardized Exception Handlers**: Automatically translates domain exceptions (`EntityNotFoundError`, `UniqueConstraintViolationError`, `HexastackError`) into appropriate HTTP status codes (404, 409, 500) and structured JSON error envelopes.
27
27
  - **Observability & Correlation Middleware**: Injects `X-Correlation-ID` headers, logs HTTP request lifecycles, and captures HTTP RED metrics (`HttpMetricsMiddleware`) exposing a standard `/metrics` endpoint.
28
28
  - **Built-in Health Checks**: Configurable `/health` and `/ready` endpoints verifying container and subsystem readiness.
29
- - **NiceGUI Reactive UI & DevTools Dashboard**: Optional `[ui]` presentation adapter providing `ui_page`, `dispatch_command`, `dispatch_query`, and a zero-config interactive developer console (`mount_devtools_dashboard`) for inspecting CQRS buses, feature flags, and DI services.
29
+ - **NiceGUI DevTools Companion (`hexastack-ui`)**: Pair with [`hexastack-ui`](../hexastack_ui/README.md) (`pip install "hexastack[ui]"`) to mount the interactive NiceGUI DevTools dashboard (`mount_devtools_dashboard(app, container)`).
30
30
 
31
31
 
32
32
  ---
@@ -36,7 +36,7 @@
36
36
  ```
37
37
  hexastack_fastapi/
38
38
  ├── domain/ # HealthStatus, HTTP error envelope models, HexastackFastApiConfig
39
- ├── adapters/ # routing decorators, SSE streaming, WebSockets, health endpoints, db_session middleware, dependencies, NiceGUI UI adapter
39
+ ├── adapters/ # routing decorators, SSE streaming, WebSockets, health endpoints, db_session middleware, dependencies, ratelimit
40
40
  └── infra/ # create_fastapi_app, FastApiBootstrapper (order=30), exception handlers, correlation/logging middlewares
41
41
  ```
42
42
 
@@ -52,7 +52,6 @@ hexastack_fastapi/
52
52
  | **Exception Handlers** | `register_exception_handlers`, `domain_exception_handler` |
53
53
  | **Middlewares** | `DbSessionMiddleware`, `AsyncDbSessionMiddleware`, `add_db_session_middleware`, `CorrelationMiddleware`, `HttpLoggingMiddleware` |
54
54
  | **Rate Limiting** | `SlowapiRateLimiterAdapter`, `get_remote_address`, `get_user_or_ip_key`, `RateLimitConfig` |
55
- | **Reactive UI (NiceGUI)** | `dispatch_command`, `dispatch_query`, `mount_devtools_dashboard`, `mount_ui_app`, `ui_page` |
56
55
  | **Real-Time Streaming (SSE & WebSockets)** | `EventSourceResponse`, `ServerSentEvent`, `WebSocketConnectionManager`, `WebSocketCqrsBridge` |
57
56
  | **Routing** | `CqrsRouter`, `autodiscover_routes` |
58
57
  | **Testing, E2E & Demo Narration** | `create_test_client`, `check_openapi_conformance`, `EphemeralServer`, `ephemeral_server`, `find_free_port`, `smart_click`, `DemoNarrator`, `VIRTUAL_CURSOR_SCRIPT` |
@@ -81,7 +80,7 @@ graph TD
81
80
 
82
81
  subgraph DecoupledProviders ["Decoupled Providers (via DI)"]
83
82
  DB_FACTORY["sessionmaker / async_sessionmaker (from hexastack-db)"]
84
- LOG_PORT["LoggerPort (from hexastack-logging)"]
83
+ LOG_PORT["LoggingPort (from hexastack-logging)"]
85
84
  end
86
85
 
87
86
  HTTP --> APP
@@ -91,7 +90,7 @@ graph TD
91
90
  ROUTER -->|dispatches to| QBUS
92
91
 
93
92
  MW -. consumes session factory from DI .-> DB_FACTORY
94
- MW -. consumes LoggerPort from DI .-> LOG_PORT
93
+ MW -. consumes LoggingPort from DI .-> LOG_PORT
95
94
  ```
96
95
 
97
96
  ### Explicit Dependencies (Direct)
@@ -101,7 +100,7 @@ graph TD
101
100
 
102
101
  ### Implied / Behavioral Relationships (DI-Mediated)
103
102
  - **Zero-Dependency DB Session Management**: `DbSessionMiddleware` dynamically resolves SQLAlchemy `sessionmaker` from DI without directly importing `hexastack-db`.
104
- - **Telemetry Integration**: `HttpLoggingMiddleware` outputs structured request telemetry through `LoggerPort`.
103
+ - **Telemetry Integration**: `HttpLoggingMiddleware` outputs structured request telemetry through `LoggingPort`.
105
104
  - **Exception Mapping**: Registers global exception handlers translating core domain errors into standard HTTP error responses.
106
105
 
107
106
  ---
@@ -112,8 +111,8 @@ graph TD
112
111
  # Standalone install
113
112
  pip install hexastack-fastapi
114
113
 
115
- # With Uvicorn development server
116
- pip install "hexastack-fastapi[web]" # or: pip install "hexastack[web]"
114
+ # With Uvicorn development server (or umbrella web bundle)
115
+ pip install "hexastack[web]" # or: pip install hexastack-fastapi "uvicorn[standard]"
117
116
 
118
117
  # Via umbrella package
119
118
  pip install "hexastack[fastapi]"
@@ -129,8 +128,11 @@ title = "Hexastack API"
129
128
  version = "1.0.0"
130
129
  docs_url = "/docs"
131
130
  openapi_url = "/openapi.json"
132
- cors_origins = ["*"]
133
- enable_correlation_header = true
131
+ correlation_header = "X-Correlation-ID"
132
+
133
+ [hexastack.fastapi.cors]
134
+ enable = true
135
+ allow_origins = ["*"]
134
136
  ```
135
137
 
136
138
  ---
@@ -140,10 +142,10 @@ enable_correlation_header = true
140
142
  ```python
141
143
  from dataclasses import dataclass
142
144
  from fastapi.testclient import TestClient
145
+ from hexastack_core.domain import Query
143
146
  from hexastack_core.infra.bootstrap import bootstrap
144
- from hexastack_cqrs.domain.query import Query
145
147
  from hexastack_cqrs.infra.decorators import query_handler
146
- from hexastack_fastapi.adapters.app import create_app
148
+ from hexastack_fastapi.infra.app import create_fastapi_app
147
149
 
148
150
 
149
151
  @dataclass(frozen=True)
@@ -158,7 +160,7 @@ class GetGreetingHandler:
158
160
 
159
161
 
160
162
  runtime = bootstrap(packages_to_scan=[__name__])
161
- app = create_app(runtime)
163
+ app = create_fastapi_app(container=runtime.container)
162
164
 
163
165
  client = TestClient(app)
164
166
  response = client.get("/health")
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hexastack-fastapi"
3
- version = "0.12.0"
3
+ version = "0.13.0"
4
4
  description = "FastAPI presentation adapter for Hexastack"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hexastack-fastapi"
3
- version = "0.12.0"
3
+ version = "0.13.0"
4
4
  description = "FastAPI presentation adapter for Hexastack"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"