taipanstack 0.4.3__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 (54) hide show
  1. {taipanstack-0.4.3 → taipanstack-0.4.4}/PKG-INFO +17 -19
  2. {taipanstack-0.4.3 → taipanstack-0.4.4}/README.md +16 -18
  3. {taipanstack-0.4.3 → taipanstack-0.4.4}/pyproject.toml +17 -11
  4. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/__init__.py +1 -1
  5. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/bridges/http_bridge.py +6 -5
  6. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/core/optimizations.py +33 -27
  7. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/resilience/adaptive/orchestrator.py +10 -17
  8. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/resilience/circuit_breaker.py +85 -52
  9. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/resilience/resilience.py +7 -4
  10. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/resilience/retry.py +51 -4
  11. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/resilience/watchdogs/config_watcher.py +40 -22
  12. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/resilience/watchdogs/resource_watcher.py +2 -2
  13. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/security/guards.py +114 -56
  14. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/security/jwt.py +13 -2
  15. taipanstack-0.4.4/src/taipanstack/security/models.py +184 -0
  16. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/security/sanitizers.py +81 -71
  17. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/security/validators.py +40 -27
  18. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/utils/cache.py +39 -14
  19. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/utils/concurrency.py +3 -3
  20. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/utils/rate_limit.py +4 -3
  21. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/utils/subprocess.py +2 -2
  22. taipanstack-0.4.3/src/taipanstack/security/models.py +0 -110
  23. {taipanstack-0.4.3 → taipanstack-0.4.4}/LICENSE +0 -0
  24. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/bridges/__init__.py +0 -0
  25. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/bridges/_imports.py +0 -0
  26. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/bridges/db_bridge.py +0 -0
  27. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/bridges/web_bridge.py +0 -0
  28. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/config/__init__.py +0 -0
  29. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/config/generators.py +0 -0
  30. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/config/models.py +0 -0
  31. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/config/version_config.py +0 -0
  32. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/core/__init__.py +0 -0
  33. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/core/compat.py +0 -0
  34. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/core/result.py +0 -0
  35. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/resilience/__init__.py +0 -0
  36. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/resilience/adaptive/__init__.py +0 -0
  37. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/resilience/adaptive/adaptive_breaker.py +0 -0
  38. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/resilience/adaptive/adaptive_retry.py +0 -0
  39. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/resilience/adaptive/bulkhead.py +0 -0
  40. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/resilience/watchdogs/__init__.py +0 -0
  41. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/resilience/watchdogs/_base.py +0 -0
  42. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/resilience/watchdogs/health_pinger.py +0 -0
  43. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/security/__init__.py +0 -0
  44. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/security/decorators.py +0 -0
  45. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/security/password.py +0 -0
  46. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/security/types.py +0 -0
  47. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/utils/__init__.py +0 -0
  48. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/utils/circuit_breaker.py +0 -0
  49. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/utils/context.py +0 -0
  50. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/utils/filesystem.py +0 -0
  51. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/utils/logging.py +0 -0
  52. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/utils/resilience.py +0 -0
  53. {taipanstack-0.4.3 → taipanstack-0.4.4}/src/taipanstack/utils/retry.py +0 -0
  54. {taipanstack-0.4.3 → 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.3
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
89
  ### ✨ What's New in v0.4.3
91
90
  - **Strict Static Typing**: Project-wide refactoring to eliminate all `Any` types, ensuring 100% type safety with `Mypy` strict mode.
92
91
  - **SSRF & DoS Hardening**: Mitigates `urlparse` SSRF risks and algorithmic complexity DoS via bounded length and value validation.
93
- - **Total Core Coverage**: Achieved true 100% branch and statement coverage in the core result module with 1,205 passing tests.
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** (1205 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 (1205 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/ # ✅ 1205 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
33
  ### ✨ What's New in v0.4.3
35
34
  - **Strict Static Typing**: Project-wide refactoring to eliminate all `Any` types, ensuring 100% type safety with `Mypy` strict mode.
36
35
  - **SSRF & DoS Hardening**: Mitigates `urlparse` SSRF risks and algorithmic complexity DoS via bounded length and value validation.
37
- - **Total Core Coverage**: Achieved true 100% branch and statement coverage in the core result module with 1,205 passing tests.
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** (1205 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 (1205 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/ # ✅ 1205 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.3"
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,17 +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
92
  "polyfactory (>=2.0.0)",
94
93
  "structlog (>=25.5.0,<26.0.0)",
95
94
  "import-linter (>=2.1)",
96
95
  "gitingest (>=0.1.0)",
97
- "mutmut (>=3.0.0)",
98
96
  "pytest-benchmark (>=5.0.0)",
99
97
  "pytest-asyncio (>=0.23.0)",
100
98
  "radon (>=6.0.1,<7.0.0)",
@@ -106,7 +104,21 @@ dev = [
106
104
  # CVSS 1.9/10 Low - local attack vector only, no upstream patch available yet
107
105
  # Pinned to latest available; monitor for upstream fix in pygments >2.19.2
108
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.
109
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
 
@@ -259,16 +271,10 @@ min_confidence = 80
259
271
  paths = ["src"]
260
272
  exclude = ["tests"]
261
273
 
262
- [tool.interrogate]
263
- ignore-init-module = true
264
- ignore-private = true
265
- ignore-semiprivate = true
266
- fail-under = 80
267
- verbose = 1
268
274
 
269
275
  [tool.mutmut]
270
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"]
271
- 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"]
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"]
272
278
  also_copy = ["src/"]
273
279
  runner = "python -m pytest -x -q --tb=no --timeout=10 --no-cov"
274
280
  dict_synonyms = "Struct, NamedStruct"
@@ -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.3"
8
+ __version__ = "0.4.4"
9
9
 
10
10
  from taipanstack.config.version_config import (
11
11
  VersionRecommendations,
@@ -11,7 +11,7 @@ from __future__ import annotations
11
11
  import asyncio
12
12
  import logging
13
13
  from collections.abc import Awaitable, Callable, Mapping, Sequence
14
- from typing import TYPE_CHECKING
14
+ from typing import TYPE_CHECKING, Any, cast
15
15
 
16
16
  from typing_extensions import TypedDict, Unpack
17
17
 
@@ -196,7 +196,8 @@ async def _execute_with_retries(
196
196
  attempt,
197
197
  max_attempts,
198
198
  ):
199
- delay = calculate_delay(attempt, retry_config) # type: ignore[arg-type]
199
+ # Config is not None if we reach here
200
+ delay = calculate_delay(attempt, cast(RetryConfig, retry_config))
200
201
  await asyncio.sleep(min(delay, 3600.0))
201
202
  continue
202
203
  return Ok(response)
@@ -260,7 +261,7 @@ async def safe_request(
260
261
 
261
262
  async def _do_request() -> httpx.Response:
262
263
  async with httpx.AsyncClient(timeout=timeout) as client: # nosemgrep
263
- response = await client.request(method, url, **kwargs) # type: ignore[arg-type]
264
+ response = await client.request(method, url, **cast(dict[str, Any], kwargs))
264
265
  return response
265
266
 
266
267
  return await _execute_with_retries(
@@ -377,8 +378,8 @@ class SafeHttpClient:
377
378
 
378
379
  async def _do_request() -> httpx.Response:
379
380
  # We explicitly verified client is not None above
380
- client: httpx.AsyncClient = self._client # type: ignore[assignment]
381
- response = await client.request(method, url, **kwargs) # type: ignore[arg-type]
381
+ client: httpx.AsyncClient = cast(httpx.AsyncClient, self._client)
382
+ response = await client.request(method, url, **cast(dict[str, Any], kwargs))
382
383
  return response
383
384
 
384
385
  return await _execute_with_retries(
@@ -175,6 +175,37 @@ _PROFILE_314 = OptimizationProfile(
175
175
  _cached_optimization_profile: OptimizationProfile | None = None
176
176
 
177
177
 
178
+ def _get_base_profile() -> OptimizationProfile:
179
+ """Select base profile by version."""
180
+ if PY314:
181
+ return _PROFILE_314
182
+ if PY313:
183
+ return _PROFILE_313
184
+ if PY312:
185
+ return _PROFILE_312
186
+ return _PROFILE_311
187
+
188
+
189
+ def _build_aggressive_profile(profile: OptimizationProfile) -> OptimizationProfile:
190
+ """Build an aggressive optimization profile with experimental features."""
191
+ return OptimizationProfile(
192
+ gc_threshold_0=profile.gc_threshold_0,
193
+ gc_threshold_1=profile.gc_threshold_1,
194
+ gc_threshold_2=profile.gc_threshold_2,
195
+ gc_freeze_enabled=profile.gc_freeze_enabled,
196
+ thread_pool_multiplier=profile.thread_pool_multiplier,
197
+ max_thread_pool_size=profile.max_thread_pool_size,
198
+ prefer_slots=profile.prefer_slots,
199
+ use_frozen_dataclasses=profile.use_frozen_dataclasses,
200
+ prefer_match_statements=profile.prefer_match_statements,
201
+ prefer_exception_groups=profile.prefer_exception_groups,
202
+ prefer_type_params=profile.prefer_type_params,
203
+ enable_perf_hints=profile.enable_perf_hints,
204
+ aggressive_inlining=profile.aggressive_inlining,
205
+ enable_experimental=True,
206
+ )
207
+
208
+
178
209
  def get_optimization_profile(*, force_refresh: bool = False) -> OptimizationProfile:
179
210
  """Get the optimization profile for the current Python version.
180
211
 
@@ -194,39 +225,14 @@ def get_optimization_profile(*, force_refresh: bool = False) -> OptimizationProf
194
225
  experimental = is_experimental_enabled(force_refresh=force_refresh)
195
226
  opt_level = get_optimization_level(force_refresh=force_refresh)
196
227
 
197
- # Select base profile by version
198
- if PY314:
199
- profile = _PROFILE_314
200
- elif PY313:
201
- profile = _PROFILE_313
202
- elif PY312:
203
- profile = _PROFILE_312
204
- else:
205
- profile = _PROFILE_311
228
+ profile = _get_base_profile()
206
229
 
207
230
  # Adjust for optimization level
208
231
  match opt_level:
209
232
  case opt if opt == OPT_LEVEL_NONE:
210
- # Minimal optimizations - use 3.11 baseline
211
233
  _cached_optimization_profile = _PROFILE_311
212
234
  case opt if opt == OPT_LEVEL_AGGRESSIVE and experimental:
213
- # Aggressive mode - enable experimental features
214
- _cached_optimization_profile = OptimizationProfile(
215
- gc_threshold_0=profile.gc_threshold_0,
216
- gc_threshold_1=profile.gc_threshold_1,
217
- gc_threshold_2=profile.gc_threshold_2,
218
- gc_freeze_enabled=profile.gc_freeze_enabled,
219
- thread_pool_multiplier=profile.thread_pool_multiplier,
220
- max_thread_pool_size=profile.max_thread_pool_size,
221
- prefer_slots=profile.prefer_slots,
222
- use_frozen_dataclasses=profile.use_frozen_dataclasses,
223
- prefer_match_statements=profile.prefer_match_statements,
224
- prefer_exception_groups=profile.prefer_exception_groups,
225
- prefer_type_params=profile.prefer_type_params,
226
- enable_perf_hints=profile.enable_perf_hints,
227
- aggressive_inlining=profile.aggressive_inlining,
228
- enable_experimental=True,
229
- )
235
+ _cached_optimization_profile = _build_aggressive_profile(profile)
230
236
  case _:
231
237
  _cached_optimization_profile = profile
232
238
 
@@ -273,40 +273,33 @@ class ResilienceOrchestrator(Generic[T]):
273
273
  *args: P.args,
274
274
  **kwargs: P.kwargs,
275
275
  ) -> Result[T, Exception]:
276
- """Execute through breaker → retry → timeout → fn layers.
277
-
278
- Args:
279
- fn: Async callable.
280
- *args: Positional arguments.
281
- **kwargs: Keyword arguments.
282
-
283
- Returns:
284
- ``Ok(result)`` or ``Err`` with fallback applied if configured.
285
-
286
- """
287
- # Layer 2: Circuit breaker gate
276
+ """Execute through breaker → retry → timeout → fn layers."""
288
277
  cb_err = self._evaluate_circuit_breaker()
289
278
  if cb_err is not None:
290
279
  return self._apply_fallback(cb_err)
291
280
 
292
- # Layer 3: Retry
293
281
  max_attempts = (
294
282
  self._retry_config.max_attempts if self._retry_config is not None else 1
295
283
  )
296
- last_error: Exception | None = None
284
+ return await self._execute_with_retries(max_attempts, fn, *args, **kwargs)
297
285
 
286
+ async def _execute_with_retries(
287
+ self,
288
+ max_attempts: int,
289
+ fn: Callable[P, Awaitable[T]],
290
+ *args: P.args,
291
+ **kwargs: P.kwargs,
292
+ ) -> Result[T, Exception]:
293
+ last_error: Exception | None = None
298
294
  for attempt in range(1, max_attempts + 1):
299
295
  result = await self._execute_with_timeout(fn, *args, **kwargs)
300
-
301
296
  match result:
302
297
  case Ok():
303
298
  self._record_success_outcome(attempt)
304
299
  return result
305
-
306
300
  case Err(error):
307
301
  last_error = error
308
302
  self._record_failure_outcome(error, attempt)
309
-
310
303
  if self._retry_config is not None and attempt < max_attempts:
311
304
  delay = self._calculate_retry_delay(attempt)
312
305
  await asyncio.sleep(min(delay, 3600.0))