hexastack-fastapi 0.11.3__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.11.3 → hexastack_fastapi-0.13.0}/PKG-INFO +18 -15
  2. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/README.md +17 -14
  3. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/pyproject.toml +1 -1
  4. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/pyproject.toml.orig +1 -1
  5. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/__init__.py +0 -0
  6. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/__init__.py +0 -0
  7. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/db_session.py +0 -0
  8. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/dependencies.py +0 -0
  9. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/docs.py +0 -0
  10. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/health.py +0 -0
  11. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/metrics.py +0 -0
  12. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/openziti.py +0 -0
  13. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/ratelimit.py +0 -0
  14. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/routing.py +0 -0
  15. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/server.py +0 -0
  16. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/sse.py +0 -0
  17. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/adapters/websockets.py +0 -0
  18. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/domain/__init__.py +0 -0
  19. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/domain/config.py +0 -0
  20. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/__init__.py +0 -0
  21. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/app.py +0 -0
  22. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/autodiscovery.py +0 -0
  23. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/bootstrap.py +0 -0
  24. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/config.py +0 -0
  25. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/decorators.py +0 -0
  26. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/exception_handlers.py +0 -0
  27. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/middleware/__init__.py +0 -0
  28. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/middleware/correlation.py +0 -0
  29. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/middleware/logging.py +0 -0
  30. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/infra/middleware/metrics.py +0 -0
  31. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/py.typed +0 -0
  32. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/testing/__init__.py +0 -0
  33. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/testing/cursor.py +0 -0
  34. {hexastack_fastapi-0.11.3 → hexastack_fastapi-0.13.0}/src/hexastack_fastapi/testing/recorder.py +0 -0
  35. {hexastack_fastapi-0.11.3 → 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.11.3
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,12 +32,13 @@ 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)
39
39
  [![Tested with: axe--core](https://img.shields.io/badge/tested%20with-axe--core-4353ff.svg?logo=deque)](https://github.com/dequelabs/axe-core)
40
40
  [![Governed by Hexaqual](https://img.shields.io/badge/governed%20by-hexaqual-10b981.svg)](https://dopplereffect.us/hexaqual/)
41
+ [![Tested on Hexaqueue](https://img.shields.io/badge/tested%20on-hexaqueue-blue.svg)](https://dopplereffect.us/hexaqueue/)
41
42
  [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](../../LICENSE)
42
43
 
43
44
  > Part of the [**Hexastack Framework**](https://dopplereffect.us/hexastack/) · Governed by [**Hexaqual**](https://dopplereffect.us/hexaqual/).
@@ -52,7 +53,7 @@ Description-Content-Type: text/markdown
52
53
  - **Standardized Exception Handlers**: Automatically translates domain exceptions (`EntityNotFoundError`, `UniqueConstraintViolationError`, `HexastackError`) into appropriate HTTP status codes (404, 409, 500) and structured JSON error envelopes.
53
54
  - **Observability & Correlation Middleware**: Injects `X-Correlation-ID` headers, logs HTTP request lifecycles, and captures HTTP RED metrics (`HttpMetricsMiddleware`) exposing a standard `/metrics` endpoint.
54
55
  - **Built-in Health Checks**: Configurable `/health` and `/ready` endpoints verifying container and subsystem readiness.
55
- - **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)`).
56
57
 
57
58
 
58
59
  ---
@@ -62,7 +63,7 @@ Description-Content-Type: text/markdown
62
63
  ```
63
64
  hexastack_fastapi/
64
65
  ├── domain/ # HealthStatus, HTTP error envelope models, HexastackFastApiConfig
65
- ├── 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
66
67
  └── infra/ # create_fastapi_app, FastApiBootstrapper (order=30), exception handlers, correlation/logging middlewares
67
68
  ```
68
69
 
@@ -78,7 +79,6 @@ hexastack_fastapi/
78
79
  | **Exception Handlers** | `register_exception_handlers`, `domain_exception_handler` |
79
80
  | **Middlewares** | `DbSessionMiddleware`, `AsyncDbSessionMiddleware`, `add_db_session_middleware`, `CorrelationMiddleware`, `HttpLoggingMiddleware` |
80
81
  | **Rate Limiting** | `SlowapiRateLimiterAdapter`, `get_remote_address`, `get_user_or_ip_key`, `RateLimitConfig` |
81
- | **Reactive UI (NiceGUI)** | `dispatch_command`, `dispatch_query`, `mount_devtools_dashboard`, `mount_ui_app`, `ui_page` |
82
82
  | **Real-Time Streaming (SSE & WebSockets)** | `EventSourceResponse`, `ServerSentEvent`, `WebSocketConnectionManager`, `WebSocketCqrsBridge` |
83
83
  | **Routing** | `CqrsRouter`, `autodiscover_routes` |
84
84
  | **Testing, E2E & Demo Narration** | `create_test_client`, `check_openapi_conformance`, `EphemeralServer`, `ephemeral_server`, `find_free_port`, `smart_click`, `DemoNarrator`, `VIRTUAL_CURSOR_SCRIPT` |
@@ -107,7 +107,7 @@ graph TD
107
107
 
108
108
  subgraph DecoupledProviders ["Decoupled Providers (via DI)"]
109
109
  DB_FACTORY["sessionmaker / async_sessionmaker (from hexastack-db)"]
110
- LOG_PORT["LoggerPort (from hexastack-logging)"]
110
+ LOG_PORT["LoggingPort (from hexastack-logging)"]
111
111
  end
112
112
 
113
113
  HTTP --> APP
@@ -117,7 +117,7 @@ graph TD
117
117
  ROUTER -->|dispatches to| QBUS
118
118
 
119
119
  MW -. consumes session factory from DI .-> DB_FACTORY
120
- MW -. consumes LoggerPort from DI .-> LOG_PORT
120
+ MW -. consumes LoggingPort from DI .-> LOG_PORT
121
121
  ```
122
122
 
123
123
  ### Explicit Dependencies (Direct)
@@ -127,7 +127,7 @@ graph TD
127
127
 
128
128
  ### Implied / Behavioral Relationships (DI-Mediated)
129
129
  - **Zero-Dependency DB Session Management**: `DbSessionMiddleware` dynamically resolves SQLAlchemy `sessionmaker` from DI without directly importing `hexastack-db`.
130
- - **Telemetry Integration**: `HttpLoggingMiddleware` outputs structured request telemetry through `LoggerPort`.
130
+ - **Telemetry Integration**: `HttpLoggingMiddleware` outputs structured request telemetry through `LoggingPort`.
131
131
  - **Exception Mapping**: Registers global exception handlers translating core domain errors into standard HTTP error responses.
132
132
 
133
133
  ---
@@ -138,8 +138,8 @@ graph TD
138
138
  # Standalone install
139
139
  pip install hexastack-fastapi
140
140
 
141
- # With Uvicorn development server
142
- 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]"
143
143
 
144
144
  # Via umbrella package
145
145
  pip install "hexastack[fastapi]"
@@ -155,8 +155,11 @@ title = "Hexastack API"
155
155
  version = "1.0.0"
156
156
  docs_url = "/docs"
157
157
  openapi_url = "/openapi.json"
158
- cors_origins = ["*"]
159
- enable_correlation_header = true
158
+ correlation_header = "X-Correlation-ID"
159
+
160
+ [hexastack.fastapi.cors]
161
+ enable = true
162
+ allow_origins = ["*"]
160
163
  ```
161
164
 
162
165
  ---
@@ -166,10 +169,10 @@ enable_correlation_header = true
166
169
  ```python
167
170
  from dataclasses import dataclass
168
171
  from fastapi.testclient import TestClient
172
+ from hexastack_core.domain import Query
169
173
  from hexastack_core.infra.bootstrap import bootstrap
170
- from hexastack_cqrs.domain.query import Query
171
174
  from hexastack_cqrs.infra.decorators import query_handler
172
- from hexastack_fastapi.adapters.app import create_app
175
+ from hexastack_fastapi.infra.app import create_fastapi_app
173
176
 
174
177
 
175
178
  @dataclass(frozen=True)
@@ -184,7 +187,7 @@ class GetGreetingHandler:
184
187
 
185
188
 
186
189
  runtime = bootstrap(packages_to_scan=[__name__])
187
- app = create_app(runtime)
190
+ app = create_fastapi_app(container=runtime.container)
188
191
 
189
192
  client = TestClient(app)
190
193
  response = client.get("/health")
@@ -5,12 +5,13 @@
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)
12
12
  [![Tested with: axe--core](https://img.shields.io/badge/tested%20with-axe--core-4353ff.svg?logo=deque)](https://github.com/dequelabs/axe-core)
13
13
  [![Governed by Hexaqual](https://img.shields.io/badge/governed%20by-hexaqual-10b981.svg)](https://dopplereffect.us/hexaqual/)
14
+ [![Tested on Hexaqueue](https://img.shields.io/badge/tested%20on-hexaqueue-blue.svg)](https://dopplereffect.us/hexaqueue/)
14
15
  [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](../../LICENSE)
15
16
 
16
17
  > Part of the [**Hexastack Framework**](https://dopplereffect.us/hexastack/) · Governed by [**Hexaqual**](https://dopplereffect.us/hexaqual/).
@@ -25,7 +26,7 @@
25
26
  - **Standardized Exception Handlers**: Automatically translates domain exceptions (`EntityNotFoundError`, `UniqueConstraintViolationError`, `HexastackError`) into appropriate HTTP status codes (404, 409, 500) and structured JSON error envelopes.
26
27
  - **Observability & Correlation Middleware**: Injects `X-Correlation-ID` headers, logs HTTP request lifecycles, and captures HTTP RED metrics (`HttpMetricsMiddleware`) exposing a standard `/metrics` endpoint.
27
28
  - **Built-in Health Checks**: Configurable `/health` and `/ready` endpoints verifying container and subsystem readiness.
28
- - **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)`).
29
30
 
30
31
 
31
32
  ---
@@ -35,7 +36,7 @@
35
36
  ```
36
37
  hexastack_fastapi/
37
38
  ├── domain/ # HealthStatus, HTTP error envelope models, HexastackFastApiConfig
38
- ├── 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
39
40
  └── infra/ # create_fastapi_app, FastApiBootstrapper (order=30), exception handlers, correlation/logging middlewares
40
41
  ```
41
42
 
@@ -51,7 +52,6 @@ hexastack_fastapi/
51
52
  | **Exception Handlers** | `register_exception_handlers`, `domain_exception_handler` |
52
53
  | **Middlewares** | `DbSessionMiddleware`, `AsyncDbSessionMiddleware`, `add_db_session_middleware`, `CorrelationMiddleware`, `HttpLoggingMiddleware` |
53
54
  | **Rate Limiting** | `SlowapiRateLimiterAdapter`, `get_remote_address`, `get_user_or_ip_key`, `RateLimitConfig` |
54
- | **Reactive UI (NiceGUI)** | `dispatch_command`, `dispatch_query`, `mount_devtools_dashboard`, `mount_ui_app`, `ui_page` |
55
55
  | **Real-Time Streaming (SSE & WebSockets)** | `EventSourceResponse`, `ServerSentEvent`, `WebSocketConnectionManager`, `WebSocketCqrsBridge` |
56
56
  | **Routing** | `CqrsRouter`, `autodiscover_routes` |
57
57
  | **Testing, E2E & Demo Narration** | `create_test_client`, `check_openapi_conformance`, `EphemeralServer`, `ephemeral_server`, `find_free_port`, `smart_click`, `DemoNarrator`, `VIRTUAL_CURSOR_SCRIPT` |
@@ -80,7 +80,7 @@ graph TD
80
80
 
81
81
  subgraph DecoupledProviders ["Decoupled Providers (via DI)"]
82
82
  DB_FACTORY["sessionmaker / async_sessionmaker (from hexastack-db)"]
83
- LOG_PORT["LoggerPort (from hexastack-logging)"]
83
+ LOG_PORT["LoggingPort (from hexastack-logging)"]
84
84
  end
85
85
 
86
86
  HTTP --> APP
@@ -90,7 +90,7 @@ graph TD
90
90
  ROUTER -->|dispatches to| QBUS
91
91
 
92
92
  MW -. consumes session factory from DI .-> DB_FACTORY
93
- MW -. consumes LoggerPort from DI .-> LOG_PORT
93
+ MW -. consumes LoggingPort from DI .-> LOG_PORT
94
94
  ```
95
95
 
96
96
  ### Explicit Dependencies (Direct)
@@ -100,7 +100,7 @@ graph TD
100
100
 
101
101
  ### Implied / Behavioral Relationships (DI-Mediated)
102
102
  - **Zero-Dependency DB Session Management**: `DbSessionMiddleware` dynamically resolves SQLAlchemy `sessionmaker` from DI without directly importing `hexastack-db`.
103
- - **Telemetry Integration**: `HttpLoggingMiddleware` outputs structured request telemetry through `LoggerPort`.
103
+ - **Telemetry Integration**: `HttpLoggingMiddleware` outputs structured request telemetry through `LoggingPort`.
104
104
  - **Exception Mapping**: Registers global exception handlers translating core domain errors into standard HTTP error responses.
105
105
 
106
106
  ---
@@ -111,8 +111,8 @@ graph TD
111
111
  # Standalone install
112
112
  pip install hexastack-fastapi
113
113
 
114
- # With Uvicorn development server
115
- 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]"
116
116
 
117
117
  # Via umbrella package
118
118
  pip install "hexastack[fastapi]"
@@ -128,8 +128,11 @@ title = "Hexastack API"
128
128
  version = "1.0.0"
129
129
  docs_url = "/docs"
130
130
  openapi_url = "/openapi.json"
131
- cors_origins = ["*"]
132
- enable_correlation_header = true
131
+ correlation_header = "X-Correlation-ID"
132
+
133
+ [hexastack.fastapi.cors]
134
+ enable = true
135
+ allow_origins = ["*"]
133
136
  ```
134
137
 
135
138
  ---
@@ -139,10 +142,10 @@ enable_correlation_header = true
139
142
  ```python
140
143
  from dataclasses import dataclass
141
144
  from fastapi.testclient import TestClient
145
+ from hexastack_core.domain import Query
142
146
  from hexastack_core.infra.bootstrap import bootstrap
143
- from hexastack_cqrs.domain.query import Query
144
147
  from hexastack_cqrs.infra.decorators import query_handler
145
- from hexastack_fastapi.adapters.app import create_app
148
+ from hexastack_fastapi.infra.app import create_fastapi_app
146
149
 
147
150
 
148
151
  @dataclass(frozen=True)
@@ -157,7 +160,7 @@ class GetGreetingHandler:
157
160
 
158
161
 
159
162
  runtime = bootstrap(packages_to_scan=[__name__])
160
- app = create_app(runtime)
163
+ app = create_fastapi_app(container=runtime.container)
161
164
 
162
165
  client = TestClient(app)
163
166
  response = client.get("/health")
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hexastack-fastapi"
3
- version = "0.11.3"
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.11.3"
3
+ version = "0.13.0"
4
4
  description = "FastAPI presentation adapter for Hexastack"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"