taipanstack 0.4.2__tar.gz → 0.4.4__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 (56) hide show
  1. {taipanstack-0.4.2 → taipanstack-0.4.4}/PKG-INFO +20 -22
  2. {taipanstack-0.4.2 → taipanstack-0.4.4}/README.md +19 -21
  3. {taipanstack-0.4.2 → taipanstack-0.4.4}/pyproject.toml +22 -14
  4. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/__init__.py +1 -1
  5. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/bridges/_imports.py +1 -2
  6. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/bridges/db_bridge.py +45 -32
  7. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/bridges/http_bridge.py +142 -43
  8. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/bridges/web_bridge.py +13 -10
  9. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/core/optimizations.py +33 -27
  10. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/core/result.py +19 -16
  11. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/resilience/adaptive/adaptive_breaker.py +7 -2
  12. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/resilience/adaptive/bulkhead.py +10 -5
  13. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/resilience/adaptive/orchestrator.py +37 -38
  14. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/resilience/circuit_breaker.py +102 -61
  15. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/resilience/resilience.py +30 -12
  16. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/resilience/retry.py +98 -29
  17. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/resilience/watchdogs/_base.py +1 -2
  18. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/resilience/watchdogs/config_watcher.py +45 -28
  19. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/resilience/watchdogs/health_pinger.py +43 -36
  20. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/resilience/watchdogs/resource_watcher.py +2 -2
  21. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/security/decorators.py +15 -8
  22. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/security/guards.py +143 -122
  23. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/security/jwt.py +13 -2
  24. taipanstack-0.4.4/src/taipanstack/security/models.py +184 -0
  25. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/security/password.py +67 -37
  26. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/security/sanitizers.py +104 -59
  27. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/security/validators.py +105 -46
  28. taipanstack-0.4.4/src/taipanstack/utils/cache.py +160 -0
  29. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/utils/concurrency.py +3 -3
  30. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/utils/filesystem.py +78 -220
  31. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/utils/logging.py +18 -18
  32. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/utils/rate_limit.py +28 -8
  33. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/utils/subprocess.py +9 -2
  34. taipanstack-0.4.2/src/taipanstack/resilience/adaptive/adaptive_timeout.py +0 -177
  35. taipanstack-0.4.2/src/taipanstack/security/models.py +0 -108
  36. taipanstack-0.4.2/src/taipanstack/utils/cache.py +0 -124
  37. {taipanstack-0.4.2 → taipanstack-0.4.4}/LICENSE +0 -0
  38. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/bridges/__init__.py +0 -0
  39. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/config/__init__.py +0 -0
  40. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/config/generators.py +0 -0
  41. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/config/models.py +0 -0
  42. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/config/version_config.py +0 -0
  43. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/core/__init__.py +0 -0
  44. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/core/compat.py +0 -0
  45. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/resilience/__init__.py +0 -0
  46. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/resilience/adaptive/__init__.py +0 -0
  47. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/resilience/adaptive/adaptive_retry.py +0 -0
  48. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/resilience/watchdogs/__init__.py +0 -0
  49. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/security/__init__.py +0 -0
  50. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/security/types.py +0 -0
  51. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/utils/__init__.py +0 -0
  52. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/utils/circuit_breaker.py +0 -0
  53. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/utils/context.py +0 -0
  54. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/utils/resilience.py +0 -0
  55. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/utils/retry.py +0 -0
  56. {taipanstack-0.4.2 → taipanstack-0.4.4}/src/taipanstack/utils/serialization.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: taipanstack
3
- Version: 0.4.2
3
+ Version: 0.4.4
4
4
  Summary: TaipanStack - Modular, secure, and scalable Python stack for robust development
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -56,13 +56,12 @@ Description-Content-Type: text/markdown
56
56
 
57
57
  <div align="center">
58
58
 
59
- # 🐍 TaipanStack
59
+ # 🐍 Taipan Stack
60
60
 
61
61
  ### **The Modern Python Foundation**
62
62
 
63
63
  *Launch secure, high-performance Python applications in seconds.*
64
64
 
65
- [![CI](https://github.com/gabrielima7/TaipanStack/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/gabrielima7/TaipanStack/actions/workflows/ci.yml)
66
65
  [![Python](https://img.shields.io/badge/Python-3.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-3776AB?style=flat&logo=python&logoColor=white)](https://www.python.org/)
67
66
  [![Coverage](https://img.shields.io/badge/Coverage-100%25-brightgreen?style=flat&logo=codecov)](https://github.com/gabrielima7/TaipanStack)
68
67
  [![Code Style](https://img.shields.io/badge/Code%20Style-Ruff-D7FF64?style=flat&logo=ruff&logoColor=black)](https://github.com/astral-sh/ruff)
@@ -81,16 +80,16 @@ Description-Content-Type: text/markdown
81
80
 
82
81
  ---
83
82
 
84
- ## ✨ Why TaipanStack?
83
+ ## ✨ Why Taipan Stack?
85
84
 
86
85
  > **"Write less, build better."**
87
86
 
88
- TaipanStack is a battle-tested foundation for production-grade Python projects that combines **security**, **performance**, and **developer experience** into a single, cohesive toolkit.
87
+ Taipan Stack is a battle-tested foundation for production-grade Python projects that combines **security**, **performance**, and **developer experience** into a single, cohesive toolkit.
89
88
 
90
- ### ✨ What's New in v0.4.0
91
- - **Taipan Bridges**: Native ASGI middleware integrations (Rate Limiting, Security Headers) out of the box.
92
- - **Adaptive Resilience**: Self-healing with AI-style failure thresholds and dynamic timeout tracking.
93
- - **Watchdogs**: Active CPU/Memory monitoring, background Health Checks, and Hot Reload of settings via Pydantic.
89
+ ### ✨ What's New in v0.4.3
90
+ - **Strict Static Typing**: Project-wide refactoring to eliminate all `Any` types, ensuring 100% type safety with `Mypy` strict mode.
91
+ - **SSRF & DoS Hardening**: Mitigates `urlparse` SSRF risks and algorithmic complexity DoS via bounded length and value validation.
92
+ - **Total Core Coverage**: Achieved true 100% branch and statement coverage in the core result module with 1,207 passing tests.
94
93
 
95
94
  <table>
96
95
  <tr>
@@ -128,7 +127,7 @@ TaipanStack is a battle-tested foundation for production-grade Python projects t
128
127
 
129
128
  ### 🔧 Developer Experience
130
129
  - Pre-configured quality tools
131
- - **100% code coverage** (1158 tests)
130
+ - **100% code coverage** (1207 tests)
132
131
  - Architecture enforcement
133
132
  - Hardened Docker template
134
133
 
@@ -170,7 +169,7 @@ make all
170
169
  ### Verify Installation
171
170
 
172
171
  ```bash
173
- # Run tests with 100% coverage (1158 tests)
172
+ # Run tests with 100% coverage (1207 tests)
174
173
  make test
175
174
 
176
175
  # Check architecture contracts
@@ -190,7 +189,7 @@ make benchmark
190
189
 
191
190
  ## 📐 Architecture
192
191
 
193
- TaipanStack follows a clean, layered architecture with strict dependency rules enforced by **Import Linter**.
192
+ Taipan Stack follows a clean, layered architecture with strict dependency rules enforced by **Import Linter**.
194
193
 
195
194
  ```
196
195
  ┌─────────────────────────────────────┐
@@ -225,7 +224,7 @@ TaipanStack/
225
224
  │ ├── config/ # ⚙️ Configuration models & generators
226
225
  │ ├── security/ # 🛡️ Guards, sanitizers, validators
227
226
  │ └── utils/ # 🔧 Logging, metrics, retry, filesystem
228
- ├── tests/ # ✅ 1158 tests, 100% coverage
227
+ ├── tests/ # ✅ 1207 tests, 100% coverage
229
228
  ├── .semgrep/ # 🔍 Custom SAST rules
230
229
  ├── .github/ # 🔄 CI/CD + SBOM/SLSA workflows
231
230
  ├── Dockerfile # 🐳 Hardened multi-stage container
@@ -236,7 +235,7 @@ TaipanStack/
236
235
 
237
236
  ## 🔐 DevSecOps
238
237
 
239
- TaipanStack integrates security and quality at every level:
238
+ Taipan Stack integrates security and quality at every level:
240
239
 
241
240
  | Category | Tools | Purpose |
242
241
  |----------|-------|---------|
@@ -304,7 +303,7 @@ safe_cmd = guard_command_injection(
304
303
  ### Retry with Exponential Backoff
305
304
 
306
305
  ```python
307
- from taipanstack.utils.retry import retry
306
+ from taipanstack.resilience.retry import retry
308
307
 
309
308
  @retry(max_attempts=3, on=(ConnectionError, TimeoutError))
310
309
  async def fetch_data(url: str) -> dict:
@@ -314,7 +313,7 @@ async def fetch_data(url: str) -> dict:
314
313
  ### Circuit Breaker
315
314
 
316
315
  ```python
317
- from taipanstack.utils.circuit_breaker import circuit_breaker
316
+ from taipanstack.resilience.circuit_breaker import circuit_breaker
318
317
 
319
318
  @circuit_breaker(failure_threshold=5, timeout=30)
320
319
  def call_external_service() -> Response:
@@ -325,7 +324,7 @@ def call_external_service() -> Response:
325
324
 
326
325
  ```python
327
326
  from taipanstack.core.result import safe, Ok, Err
328
- from taipanstack.utils.circuit_breaker import CircuitBreaker
327
+ from taipanstack.resilience.circuit_breaker import CircuitBreaker
329
328
 
330
329
  breaker = CircuitBreaker(failure_threshold=3, timeout=60, name="payments")
331
330
 
@@ -347,7 +346,7 @@ match result:
347
346
 
348
347
  ```python
349
348
  from taipanstack.core.result import safe, unwrap_or
350
- from taipanstack.utils.retry import retry
349
+ from taipanstack.resilience.retry import retry
351
350
 
352
351
  @retry(
353
352
  max_attempts=3,
@@ -368,7 +367,7 @@ profile = unwrap_or(fetch_user_profile("usr_456"), {"name": "Unknown"})
368
367
 
369
368
  ```python
370
369
  from taipanstack.core.result import Result, Ok, Err
371
- from taipanstack.resilience.adaptive import ResilienceOrchestrator, AdaptiveCircuitBreaker, AdaptiveTimeout
370
+ from taipanstack.resilience.adaptive import ResilienceOrchestrator, AdaptiveCircuitBreaker
372
371
  from taipanstack.resilience.retry import RetryConfig
373
372
 
374
373
  # Compose an intelligent pipeline: Bulkhead -> Breaker -> Retry -> Timeout -> Fallback
@@ -376,7 +375,6 @@ orch = (
376
375
  ResilienceOrchestrator("billing_api")
377
376
  .with_bulkhead(max_concurrent=10, max_queue=50) # Prevent resource exhaustion
378
377
  .with_circuit_breaker(AdaptiveCircuitBreaker("billing", target_error_rate=0.1)) # Auto-tunes thresholds
379
- .with_timeout(AdaptiveTimeout(min_timeout=1.0, max_timeout=10.0))
380
378
  .with_retry(RetryConfig(max_attempts=3, initial_delay=0.1))
381
379
  .with_fallback({"status": "unavailable"})
382
380
  )
@@ -400,10 +398,10 @@ async def get_user_data(user_id: int) -> Result[dict, Exception]:
400
398
  ### Fallbacks & Timeouts
401
399
 
402
400
  ```python
403
- from taipanstack.utils.resilience import fallback, timeout
401
+ from taipanstack.resilience.resilience import fallback, timeout
404
402
  from taipanstack.core.result import Result
405
403
 
406
- @fallback(fallback_value={"status": "offline"}, exceptions=(TimeoutError,))
404
+ @fallback({"status": "offline"}, exceptions=(TimeoutError,))
407
405
  @timeout(seconds=5.0)
408
406
  async def fetch_remote_status() -> Result[dict, Exception]:
409
407
  return await api.get_status()
@@ -1,12 +1,11 @@
1
1
  <div align="center">
2
2
 
3
- # 🐍 TaipanStack
3
+ # 🐍 Taipan Stack
4
4
 
5
5
  ### **The Modern Python Foundation**
6
6
 
7
7
  *Launch secure, high-performance Python applications in seconds.*
8
8
 
9
- [![CI](https://github.com/gabrielima7/TaipanStack/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/gabrielima7/TaipanStack/actions/workflows/ci.yml)
10
9
  [![Python](https://img.shields.io/badge/Python-3.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-3776AB?style=flat&logo=python&logoColor=white)](https://www.python.org/)
11
10
  [![Coverage](https://img.shields.io/badge/Coverage-100%25-brightgreen?style=flat&logo=codecov)](https://github.com/gabrielima7/TaipanStack)
12
11
  [![Code Style](https://img.shields.io/badge/Code%20Style-Ruff-D7FF64?style=flat&logo=ruff&logoColor=black)](https://github.com/astral-sh/ruff)
@@ -25,16 +24,16 @@
25
24
 
26
25
  ---
27
26
 
28
- ## ✨ Why TaipanStack?
27
+ ## ✨ Why Taipan Stack?
29
28
 
30
29
  > **"Write less, build better."**
31
30
 
32
- TaipanStack is a battle-tested foundation for production-grade Python projects that combines **security**, **performance**, and **developer experience** into a single, cohesive toolkit.
31
+ Taipan Stack is a battle-tested foundation for production-grade Python projects that combines **security**, **performance**, and **developer experience** into a single, cohesive toolkit.
33
32
 
34
- ### ✨ What's New in v0.4.0
35
- - **Taipan Bridges**: Native ASGI middleware integrations (Rate Limiting, Security Headers) out of the box.
36
- - **Adaptive Resilience**: Self-healing with AI-style failure thresholds and dynamic timeout tracking.
37
- - **Watchdogs**: Active CPU/Memory monitoring, background Health Checks, and Hot Reload of settings via Pydantic.
33
+ ### ✨ What's New in v0.4.3
34
+ - **Strict Static Typing**: Project-wide refactoring to eliminate all `Any` types, ensuring 100% type safety with `Mypy` strict mode.
35
+ - **SSRF & DoS Hardening**: Mitigates `urlparse` SSRF risks and algorithmic complexity DoS via bounded length and value validation.
36
+ - **Total Core Coverage**: Achieved true 100% branch and statement coverage in the core result module with 1,207 passing tests.
38
37
 
39
38
  <table>
40
39
  <tr>
@@ -72,7 +71,7 @@ TaipanStack is a battle-tested foundation for production-grade Python projects t
72
71
 
73
72
  ### 🔧 Developer Experience
74
73
  - Pre-configured quality tools
75
- - **100% code coverage** (1158 tests)
74
+ - **100% code coverage** (1207 tests)
76
75
  - Architecture enforcement
77
76
  - Hardened Docker template
78
77
 
@@ -114,7 +113,7 @@ make all
114
113
  ### Verify Installation
115
114
 
116
115
  ```bash
117
- # Run tests with 100% coverage (1158 tests)
116
+ # Run tests with 100% coverage (1207 tests)
118
117
  make test
119
118
 
120
119
  # Check architecture contracts
@@ -134,7 +133,7 @@ make benchmark
134
133
 
135
134
  ## 📐 Architecture
136
135
 
137
- TaipanStack follows a clean, layered architecture with strict dependency rules enforced by **Import Linter**.
136
+ Taipan Stack follows a clean, layered architecture with strict dependency rules enforced by **Import Linter**.
138
137
 
139
138
  ```
140
139
  ┌─────────────────────────────────────┐
@@ -169,7 +168,7 @@ TaipanStack/
169
168
  │ ├── config/ # ⚙️ Configuration models & generators
170
169
  │ ├── security/ # 🛡️ Guards, sanitizers, validators
171
170
  │ └── utils/ # 🔧 Logging, metrics, retry, filesystem
172
- ├── tests/ # ✅ 1158 tests, 100% coverage
171
+ ├── tests/ # ✅ 1207 tests, 100% coverage
173
172
  ├── .semgrep/ # 🔍 Custom SAST rules
174
173
  ├── .github/ # 🔄 CI/CD + SBOM/SLSA workflows
175
174
  ├── Dockerfile # 🐳 Hardened multi-stage container
@@ -180,7 +179,7 @@ TaipanStack/
180
179
 
181
180
  ## 🔐 DevSecOps
182
181
 
183
- TaipanStack integrates security and quality at every level:
182
+ Taipan Stack integrates security and quality at every level:
184
183
 
185
184
  | Category | Tools | Purpose |
186
185
  |----------|-------|---------|
@@ -248,7 +247,7 @@ safe_cmd = guard_command_injection(
248
247
  ### Retry with Exponential Backoff
249
248
 
250
249
  ```python
251
- from taipanstack.utils.retry import retry
250
+ from taipanstack.resilience.retry import retry
252
251
 
253
252
  @retry(max_attempts=3, on=(ConnectionError, TimeoutError))
254
253
  async def fetch_data(url: str) -> dict:
@@ -258,7 +257,7 @@ async def fetch_data(url: str) -> dict:
258
257
  ### Circuit Breaker
259
258
 
260
259
  ```python
261
- from taipanstack.utils.circuit_breaker import circuit_breaker
260
+ from taipanstack.resilience.circuit_breaker import circuit_breaker
262
261
 
263
262
  @circuit_breaker(failure_threshold=5, timeout=30)
264
263
  def call_external_service() -> Response:
@@ -269,7 +268,7 @@ def call_external_service() -> Response:
269
268
 
270
269
  ```python
271
270
  from taipanstack.core.result import safe, Ok, Err
272
- from taipanstack.utils.circuit_breaker import CircuitBreaker
271
+ from taipanstack.resilience.circuit_breaker import CircuitBreaker
273
272
 
274
273
  breaker = CircuitBreaker(failure_threshold=3, timeout=60, name="payments")
275
274
 
@@ -291,7 +290,7 @@ match result:
291
290
 
292
291
  ```python
293
292
  from taipanstack.core.result import safe, unwrap_or
294
- from taipanstack.utils.retry import retry
293
+ from taipanstack.resilience.retry import retry
295
294
 
296
295
  @retry(
297
296
  max_attempts=3,
@@ -312,7 +311,7 @@ profile = unwrap_or(fetch_user_profile("usr_456"), {"name": "Unknown"})
312
311
 
313
312
  ```python
314
313
  from taipanstack.core.result import Result, Ok, Err
315
- from taipanstack.resilience.adaptive import ResilienceOrchestrator, AdaptiveCircuitBreaker, AdaptiveTimeout
314
+ from taipanstack.resilience.adaptive import ResilienceOrchestrator, AdaptiveCircuitBreaker
316
315
  from taipanstack.resilience.retry import RetryConfig
317
316
 
318
317
  # Compose an intelligent pipeline: Bulkhead -> Breaker -> Retry -> Timeout -> Fallback
@@ -320,7 +319,6 @@ orch = (
320
319
  ResilienceOrchestrator("billing_api")
321
320
  .with_bulkhead(max_concurrent=10, max_queue=50) # Prevent resource exhaustion
322
321
  .with_circuit_breaker(AdaptiveCircuitBreaker("billing", target_error_rate=0.1)) # Auto-tunes thresholds
323
- .with_timeout(AdaptiveTimeout(min_timeout=1.0, max_timeout=10.0))
324
322
  .with_retry(RetryConfig(max_attempts=3, initial_delay=0.1))
325
323
  .with_fallback({"status": "unavailable"})
326
324
  )
@@ -344,10 +342,10 @@ async def get_user_data(user_id: int) -> Result[dict, Exception]:
344
342
  ### Fallbacks & Timeouts
345
343
 
346
344
  ```python
347
- from taipanstack.utils.resilience import fallback, timeout
345
+ from taipanstack.resilience.resilience import fallback, timeout
348
346
  from taipanstack.core.result import Result
349
347
 
350
- @fallback(fallback_value={"status": "offline"}, exceptions=(TimeoutError,))
348
+ @fallback({"status": "offline"}, exceptions=(TimeoutError,))
351
349
  @timeout(seconds=5.0)
352
350
  async def fetch_remote_status() -> Result[dict, Exception]:
353
351
  return await api.get_status()
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "taipanstack"
3
- version = "0.4.2"
3
+ version = "0.4.4"
4
4
  description = "TaipanStack - Modular, secure, and scalable Python stack for robust development"
5
5
  authors = [
6
6
  {name = "gabrielima7", email = "gabrielima.alu.lmb@gmail.com"}
@@ -84,18 +84,15 @@ dev = [
84
84
  "mypy (>=1.10.0)",
85
85
  "bandit (>=1.7.0)",
86
86
  "pre-commit (>=3.7.0)",
87
- "pytest (>=8.0.0)",
87
+ "pytest (>=9.0.3)",
88
88
  "pytest-cov (>=5.0.0)",
89
89
  "pytest-timeout (>=2.3.0)",
90
90
  "pytest-xdist (>=3.6.0)",
91
91
  "vulture (>=2.11)",
92
- "interrogate (>=1.5.0)",
93
- "hypothesis (>=6.100.0)",
94
92
  "polyfactory (>=2.0.0)",
95
93
  "structlog (>=25.5.0,<26.0.0)",
96
94
  "import-linter (>=2.1)",
97
95
  "gitingest (>=0.1.0)",
98
- "mutmut (>=3.0.0)",
99
96
  "pytest-benchmark (>=5.0.0)",
100
97
  "pytest-asyncio (>=0.23.0)",
101
98
  "radon (>=6.0.1,<7.0.0)",
@@ -107,6 +104,21 @@ dev = [
107
104
  # CVSS 1.9/10 Low - local attack vector only, no upstream patch available yet
108
105
  # Pinned to latest available; monitor for upstream fix in pygments >2.19.2
109
106
  "pygments (>=2.19.2)",
107
+ # Security note: CVE-2026-3219 affects pip 26.0.1 (confused install via concatenated tar+ZIP).
108
+ # CVSS Moderate - no pip fix published yet (expected in pip>=26.1).
109
+ # pip-audit ignores this CVE explicitly via --ignore-vuln in CI and Makefile.
110
+ # Monitor: https://github.com/pypa/pip/issues — Remove ignore once pip>=26.1 is available.
111
+ #
112
+ # Security note: PYSEC-2022-42969 affects py 1.11.0 (ReDoS via svn blame parsing).
113
+ # py is a transitive dependency of pytest with no upstream fix version published.
114
+ # Attack vector is local (requires attacker-controlled SVN output). Low real-world risk.
115
+ # pip-audit ignores this via --ignore-vuln in CI and Makefile.
116
+ # Monitor: https://github.com/pytest-dev/py/issues — Remove ignore if fix is published.
117
+ "hypothesis (>=6.151.12,<7.0.0)",
118
+ "authlib (>=1.6.11,<2.0.0)",
119
+ "cryptography (>=46.0.7,<47.0.0)",
120
+ "nltk (>=3.9.4,<4.0.0)",
121
+ "mutmut (>=3.0.0,<4.0.0)",
110
122
  ]
111
123
 
112
124
 
@@ -174,7 +186,7 @@ max-complexity = 10
174
186
  "src/taipanstack/resilience/*.py" = ["PLR0913", "D401", "S311", "TRY300", "TRY400"]
175
187
  "src/taipanstack/resilience/watchdogs/*.py" = ["PLR0913", "D401", "TRY300", "TRY400"]
176
188
  "src/taipanstack/resilience/adaptive/*.py" = ["PLR0913", "PLR0912", "D401", "TRY300", "TRY400"]
177
- "src/taipanstack/bridges/*.py" = ["PLR0913", "D401", "TRY300", "TRY400"]
189
+ "src/taipanstack/bridges/*.py" = ["PLR0913", "D401", "TRY300", "TRY400", "ANN401"]
178
190
 
179
191
  [tool.ruff.format]
180
192
  quote-style = "double"
@@ -214,6 +226,7 @@ warn_required_dynamic_aliases = true
214
226
  testpaths = ["tests"]
215
227
  addopts = "-v --strict-markers --timeout=30"
216
228
  asyncio_mode = "auto"
229
+ asyncio_default_fixture_loop_scope = "function"
217
230
  markers = [
218
231
  "slow: marks tests as slow (deselect with '-m \"not slow\"')",
219
232
  "security: marks tests as security-related",
@@ -258,16 +271,11 @@ min_confidence = 80
258
271
  paths = ["src"]
259
272
  exclude = ["tests"]
260
273
 
261
- [tool.interrogate]
262
- ignore-init-module = true
263
- ignore-private = true
264
- ignore-semiprivate = true
265
- fail-under = 80
266
- verbose = 1
267
274
 
268
275
  [tool.mutmut]
269
- paths_to_mutate = "src/taipanstack/security/sanitizers.py,src/taipanstack/security/validators.py,src/taipanstack/security/guards.py,src/taipanstack/resilience/retry.py,src/taipanstack/resilience/circuit_breaker.py"
270
- tests_dir = "tests/test_property_sanitizers.py,tests/test_security_validators.py,tests/test_security_guards.py,tests/test_security_ssrf.py,tests/test_utils_retry.py,tests/test_utils_circuit_breaker.py"
276
+ paths_to_mutate = ["src/taipanstack/security/sanitizers.py", "src/taipanstack/security/validators.py", "src/taipanstack/security/guards.py", "src/taipanstack/resilience/retry.py", "src/taipanstack/resilience/circuit_breaker.py"]
277
+ tests_dir = ["tests/test_property_sanitizers_operations_expected.py", "tests/test_security_validators_operations_expected.py", "tests/test_security_guards_operations_expected.py", "tests/test_security_ssrf_operations_expected.py", "tests/test_utils_retry_operations_expected.py", "tests/test_utils_circuit_breaker_operations_expected.py"]
278
+ also_copy = ["src/"]
271
279
  runner = "python -m pytest -x -q --tb=no --timeout=10 --no-cov"
272
280
  dict_synonyms = "Struct, NamedStruct"
273
281
 
@@ -5,7 +5,7 @@ A modular, secure, and scalable Python stack for robust development.
5
5
  Supports Python 3.11+ with version-aware optimizations for 3.13/3.14.
6
6
  """
7
7
 
8
- __version__ = "0.4.2"
8
+ __version__ = "0.4.4"
9
9
 
10
10
  from taipanstack.config.version_config import (
11
11
  VersionRecommendations,
@@ -7,7 +7,6 @@ that may or may not be installed at runtime.
7
7
 
8
8
  import importlib
9
9
  import types
10
- from typing import Any
11
10
 
12
11
  from taipanstack.core.result import Err, Ok, Result
13
12
 
@@ -51,7 +50,7 @@ def require_dependency(
51
50
  def get_attr_or_err(
52
51
  module: types.ModuleType,
53
52
  name: str,
54
- ) -> Result[Any, AttributeError]:
53
+ ) -> Result[object, AttributeError]:
55
54
  """Safely access an attribute from a module.
56
55
 
57
56
  Args:
@@ -9,7 +9,7 @@ from __future__ import annotations
9
9
 
10
10
  import asyncio
11
11
  import logging
12
- from typing import Any
12
+ from typing import TYPE_CHECKING
13
13
 
14
14
  from taipanstack.core.result import Err, Ok, Result
15
15
  from taipanstack.resilience.circuit_breaker import (
@@ -33,12 +33,16 @@ except ImportError: # pragma: no cover
33
33
  _HAS_SQLALCHEMY = False
34
34
 
35
35
  try:
36
- import redis.asyncio as aioredis # noqa: F401
36
+ import redis.asyncio as aioredis
37
37
 
38
38
  _HAS_REDIS = True # pragma: no cover
39
39
  except ImportError: # pragma: no cover
40
40
  _HAS_REDIS = False
41
41
 
42
+ if TYPE_CHECKING:
43
+ import redis.asyncio as aioredis
44
+ from sqlalchemy.ext.asyncio import AsyncEngine
45
+
42
46
 
43
47
  def _breaker_is_open(cb: CircuitBreaker) -> CircuitBreakerError | None:
44
48
  """Return a ``CircuitBreakerError`` if the breaker is OPEN.
@@ -74,7 +78,7 @@ class ResilientDatabase:
74
78
 
75
79
  def __init__(
76
80
  self,
77
- engine: Any,
81
+ engine: AsyncEngine,
78
82
  *,
79
83
  circuit_breaker: CircuitBreaker | None = None,
80
84
  retry_config: RetryConfig | None = None,
@@ -91,11 +95,42 @@ class ResilientDatabase:
91
95
  self._circuit_breaker = circuit_breaker
92
96
  self._retry_config = retry_config
93
97
 
98
+ async def _execute_loop(
99
+ self,
100
+ statement: object,
101
+ max_attempts: int,
102
+ **kwargs: object,
103
+ ) -> Result[object, Exception]:
104
+ """Execute the retry loop for database operations."""
105
+ last_error: Exception | None = None
106
+
107
+ for attempt in range(1, max_attempts + 1):
108
+ try:
109
+ async with AsyncSession(self._engine) as session:
110
+ result = await session.execute(statement, **kwargs)
111
+ return Ok(result)
112
+ except Exception as exc:
113
+ last_error = exc
114
+ logger.warning(
115
+ "DB execute attempt %d failed: %s",
116
+ attempt,
117
+ exc,
118
+ )
119
+ if self._circuit_breaker is not None:
120
+ self._circuit_breaker._record_failure(exc)
121
+ if self._retry_config is not None and attempt < max_attempts:
122
+ delay = calculate_delay(attempt, self._retry_config)
123
+ await asyncio.sleep(min(delay, 3600.0))
124
+ continue
125
+ break
126
+
127
+ return Err(last_error or RuntimeError("Database execute failed"))
128
+
94
129
  async def execute(
95
130
  self,
96
- statement: Any,
97
- **kwargs: Any,
98
- ) -> Result[Any, Exception]:
131
+ statement: object,
132
+ **kwargs: object,
133
+ ) -> Result[object, Exception]:
99
134
  """Execute a SQL statement with resilience.
100
135
 
101
136
  Args:
@@ -124,29 +159,7 @@ class ResilientDatabase:
124
159
  if self._retry_config is not None:
125
160
  max_attempts = self._retry_config.max_attempts
126
161
 
127
- last_error: Exception | None = None
128
-
129
- for attempt in range(1, max_attempts + 1):
130
- try:
131
- async with AsyncSession(self._engine) as session:
132
- result = await session.execute(statement, **kwargs)
133
- return Ok(result)
134
- except Exception as exc:
135
- last_error = exc
136
- logger.warning(
137
- "DB execute attempt %d failed: %s",
138
- attempt,
139
- exc,
140
- )
141
- if self._circuit_breaker is not None:
142
- self._circuit_breaker._record_failure(exc)
143
- if self._retry_config is not None and attempt < max_attempts:
144
- delay = calculate_delay(attempt, self._retry_config)
145
- await asyncio.sleep(delay)
146
- continue
147
- break
148
-
149
- return Err(last_error or RuntimeError("Database execute failed"))
162
+ return await self._execute_loop(statement, max_attempts, **kwargs)
150
163
 
151
164
  async def health_check(self) -> Result[bool, Exception]:
152
165
  """Check database connectivity.
@@ -183,7 +196,7 @@ class ResilientRedis:
183
196
 
184
197
  def __init__(
185
198
  self,
186
- client: Any,
199
+ client: aioredis.Redis[bytes | str],
187
200
  *,
188
201
  circuit_breaker: CircuitBreaker | None = None,
189
202
  ) -> None:
@@ -200,8 +213,8 @@ class ResilientRedis:
200
213
  async def execute(
201
214
  self,
202
215
  command: str,
203
- *args: Any,
204
- ) -> Result[Any, Exception]:
216
+ *args: object,
217
+ ) -> Result[object, Exception]:
205
218
  """Execute a Redis command with resilience.
206
219
 
207
220
  Args: