taipanstack 0.5.1__tar.gz → 0.5.3__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 (53) hide show
  1. {taipanstack-0.5.1 → taipanstack-0.5.3}/PKG-INFO +12 -11
  2. {taipanstack-0.5.1 → taipanstack-0.5.3}/README.md +11 -10
  3. {taipanstack-0.5.1 → taipanstack-0.5.3}/pyproject.toml +3 -1
  4. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/__init__.py +1 -1
  5. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/bridges/_imports.py +2 -2
  6. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/bridges/db_bridge.py +8 -8
  7. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/bridges/http_bridge.py +28 -12
  8. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/bridges/web_bridge.py +2 -2
  9. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/config/models.py +3 -2
  10. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/core/optimizations.py +2 -2
  11. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/core/result.py +2 -1
  12. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/resilience/adaptive/adaptive_retry.py +1 -1
  13. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/resilience/adaptive/bulkhead.py +4 -4
  14. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/resilience/adaptive/orchestrator.py +122 -57
  15. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/resilience/circuit_breaker.py +170 -79
  16. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/resilience/resilience.py +26 -12
  17. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/resilience/retry.py +74 -18
  18. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/resilience/watchdogs/config_watcher.py +42 -20
  19. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/resilience/watchdogs/resource_watcher.py +5 -5
  20. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/security/decorators.py +1 -1
  21. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/security/guards.py +29 -18
  22. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/security/jwt.py +6 -0
  23. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/security/models.py +27 -14
  24. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/security/sanitizers.py +9 -121
  25. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/security/validators.py +7 -3
  26. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/utils/cache.py +8 -4
  27. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/utils/concurrency.py +4 -2
  28. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/utils/filesystem.py +2 -2
  29. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/utils/logging.py +64 -21
  30. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/utils/rate_limit.py +4 -2
  31. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/utils/subprocess.py +1 -1
  32. {taipanstack-0.5.1 → taipanstack-0.5.3}/LICENSE +0 -0
  33. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/bridges/__init__.py +0 -0
  34. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/config/__init__.py +0 -0
  35. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/config/generators.py +0 -0
  36. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/config/version_config.py +0 -0
  37. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/core/__init__.py +0 -0
  38. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/core/compat.py +0 -0
  39. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/resilience/__init__.py +0 -0
  40. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/resilience/adaptive/__init__.py +0 -0
  41. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/resilience/adaptive/adaptive_breaker.py +0 -0
  42. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/resilience/watchdogs/__init__.py +0 -0
  43. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/resilience/watchdogs/_base.py +0 -0
  44. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/resilience/watchdogs/health_pinger.py +0 -0
  45. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/security/__init__.py +0 -0
  46. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/security/password.py +0 -0
  47. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/security/types.py +0 -0
  48. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/utils/__init__.py +0 -0
  49. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/utils/circuit_breaker.py +0 -0
  50. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/utils/context.py +0 -0
  51. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/utils/resilience.py +0 -0
  52. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/utils/retry.py +0 -0
  53. {taipanstack-0.5.1 → taipanstack-0.5.3}/src/taipanstack/utils/serialization.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: taipanstack
3
- Version: 0.5.1
3
+ Version: 0.5.3
4
4
  Summary: TaipanStack - Modular, secure, and scalable Python stack for robust development
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -58,6 +58,7 @@ Description-Content-Type: text/markdown
58
58
  <div align="center">
59
59
 
60
60
  # 🐍 Taipan Stack
61
+ [![CI](https://img.shields.io/github/actions/workflow/status/gabrielima7/TaipanStack/ci-push-validate.yml?branch=main)](https://github.com/gabrielima7/TaipanStack/actions/workflows/ci-push-validate.yml)
61
62
 
62
63
  ### **The Modern Python Foundation**
63
64
 
@@ -75,7 +76,7 @@ Description-Content-Type: text/markdown
75
76
 
76
77
  ---
77
78
 
78
- [**Features**](#-features) • [**Quick Start**](#-quick-start) • [**Architecture**](#-architecture) • [**DevSecOps**](#-devsecops) • [**API**](#-api-highlights) • [**Contributing**](#-contributing)
79
+ [**Features**](#-why-taipan-stack) • [**Quick Start**](#-quick-start) • [**Architecture**](#-architecture) • [**DevSecOps**](#-devsecops) • [**API**](#-api-highlights) • [**Contributing**](#-contributing)
79
80
 
80
81
  </div>
81
82
 
@@ -87,11 +88,11 @@ Description-Content-Type: text/markdown
87
88
 
88
89
  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
90
 
90
- ### ✨ What's New in v0.5.1
91
- - **Security & DoS Hardening**: Enforced configuration file size limits in config watcher (PR #807) and input length bounds on sanitizers (PR #801) to prevent Denial of Service; updated Starlette to `1.0.1` to resolve PYSEC-2026-161 (PR #804).
92
- - **Resilience Enhancements**: Checked circuit breaker status inside the orchestrator's retry execution loop (PR #783) and hardened resilience decorators against type mutations under chaos (PR #795, #800, #802, #803).
93
- - **Complexity & Refactoring**: Reduced complexity in rate limiter, circuit breakers, and security guards (PR #786, #798, #805); removed PyApp configuration (PR #784) and dead compatibility logic (PR #788).
94
- - **QA Suite Standardization**: Standardized test naming convention (`test_*.py`) and removed code/test suite bypasses, expanding to **1,250 passing tests** with 100% genuine code and branch coverage (PR #797, #808).
91
+ ### ✨ What's New in v0.5.3
92
+ - **Security Fixes & Hardening**: Fixed file descriptor leaks in `safe_write` on `BaseException` (PR #838). Hardened retry, fallback, and circuit breaker decorators/classes against runtime type mutations, clock jumps, and NaN state poisoning under chaos injection (PR #852, #853, #842, #856, #839, #864).
93
+ - **Complexity Refactor**: Reduced cyclomatic and cognitive complexity in orchestrators, circuit breakers, and logging/retry utils (PR #862, #844, #866).
94
+ - **QA & Test Count**: Standardized test naming conventions (PR #847), expanded test coverage to 100% genuine code and branch coverage across core components, verifying **1,344 passing tests** (PR #843, #857, #850).
95
+ - **Documentation & CI/CD**: Cleaned up dead references and links (PR #854, #851), updated watchdogs code examples (PR #867), and synchronized CI badges (PR #863).
95
96
 
96
97
  <table>
97
98
  <tr>
@@ -128,7 +129,7 @@ Taipan Stack is a battle-tested foundation for production-grade Python projects
128
129
 
129
130
  ### 🔧 Developer Experience
130
131
  - Pre-configured quality tools
131
- - **100% code coverage** (1,250 tests)
132
+ - **100% code coverage** (1,344 tests)
132
133
  - Architecture enforcement
133
134
  - Hardened Docker template
134
135
 
@@ -170,7 +171,7 @@ make all
170
171
  ### Verify Installation
171
172
 
172
173
  ```bash
173
- # Run tests with 100% coverage (1,250 tests)
174
+ # Run tests with 100% coverage (1,344 tests)
174
175
  make test
175
176
 
176
177
  # Check architecture contracts
@@ -223,7 +224,7 @@ TaipanStack/
223
224
  │ ├── config/ # ⚙️ Configuration models & generators
224
225
  │ ├── security/ # 🛡️ Guards, sanitizers, validators
225
226
  │ └── utils/ # 🔧 Logging, metrics, retry, filesystem
226
- ├── tests/ # ✅ 1,250 tests, 100% coverage
227
+ ├── tests/ # ✅ 1,344 tests, 100% coverage
227
228
  ├── .semgrep/ # 🔍 Custom SAST rules
228
229
  ├── .github/ # 🔄 CI/CD + SBOM/SLSA workflows
229
230
  ├── Dockerfile # 🐳 Hardened multi-stage container
@@ -484,7 +485,7 @@ This project is open-sourced under the [MIT License](LICENSE).
484
485
 
485
486
  **Made with ❤️ for the Python community**
486
487
 
487
- [⬆ Back to Top](#-taipanstack)
488
+ [⬆ Back to Top](#-taipan-stack)
488
489
 
489
490
  </div>
490
491
 
@@ -1,6 +1,7 @@
1
1
  <div align="center">
2
2
 
3
3
  # 🐍 Taipan Stack
4
+ [![CI](https://img.shields.io/github/actions/workflow/status/gabrielima7/TaipanStack/ci-push-validate.yml?branch=main)](https://github.com/gabrielima7/TaipanStack/actions/workflows/ci-push-validate.yml)
4
5
 
5
6
  ### **The Modern Python Foundation**
6
7
 
@@ -18,7 +19,7 @@
18
19
 
19
20
  ---
20
21
 
21
- [**Features**](#-features) • [**Quick Start**](#-quick-start) • [**Architecture**](#-architecture) • [**DevSecOps**](#-devsecops) • [**API**](#-api-highlights) • [**Contributing**](#-contributing)
22
+ [**Features**](#-why-taipan-stack) • [**Quick Start**](#-quick-start) • [**Architecture**](#-architecture) • [**DevSecOps**](#-devsecops) • [**API**](#-api-highlights) • [**Contributing**](#-contributing)
22
23
 
23
24
  </div>
24
25
 
@@ -30,11 +31,11 @@
30
31
 
31
32
  Taipan Stack is a battle-tested foundation for production-grade Python projects that combines **security**, **performance**, and **developer experience** into a single, cohesive toolkit.
32
33
 
33
- ### ✨ What's New in v0.5.1
34
- - **Security & DoS Hardening**: Enforced configuration file size limits in config watcher (PR #807) and input length bounds on sanitizers (PR #801) to prevent Denial of Service; updated Starlette to `1.0.1` to resolve PYSEC-2026-161 (PR #804).
35
- - **Resilience Enhancements**: Checked circuit breaker status inside the orchestrator's retry execution loop (PR #783) and hardened resilience decorators against type mutations under chaos (PR #795, #800, #802, #803).
36
- - **Complexity & Refactoring**: Reduced complexity in rate limiter, circuit breakers, and security guards (PR #786, #798, #805); removed PyApp configuration (PR #784) and dead compatibility logic (PR #788).
37
- - **QA Suite Standardization**: Standardized test naming convention (`test_*.py`) and removed code/test suite bypasses, expanding to **1,250 passing tests** with 100% genuine code and branch coverage (PR #797, #808).
34
+ ### ✨ What's New in v0.5.3
35
+ - **Security Fixes & Hardening**: Fixed file descriptor leaks in `safe_write` on `BaseException` (PR #838). Hardened retry, fallback, and circuit breaker decorators/classes against runtime type mutations, clock jumps, and NaN state poisoning under chaos injection (PR #852, #853, #842, #856, #839, #864).
36
+ - **Complexity Refactor**: Reduced cyclomatic and cognitive complexity in orchestrators, circuit breakers, and logging/retry utils (PR #862, #844, #866).
37
+ - **QA & Test Count**: Standardized test naming conventions (PR #847), expanded test coverage to 100% genuine code and branch coverage across core components, verifying **1,344 passing tests** (PR #843, #857, #850).
38
+ - **Documentation & CI/CD**: Cleaned up dead references and links (PR #854, #851), updated watchdogs code examples (PR #867), and synchronized CI badges (PR #863).
38
39
 
39
40
  <table>
40
41
  <tr>
@@ -71,7 +72,7 @@ Taipan Stack is a battle-tested foundation for production-grade Python projects
71
72
 
72
73
  ### 🔧 Developer Experience
73
74
  - Pre-configured quality tools
74
- - **100% code coverage** (1,250 tests)
75
+ - **100% code coverage** (1,344 tests)
75
76
  - Architecture enforcement
76
77
  - Hardened Docker template
77
78
 
@@ -113,7 +114,7 @@ make all
113
114
  ### Verify Installation
114
115
 
115
116
  ```bash
116
- # Run tests with 100% coverage (1,250 tests)
117
+ # Run tests with 100% coverage (1,344 tests)
117
118
  make test
118
119
 
119
120
  # Check architecture contracts
@@ -166,7 +167,7 @@ TaipanStack/
166
167
  │ ├── config/ # ⚙️ Configuration models & generators
167
168
  │ ├── security/ # 🛡️ Guards, sanitizers, validators
168
169
  │ └── utils/ # 🔧 Logging, metrics, retry, filesystem
169
- ├── tests/ # ✅ 1,250 tests, 100% coverage
170
+ ├── tests/ # ✅ 1,344 tests, 100% coverage
170
171
  ├── .semgrep/ # 🔍 Custom SAST rules
171
172
  ├── .github/ # 🔄 CI/CD + SBOM/SLSA workflows
172
173
  ├── Dockerfile # 🐳 Hardened multi-stage container
@@ -427,6 +428,6 @@ This project is open-sourced under the [MIT License](LICENSE).
427
428
 
428
429
  **Made with ❤️ for the Python community**
429
430
 
430
- [⬆ Back to Top](#-taipanstack)
431
+ [⬆ Back to Top](#-taipan-stack)
431
432
 
432
433
  </div>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "taipanstack"
3
- version = "0.5.1"
3
+ version = "0.5.3"
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"}
@@ -104,6 +104,7 @@ dev = [
104
104
  "authlib (>=1.6.11,<2.0.0)",
105
105
  "cryptography (>=46.0.7,<49.0.0)",
106
106
  "mutmut (>=3.0.0,<4.0.0)",
107
+ "mkdocs-material (>=9.7.6,<10.0.0)",
107
108
  ]
108
109
 
109
110
  docs = [
@@ -197,6 +198,7 @@ plugins = ["pydantic.mypy"]
197
198
  [[tool.mypy.overrides]]
198
199
  module = [
199
200
  "mutmut.*",
201
+ "tests.*",
200
202
  ]
201
203
  ignore_missing_imports = true
202
204
  ignore_errors = true
@@ -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.5.1"
8
+ __version__ = "0.5.3"
9
9
 
10
10
  from taipanstack.config.version_config import (
11
11
  VersionRecommendations,
@@ -42,8 +42,8 @@ def require_dependency(
42
42
  return Err(
43
43
  ImportError(
44
44
  f"'{module_name}' is required but not installed. "
45
- f"Install with: {install_hint}"
46
- )
45
+ f"Install with: {install_hint}",
46
+ ),
47
47
  )
48
48
 
49
49
 
@@ -11,6 +11,10 @@ import asyncio
11
11
  import logging
12
12
  from typing import TYPE_CHECKING
13
13
 
14
+ if TYPE_CHECKING:
15
+ import redis.asyncio as aioredis
16
+ from sqlalchemy.ext.asyncio import AsyncEngine
17
+
14
18
  from taipanstack.core.result import Err, Ok, Result
15
19
  from taipanstack.resilience.circuit_breaker import (
16
20
  CircuitBreaker,
@@ -39,10 +43,6 @@ try:
39
43
  except ImportError:
40
44
  _HAS_REDIS = False
41
45
 
42
- if TYPE_CHECKING:
43
- import redis.asyncio as aioredis
44
- from sqlalchemy.ext.asyncio import AsyncEngine
45
-
46
46
 
47
47
  def _breaker_is_open(cb: CircuitBreaker) -> CircuitBreakerError | None:
48
48
  """Return a ``CircuitBreakerError`` if the breaker is OPEN.
@@ -166,8 +166,8 @@ class ResilientDatabase:
166
166
  return Err(
167
167
  ImportError(
168
168
  "sqlalchemy is required for ResilientDatabase. "
169
- "Install with: pip install taipanstack[bridges-db]"
170
- )
169
+ "Install with: pip install taipanstack[bridges-db]",
170
+ ),
171
171
  )
172
172
 
173
173
  # Circuit breaker gate
@@ -236,8 +236,8 @@ class ResilientRedis:
236
236
  return Err(
237
237
  ImportError(
238
238
  "redis is required for ResilientRedis. "
239
- "Install with: pip install taipanstack[bridges-db]"
240
- )
239
+ "Install with: pip install taipanstack[bridges-db]",
240
+ ),
241
241
  )
242
242
  return Ok(None)
243
243
 
@@ -192,7 +192,11 @@ async def _execute_single_attempt(
192
192
  return Ok(response)
193
193
  except Exception as exc:
194
194
  should_retry = await _handle_http_exception(
195
- exc, attempt, max_attempts, retry_config, circuit_breaker
195
+ exc,
196
+ attempt,
197
+ max_attempts,
198
+ retry_config,
199
+ circuit_breaker,
196
200
  )
197
201
  if should_retry:
198
202
  return exc
@@ -218,7 +222,7 @@ async def _execute_with_retries(
218
222
 
219
223
  """
220
224
  max_attempts = retry_config.max_attempts if retry_config is not None else 1
221
- last_error: Exception | None = None
225
+ last_error: Exception = RuntimeError("Request failed")
222
226
 
223
227
  for attempt in range(1, max_attempts + 1):
224
228
  outcome = await _execute_single_attempt(
@@ -234,7 +238,7 @@ async def _execute_with_retries(
234
238
  if isinstance(outcome, Exception):
235
239
  last_error = outcome
236
240
 
237
- return Err(last_error or RuntimeError("Request failed"))
241
+ return Err(last_error)
238
242
 
239
243
 
240
244
  async def safe_request(
@@ -268,8 +272,8 @@ async def safe_request(
268
272
  return Err(
269
273
  ImportError(
270
274
  "httpx is required for HTTP bridge. "
271
- "Install with: pip install taipanstack[bridges-http]"
272
- )
275
+ "Install with: pip install taipanstack[bridges-http]",
276
+ ),
273
277
  )
274
278
 
275
279
  # SSRF check
@@ -286,7 +290,8 @@ async def safe_request(
286
290
  async def _do_request() -> httpx.Response:
287
291
  async with httpx.AsyncClient(timeout=timeout) as client: # nosemgrep
288
292
  request_func = cast(
289
- Callable[..., Awaitable[httpx.Response]], client.request
293
+ Callable[..., Awaitable[httpx.Response]],
294
+ client.request,
290
295
  )
291
296
  response = await request_func(method, url, **kwargs)
292
297
  return response
@@ -406,7 +411,8 @@ class SafeHttpClient:
406
411
  # We explicitly verified client is not None above
407
412
  client: httpx.AsyncClient = cast(httpx.AsyncClient, self._client)
408
413
  request_func = cast(
409
- Callable[..., Awaitable[httpx.Response]], client.request
414
+ Callable[..., Awaitable[httpx.Response]],
415
+ client.request,
410
416
  )
411
417
  response = await request_func(method, url, **kwargs)
412
418
  return response
@@ -419,31 +425,41 @@ class SafeHttpClient:
419
425
  )
420
426
 
421
427
  async def get(
422
- self, url: str, **kw: Unpack[HttpRequestKwargs]
428
+ self,
429
+ url: str,
430
+ **kw: Unpack[HttpRequestKwargs],
423
431
  ) -> Result[httpx.Response, Exception]:
424
432
  """Send a GET request."""
425
433
  return await self.request("GET", url, **kw)
426
434
 
427
435
  async def post(
428
- self, url: str, **kw: Unpack[HttpRequestKwargs]
436
+ self,
437
+ url: str,
438
+ **kw: Unpack[HttpRequestKwargs],
429
439
  ) -> Result[httpx.Response, Exception]:
430
440
  """Send a POST request."""
431
441
  return await self.request("POST", url, **kw)
432
442
 
433
443
  async def put(
434
- self, url: str, **kw: Unpack[HttpRequestKwargs]
444
+ self,
445
+ url: str,
446
+ **kw: Unpack[HttpRequestKwargs],
435
447
  ) -> Result[httpx.Response, Exception]:
436
448
  """Send a PUT request."""
437
449
  return await self.request("PUT", url, **kw)
438
450
 
439
451
  async def delete(
440
- self, url: str, **kw: Unpack[HttpRequestKwargs]
452
+ self,
453
+ url: str,
454
+ **kw: Unpack[HttpRequestKwargs],
441
455
  ) -> Result[httpx.Response, Exception]:
442
456
  """Send a DELETE request."""
443
457
  return await self.request("DELETE", url, **kw)
444
458
 
445
459
  async def patch(
446
- self, url: str, **kw: Unpack[HttpRequestKwargs]
460
+ self,
461
+ url: str,
462
+ **kw: Unpack[HttpRequestKwargs],
447
463
  ) -> Result[httpx.Response, Exception]:
448
464
  """Send a PATCH request."""
449
465
  return await self.request("PATCH", url, **kw)
@@ -124,13 +124,13 @@ async def _send_json_response(
124
124
  "type": "http.response.start",
125
125
  "status": status,
126
126
  "headers": headers,
127
- }
127
+ },
128
128
  )
129
129
  await send(
130
130
  {
131
131
  "type": "http.response.body",
132
132
  "body": payload,
133
- }
133
+ },
134
134
  )
135
135
 
136
136
 
@@ -44,7 +44,8 @@ class SecurityConfig(BaseModel):
44
44
  enable_pip_audit: bool = Field(default=True, description="Enable pip-audit SCA")
45
45
  enable_semgrep: bool = Field(default=True, description="Enable Semgrep")
46
46
  enable_detect_secrets: bool = Field(
47
- default=True, description="Enable secret detection"
47
+ default=True,
48
+ description="Enable secret detection",
48
49
  )
49
50
  bandit_severity: Literal["low", "medium", "high"] = Field(
50
51
  default="low",
@@ -299,7 +300,7 @@ class StackConfig(BaseModel):
299
300
  self.security.enable_pip_audit,
300
301
  self.security.enable_semgrep,
301
302
  self.security.enable_detect_secrets,
302
- ]
303
+ ],
303
304
  )
304
305
  if self.security.level == "paranoid" and not all_tools_enabled:
305
306
  msg = "Paranoid security level requires all security tools enabled."
@@ -259,7 +259,7 @@ def _apply_gc_tuning(
259
259
  applied.append(
260
260
  f"gc_threshold: {current} -> "
261
261
  f"({profile.gc_threshold_0}, {profile.gc_threshold_1}, "
262
- f"{profile.gc_threshold_2})"
262
+ f"{profile.gc_threshold_2})",
263
263
  )
264
264
  except Exception as e:
265
265
  errors.append(f"gc_threshold: {e}")
@@ -301,7 +301,7 @@ def _apply_experimental(
301
301
  if features.has_free_threading:
302
302
  applied.append("free_threading: available")
303
303
  logger.warning(
304
- "EXPERIMENTAL FEATURES ENABLED: Stability and security may be affected."
304
+ "EXPERIMENTAL FEATURES ENABLED: Stability and security may be affected.",
305
305
  )
306
306
  else:
307
307
  skipped.append("experimental: requires STACK_ENABLE_EXPERIMENTAL=1")
@@ -126,7 +126,8 @@ class SafeFromDecorator(Protocol[E_co]):
126
126
 
127
127
  @overload
128
128
  def __call__(
129
- self, func: Callable[P, Awaitable[T]]
129
+ self,
130
+ func: Callable[P, Awaitable[T]],
130
131
  ) -> Callable[P, Awaitable[Result[T, E_co]]]: ...
131
132
 
132
133
 
@@ -92,7 +92,7 @@ class AdaptiveRetry:
92
92
  self._outcomes: deque[_Outcome] = deque(maxlen=window_size)
93
93
  # Per-attempt successful delays
94
94
  self._success_delays: dict[int, deque[float]] = defaultdict(
95
- lambda: deque(maxlen=window_size)
95
+ lambda: deque(maxlen=window_size),
96
96
  )
97
97
 
98
98
  def record_outcome(
@@ -38,7 +38,7 @@ class BulkheadFullError(Exception):
38
38
  self.max_queue = max_queue
39
39
  super().__init__(
40
40
  f"Bulkhead '{name}' is full "
41
- f"(max_concurrent={max_concurrent}, max_queue={max_queue})"
41
+ f"(max_concurrent={max_concurrent}, max_queue={max_queue})",
42
42
  )
43
43
 
44
44
 
@@ -127,7 +127,7 @@ class Bulkhead:
127
127
  self.name,
128
128
  self._max_concurrent,
129
129
  self._max_queue,
130
- )
130
+ ),
131
131
  )
132
132
 
133
133
  self._queued += 1
@@ -142,8 +142,8 @@ class Bulkhead:
142
142
  return Err(
143
143
  TimeoutError(
144
144
  f"Bulkhead '{self.name}' timed out "
145
- f"after {self._timeout}s waiting for permit"
146
- )
145
+ f"after {self._timeout}s waiting for permit",
146
+ ),
147
147
  )
148
148
  except (RuntimeError, OSError, MemoryError) as e:
149
149
  return Err(RuntimeError(f"Resource exhaustion: {e!s}"))