taipanstack 0.6.0__tar.gz → 0.7.1__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.
- {taipanstack-0.6.0 → taipanstack-0.7.1}/PKG-INFO +83 -31
- {taipanstack-0.6.0 → taipanstack-0.7.1}/README.md +80 -29
- {taipanstack-0.6.0 → taipanstack-0.7.1}/pyproject.toml +15 -11
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/__init__.py +1 -1
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/bridges/_imports.py +1 -1
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/bridges/db_bridge.py +26 -59
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/bridges/http_bridge.py +24 -10
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/bridges/web_bridge.py +16 -19
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/config/generators.py +38 -17
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/config/models.py +25 -17
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/config/version_config.py +3 -2
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/core/compat.py +39 -15
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/core/optimizations.py +43 -15
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/core/result.py +93 -59
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/resilience/adaptive/adaptive_breaker.py +50 -41
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/resilience/adaptive/adaptive_retry.py +34 -10
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/resilience/adaptive/bulkhead.py +119 -49
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/resilience/adaptive/orchestrator.py +127 -53
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/resilience/circuit_breaker.py +213 -108
- taipanstack-0.7.1/src/taipanstack/resilience/resilience.py +336 -0
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/resilience/retry.py +329 -132
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/resilience/watchdogs/_base.py +7 -0
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/resilience/watchdogs/config_watcher.py +26 -10
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/resilience/watchdogs/health_pinger.py +36 -16
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/resilience/watchdogs/resource_watcher.py +25 -4
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/security/decorators.py +138 -68
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/security/guards.py +95 -62
- taipanstack-0.7.1/src/taipanstack/security/jwt.py +215 -0
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/security/models.py +51 -30
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/security/password.py +8 -4
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/security/sanitizers.py +72 -34
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/security/types.py +0 -4
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/security/validators.py +57 -11
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/utils/__init__.py +1 -1
- taipanstack-0.7.1/src/taipanstack/utils/cache.py +273 -0
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/utils/concurrency.py +24 -12
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/utils/filesystem.py +34 -13
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/utils/logging.py +81 -56
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/utils/rate_limit.py +176 -68
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/utils/serialization.py +14 -4
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/utils/subprocess.py +40 -14
- taipanstack-0.6.0/src/taipanstack/resilience/resilience.py +0 -229
- taipanstack-0.6.0/src/taipanstack/security/jwt.py +0 -128
- taipanstack-0.6.0/src/taipanstack/utils/cache.py +0 -184
- {taipanstack-0.6.0 → taipanstack-0.7.1}/LICENSE +0 -0
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/bridges/__init__.py +0 -0
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/config/__init__.py +0 -0
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/core/__init__.py +0 -0
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/resilience/__init__.py +0 -0
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/resilience/adaptive/__init__.py +0 -0
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/resilience/watchdogs/__init__.py +0 -0
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/security/__init__.py +0 -0
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/utils/circuit_breaker.py +0 -0
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/utils/context.py +0 -0
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/utils/resilience.py +0 -0
- {taipanstack-0.6.0 → taipanstack-0.7.1}/src/taipanstack/utils/retry.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: taipanstack
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.1
|
|
4
4
|
Summary: TaipanStack - Modular, secure, and scalable Python stack for robust development
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.13
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
18
19
|
Classifier: Topic :: Software Development :: Quality Assurance
|
|
19
20
|
Classifier: Topic :: Security
|
|
20
21
|
Classifier: Typing :: Typed
|
|
@@ -39,7 +40,7 @@ Requires-Dist: psutil (>=5.9.0) ; extra == "all"
|
|
|
39
40
|
Requires-Dist: psutil (>=5.9.0) ; extra == "resilience"
|
|
40
41
|
Requires-Dist: pydantic (>=2.0)
|
|
41
42
|
Requires-Dist: pydantic-settings (>=2.14.2,<3.0.0)
|
|
42
|
-
Requires-Dist: pyjwt (>=2.
|
|
43
|
+
Requires-Dist: pyjwt (>=2.15.1,<3.0.0)
|
|
43
44
|
Requires-Dist: redis (>=5.0.0) ; extra == "all"
|
|
44
45
|
Requires-Dist: redis (>=5.0.0) ; extra == "bridges-db"
|
|
45
46
|
Requires-Dist: result (>=0.17.0)
|
|
@@ -58,48 +59,52 @@ Description-Content-Type: text/markdown
|
|
|
58
59
|
|
|
59
60
|
<div align="center">
|
|
60
61
|
|
|
61
|
-
# 🐍
|
|
62
|
+
# 🐍 TaipanStack
|
|
63
|
+
|
|
62
64
|
[](https://github.com/gabrielima7/TaipanStack/actions/workflows/ci-push-validate.yml)
|
|
63
65
|
|
|
64
|
-
|
|
66
|
+
## **The Modern Python Foundation**
|
|
65
67
|
|
|
66
68
|
*Launch secure, high-performance Python applications in seconds.*
|
|
67
69
|
|
|
68
|
-
[](https://www.python.org/)
|
|
70
|
+
[](https://www.python.org/)
|
|
69
71
|
[](https://github.com/gabrielima7/TaipanStack)
|
|
70
72
|
[](https://github.com/astral-sh/ruff)
|
|
71
73
|
[](http://mypy-lang.org/)
|
|
72
74
|
[](LICENSE)
|
|
73
75
|
[](SECURITY.md)
|
|
74
|
-
|
|
75
|
-
[](https://github.com/gabrielima7/TaipanStack/actions/workflows/ci-release-publish.yml)
|
|
78
|
+
[](https://github.com/gabrielima7/TaipanStack/actions/workflows/ci-release-publish.yml)
|
|
79
|
+
<!-- markdown-link-check-enable -->
|
|
76
80
|
[](https://pypi.org/project/taipanstack/)
|
|
77
81
|
|
|
78
82
|
---
|
|
79
83
|
|
|
80
|
-
[**Features**](#-why-
|
|
84
|
+
[**Features**](#-why-taipanstack) • [**Quick Start**](#-quick-start) • [**Architecture**](#-architecture) • [**DevSecOps**](#-devsecops) • [**API**](#-api-highlights) • [**Contributing**](#-contributing)
|
|
81
85
|
|
|
82
86
|
</div>
|
|
83
87
|
|
|
84
88
|
---
|
|
85
89
|
|
|
86
|
-
## ✨ Why
|
|
90
|
+
## ✨ Why TaipanStack?
|
|
87
91
|
|
|
88
92
|
> **"Write less, build better."**
|
|
89
93
|
|
|
90
|
-
|
|
94
|
+
TaipanStack is a battle-tested foundation for production-grade Python projects that combines **security**, **performance**, and **developer experience** into a single, cohesive toolkit.
|
|
95
|
+
|
|
96
|
+
### ✨ What's New in v0.7.0
|
|
91
97
|
|
|
92
|
-
|
|
93
|
-
- **
|
|
94
|
-
- **
|
|
95
|
-
- **Typing & Clean Code**: Refactored hot paths to drastically reduce cyclomatic and cognitive complexity, and enhanced static typing with explicit `TypeAlias`, `Literal`, and `TypeGuard` mapping (PR #887, #901, #918, #964).
|
|
96
|
-
- **QA and Standardized Testing**: Consolidated and fully standardized the naming conventions across the entire testing suite, verifying **1,430 passing tests** with 100% genuine branch coverage and no bypasses (PR #882, #886, #891, #894, #909, #912, #926, #930, #944, #954).
|
|
98
|
+
- **Automated CI/CD Delivery Pipeline**: Unified workflow publishing Python packages to PyPI with Sigstore Cosign signing and Docker images to GitHub Container Registry (GHCR).
|
|
99
|
+
- **Automated Versioning (.10 Rollover)**: Continuous release bumping enforcing `.10` rollover (`x.y.10 -> x.(y+1).0`).
|
|
100
|
+
- **Categorized GitHub Releases**: Automated release notes categorized into features, fixes, changes, and removals.
|
|
97
101
|
|
|
98
102
|
<table>
|
|
99
103
|
<tr>
|
|
100
104
|
<td width="50%">
|
|
101
105
|
|
|
102
106
|
### 🛡️ Security First
|
|
107
|
+
|
|
103
108
|
- Path traversal protection
|
|
104
109
|
- Command injection guards
|
|
105
110
|
- Input sanitizers & validators
|
|
@@ -110,6 +115,7 @@ Taipan Stack is a battle-tested foundation for production-grade Python projects
|
|
|
110
115
|
<td width="50%">
|
|
111
116
|
|
|
112
117
|
### ⚡ High Performance
|
|
118
|
+
|
|
113
119
|
- `uvloop` async event loop
|
|
114
120
|
- `orjson` fast JSON serialization
|
|
115
121
|
- `Pydantic v2` validation
|
|
@@ -120,6 +126,7 @@ Taipan Stack is a battle-tested foundation for production-grade Python projects
|
|
|
120
126
|
<td width="50%">
|
|
121
127
|
|
|
122
128
|
### 🎯 Rust-Style Error Handling
|
|
129
|
+
|
|
123
130
|
- `Ok`/`Err` Result types
|
|
124
131
|
- Explicit error propagation
|
|
125
132
|
- Pattern matching support
|
|
@@ -129,8 +136,9 @@ Taipan Stack is a battle-tested foundation for production-grade Python projects
|
|
|
129
136
|
<td width="50%">
|
|
130
137
|
|
|
131
138
|
### 🔧 Developer Experience
|
|
139
|
+
|
|
132
140
|
- Pre-configured quality tools
|
|
133
|
-
- **100% code coverage** (
|
|
141
|
+
- **100% code coverage** (comprehensive test suite)
|
|
134
142
|
- Architecture enforcement
|
|
135
143
|
- Hardened Docker template
|
|
136
144
|
|
|
@@ -144,7 +152,7 @@ Taipan Stack is a battle-tested foundation for production-grade Python projects
|
|
|
144
152
|
|
|
145
153
|
### Prerequisites
|
|
146
154
|
|
|
147
|
-
- **Python 3.11+** (supports 3.11, 3.12, 3.13, 3.14)
|
|
155
|
+
- **Python 3.11+** (supports 3.11, 3.12, 3.13, 3.14, 3.15)
|
|
148
156
|
- **Poetry** ([install guide](https://python-poetry.org/docs/#installation))
|
|
149
157
|
|
|
150
158
|
### Installation
|
|
@@ -172,7 +180,7 @@ make all
|
|
|
172
180
|
### Verify Installation
|
|
173
181
|
|
|
174
182
|
```bash
|
|
175
|
-
# Run tests with 100% coverage (
|
|
183
|
+
# Run tests with 100% coverage (comprehensive test suite)
|
|
176
184
|
make test
|
|
177
185
|
|
|
178
186
|
# Check architecture contracts
|
|
@@ -190,7 +198,7 @@ make property-test
|
|
|
190
198
|
|
|
191
199
|
## 📐 Architecture
|
|
192
200
|
|
|
193
|
-
|
|
201
|
+
TaipanStack follows a clean, layered architecture with strict dependency rules enforced by **Import Linter**.
|
|
194
202
|
|
|
195
203
|
```
|
|
196
204
|
┌────────────────────────────────────────────────────────┐
|
|
@@ -216,30 +224,36 @@ Taipan Stack follows a clean, layered architecture with strict dependency rules
|
|
|
216
224
|
|
|
217
225
|
### Project Structure
|
|
218
226
|
|
|
219
|
-
```
|
|
227
|
+
```
|
|
220
228
|
TaipanStack/
|
|
221
229
|
├── src/
|
|
222
230
|
│ ├── app/ # Application entry point
|
|
223
231
|
│ └── taipanstack/
|
|
224
|
-
│ ├──
|
|
232
|
+
│ ├── bridges/ # 🌉 External communication integrations (http, db, web)
|
|
225
233
|
│ ├── config/ # ⚙️ Configuration models & generators
|
|
234
|
+
│ ├── core/ # 🎯 Result types, functional patterns
|
|
235
|
+
│ ├── resilience/ # 🌊 Reliability patterns (circuit breakers, retries, watchdogs)
|
|
226
236
|
│ ├── security/ # 🛡️ Guards, sanitizers, validators
|
|
227
|
-
│ └── utils/ # 🔧
|
|
228
|
-
├── tests/ # ✅
|
|
237
|
+
│ └── utils/ # 🔧 Cross-cutting utilities (logging, cache, filesystem)
|
|
238
|
+
├── tests/ # ✅ comprehensive test suite, 100% coverage
|
|
229
239
|
├── .semgrep/ # 🔍 Custom SAST rules
|
|
230
240
|
├── .github/ # 🔄 CI/CD + SBOM/SLSA workflows
|
|
231
241
|
├── Dockerfile # 🐳 Hardened multi-stage container
|
|
232
242
|
└── pyproject.toml # 📋 Modern dependency management
|
|
233
243
|
```
|
|
234
244
|
|
|
245
|
+
### Migration Notice
|
|
246
|
+
|
|
247
|
+
The `taipanstack.utils` resilience modules (`circuit_breaker`, `retry`, `resilience`) are deprecated backward-compatibility shims. New code should import resilience modules directly from `taipanstack.resilience`.
|
|
248
|
+
|
|
235
249
|
---
|
|
236
250
|
|
|
237
251
|
## 🔐 DevSecOps
|
|
238
252
|
|
|
239
|
-
|
|
253
|
+
TaipanStack integrates security and quality at every level:
|
|
240
254
|
|
|
241
255
|
| Category | Tools | Purpose |
|
|
242
|
-
|
|
256
|
+
| ---------- | ------- | --------- |
|
|
243
257
|
| **SAST** | Bandit, Semgrep + custom rules | Static Application Security Testing |
|
|
244
258
|
| **SCA** | pip-audit | Dependency vulnerability scanning |
|
|
245
259
|
| **SBOM** | Syft (CycloneDX) | Software Bill of Materials |
|
|
@@ -254,7 +268,7 @@ Taipan Stack integrates security and quality at every level:
|
|
|
254
268
|
|
|
255
269
|
```yaml
|
|
256
270
|
# Runs on every push/PR
|
|
257
|
-
✓ Test Matrix → Python 3.11-3.
|
|
271
|
+
✓ Test Matrix → Python 3.11-3.15 × (Ubuntu, macOS, Windows)
|
|
258
272
|
✓ Linux Distros → Ubuntu, Debian, Fedora, openSUSE, Arch, Alpine
|
|
259
273
|
✓ Code Quality → Ruff check & format
|
|
260
274
|
✓ Type Check → Mypy strict mode
|
|
@@ -266,6 +280,13 @@ Taipan Stack integrates security and quality at every level:
|
|
|
266
280
|
|
|
267
281
|
---
|
|
268
282
|
|
|
283
|
+
## ⚙️ Environment Variables
|
|
284
|
+
|
|
285
|
+
TaipanStack supports the following environment variables for configuration:
|
|
286
|
+
|
|
287
|
+
- `STACK_ENABLE_EXPERIMENTAL`: Set to `1`, `true`, `yes`, or `on` to enable experimental features such as the JIT compiler and free-threading optimizations.
|
|
288
|
+
- `STACK_OPTIMIZATION_LEVEL`: Set the optimization level (default `1`). Use `0` for none, `1` for safe, and `2` for aggressive optimizations (requires experimental features).
|
|
289
|
+
|
|
269
290
|
## 📚 API Highlights
|
|
270
291
|
|
|
271
292
|
### Result Types (Rust-Style Error Handling)
|
|
@@ -288,7 +309,11 @@ match divide(10, 0):
|
|
|
288
309
|
### Security Guards
|
|
289
310
|
|
|
290
311
|
```python
|
|
291
|
-
from taipanstack.security.guards import
|
|
312
|
+
from taipanstack.security.guards import (
|
|
313
|
+
guard_command_injection,
|
|
314
|
+
guard_env_variable,
|
|
315
|
+
guard_path_traversal,
|
|
316
|
+
)
|
|
292
317
|
|
|
293
318
|
# Prevent path traversal attacks
|
|
294
319
|
safe_path = guard_path_traversal(user_input, base_dir="/app/data")
|
|
@@ -298,6 +323,31 @@ safe_cmd = guard_command_injection(
|
|
|
298
323
|
["git", "clone", repo_url],
|
|
299
324
|
allowed_commands=["git"]
|
|
300
325
|
)
|
|
326
|
+
|
|
327
|
+
# Safely access environment variables with bounds checking
|
|
328
|
+
safe_key = guard_env_variable(
|
|
329
|
+
"API_KEY",
|
|
330
|
+
allowed_names=["API_KEY", "DEBUG"],
|
|
331
|
+
denied_names=["AWS_SECRET_ACCESS_KEY"]
|
|
332
|
+
)
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### Rate Limiting
|
|
336
|
+
|
|
337
|
+
```python
|
|
338
|
+
from taipanstack.utils.rate_limit import rate_limit
|
|
339
|
+
from taipanstack.core.result import Result, Ok, Err
|
|
340
|
+
|
|
341
|
+
@rate_limit(max_calls=5, time_window=10.0)
|
|
342
|
+
def fetch_data() -> str:
|
|
343
|
+
return "data"
|
|
344
|
+
|
|
345
|
+
# Returns an Ok('data') or Err(RateLimitError('Rate limit exceeded'))
|
|
346
|
+
match fetch_data():
|
|
347
|
+
case Ok(value):
|
|
348
|
+
print(f"Data: {value}")
|
|
349
|
+
case Err(error):
|
|
350
|
+
print(f"Rate limited: {error}")
|
|
301
351
|
```
|
|
302
352
|
|
|
303
353
|
### Retry with Exponential Backoff
|
|
@@ -345,7 +395,7 @@ match result:
|
|
|
345
395
|
### 🔗 Combining Result + Retry with Monitoring
|
|
346
396
|
|
|
347
397
|
```python
|
|
348
|
-
from taipanstack.core.result import safe
|
|
398
|
+
from taipanstack.core.result import safe
|
|
349
399
|
from taipanstack.resilience.retry import retry
|
|
350
400
|
|
|
351
401
|
@retry(
|
|
@@ -360,7 +410,7 @@ def fetch_user_profile(user_id: str) -> dict:
|
|
|
360
410
|
return api_client.get(f"/users/{user_id}")
|
|
361
411
|
|
|
362
412
|
# Retry handles transient failures, Result handles business errors
|
|
363
|
-
profile =
|
|
413
|
+
profile = fetch_user_profile("usr_456").unwrap_or({"name": "Unknown"})
|
|
364
414
|
```
|
|
365
415
|
|
|
366
416
|
### 🔗 Adaptive Resilience Pipeline
|
|
@@ -474,6 +524,8 @@ Contributions are welcome! Please check our [Contributing Guide](CONTRIBUTING.md
|
|
|
474
524
|
- 📝 Documentation improvements
|
|
475
525
|
- 🔧 Pull requests
|
|
476
526
|
|
|
527
|
+
> **🤖 Note for AI Assistants & Agents**: If you are an AI assistant contributing to this repository, you **MUST** strictly adhere to the [AI Agents Guidelines](docs/agents.md).
|
|
528
|
+
|
|
477
529
|
---
|
|
478
530
|
|
|
479
531
|
## 📝 License
|
|
@@ -484,9 +536,9 @@ This project is open-sourced under the [MIT License](LICENSE).
|
|
|
484
536
|
|
|
485
537
|
<div align="center">
|
|
486
538
|
|
|
487
|
-
|
|
539
|
+
Made with ❤️ for the Python community
|
|
488
540
|
|
|
489
|
-
[⬆ Back to Top](#-
|
|
541
|
+
[⬆ Back to Top](#-taipanstack)
|
|
490
542
|
|
|
491
543
|
</div>
|
|
492
544
|
|
|
@@ -1,47 +1,51 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
# 🐍
|
|
3
|
+
# 🐍 TaipanStack
|
|
4
|
+
|
|
4
5
|
[](https://github.com/gabrielima7/TaipanStack/actions/workflows/ci-push-validate.yml)
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
## **The Modern Python Foundation**
|
|
7
8
|
|
|
8
9
|
*Launch secure, high-performance Python applications in seconds.*
|
|
9
10
|
|
|
10
|
-
[](https://www.python.org/)
|
|
11
|
+
[](https://www.python.org/)
|
|
11
12
|
[](https://github.com/gabrielima7/TaipanStack)
|
|
12
13
|
[](https://github.com/astral-sh/ruff)
|
|
13
14
|
[](http://mypy-lang.org/)
|
|
14
15
|
[](LICENSE)
|
|
15
16
|
[](SECURITY.md)
|
|
16
|
-
|
|
17
|
-
[](https://github.com/gabrielima7/TaipanStack/actions/workflows/ci-release-publish.yml)
|
|
19
|
+
[](https://github.com/gabrielima7/TaipanStack/actions/workflows/ci-release-publish.yml)
|
|
20
|
+
<!-- markdown-link-check-enable -->
|
|
18
21
|
[](https://pypi.org/project/taipanstack/)
|
|
19
22
|
|
|
20
23
|
---
|
|
21
24
|
|
|
22
|
-
[**Features**](#-why-
|
|
25
|
+
[**Features**](#-why-taipanstack) • [**Quick Start**](#-quick-start) • [**Architecture**](#-architecture) • [**DevSecOps**](#-devsecops) • [**API**](#-api-highlights) • [**Contributing**](#-contributing)
|
|
23
26
|
|
|
24
27
|
</div>
|
|
25
28
|
|
|
26
29
|
---
|
|
27
30
|
|
|
28
|
-
## ✨ Why
|
|
31
|
+
## ✨ Why TaipanStack?
|
|
29
32
|
|
|
30
33
|
> **"Write less, build better."**
|
|
31
34
|
|
|
32
|
-
|
|
35
|
+
TaipanStack is a battle-tested foundation for production-grade Python projects that combines **security**, **performance**, and **developer experience** into a single, cohesive toolkit.
|
|
36
|
+
|
|
37
|
+
### ✨ What's New in v0.7.0
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
- **
|
|
36
|
-
- **
|
|
37
|
-
- **Typing & Clean Code**: Refactored hot paths to drastically reduce cyclomatic and cognitive complexity, and enhanced static typing with explicit `TypeAlias`, `Literal`, and `TypeGuard` mapping (PR #887, #901, #918, #964).
|
|
38
|
-
- **QA and Standardized Testing**: Consolidated and fully standardized the naming conventions across the entire testing suite, verifying **1,430 passing tests** with 100% genuine branch coverage and no bypasses (PR #882, #886, #891, #894, #909, #912, #926, #930, #944, #954).
|
|
39
|
+
- **Automated CI/CD Delivery Pipeline**: Unified workflow publishing Python packages to PyPI with Sigstore Cosign signing and Docker images to GitHub Container Registry (GHCR).
|
|
40
|
+
- **Automated Versioning (.10 Rollover)**: Continuous release bumping enforcing `.10` rollover (`x.y.10 -> x.(y+1).0`).
|
|
41
|
+
- **Categorized GitHub Releases**: Automated release notes categorized into features, fixes, changes, and removals.
|
|
39
42
|
|
|
40
43
|
<table>
|
|
41
44
|
<tr>
|
|
42
45
|
<td width="50%">
|
|
43
46
|
|
|
44
47
|
### 🛡️ Security First
|
|
48
|
+
|
|
45
49
|
- Path traversal protection
|
|
46
50
|
- Command injection guards
|
|
47
51
|
- Input sanitizers & validators
|
|
@@ -52,6 +56,7 @@ Taipan Stack is a battle-tested foundation for production-grade Python projects
|
|
|
52
56
|
<td width="50%">
|
|
53
57
|
|
|
54
58
|
### ⚡ High Performance
|
|
59
|
+
|
|
55
60
|
- `uvloop` async event loop
|
|
56
61
|
- `orjson` fast JSON serialization
|
|
57
62
|
- `Pydantic v2` validation
|
|
@@ -62,6 +67,7 @@ Taipan Stack is a battle-tested foundation for production-grade Python projects
|
|
|
62
67
|
<td width="50%">
|
|
63
68
|
|
|
64
69
|
### 🎯 Rust-Style Error Handling
|
|
70
|
+
|
|
65
71
|
- `Ok`/`Err` Result types
|
|
66
72
|
- Explicit error propagation
|
|
67
73
|
- Pattern matching support
|
|
@@ -71,8 +77,9 @@ Taipan Stack is a battle-tested foundation for production-grade Python projects
|
|
|
71
77
|
<td width="50%">
|
|
72
78
|
|
|
73
79
|
### 🔧 Developer Experience
|
|
80
|
+
|
|
74
81
|
- Pre-configured quality tools
|
|
75
|
-
- **100% code coverage** (
|
|
82
|
+
- **100% code coverage** (comprehensive test suite)
|
|
76
83
|
- Architecture enforcement
|
|
77
84
|
- Hardened Docker template
|
|
78
85
|
|
|
@@ -86,7 +93,7 @@ Taipan Stack is a battle-tested foundation for production-grade Python projects
|
|
|
86
93
|
|
|
87
94
|
### Prerequisites
|
|
88
95
|
|
|
89
|
-
- **Python 3.11+** (supports 3.11, 3.12, 3.13, 3.14)
|
|
96
|
+
- **Python 3.11+** (supports 3.11, 3.12, 3.13, 3.14, 3.15)
|
|
90
97
|
- **Poetry** ([install guide](https://python-poetry.org/docs/#installation))
|
|
91
98
|
|
|
92
99
|
### Installation
|
|
@@ -114,7 +121,7 @@ make all
|
|
|
114
121
|
### Verify Installation
|
|
115
122
|
|
|
116
123
|
```bash
|
|
117
|
-
# Run tests with 100% coverage (
|
|
124
|
+
# Run tests with 100% coverage (comprehensive test suite)
|
|
118
125
|
make test
|
|
119
126
|
|
|
120
127
|
# Check architecture contracts
|
|
@@ -132,7 +139,7 @@ make property-test
|
|
|
132
139
|
|
|
133
140
|
## 📐 Architecture
|
|
134
141
|
|
|
135
|
-
|
|
142
|
+
TaipanStack follows a clean, layered architecture with strict dependency rules enforced by **Import Linter**.
|
|
136
143
|
|
|
137
144
|
```
|
|
138
145
|
┌────────────────────────────────────────────────────────┐
|
|
@@ -158,30 +165,36 @@ Taipan Stack follows a clean, layered architecture with strict dependency rules
|
|
|
158
165
|
|
|
159
166
|
### Project Structure
|
|
160
167
|
|
|
161
|
-
```
|
|
168
|
+
```
|
|
162
169
|
TaipanStack/
|
|
163
170
|
├── src/
|
|
164
171
|
│ ├── app/ # Application entry point
|
|
165
172
|
│ └── taipanstack/
|
|
166
|
-
│ ├──
|
|
173
|
+
│ ├── bridges/ # 🌉 External communication integrations (http, db, web)
|
|
167
174
|
│ ├── config/ # ⚙️ Configuration models & generators
|
|
175
|
+
│ ├── core/ # 🎯 Result types, functional patterns
|
|
176
|
+
│ ├── resilience/ # 🌊 Reliability patterns (circuit breakers, retries, watchdogs)
|
|
168
177
|
│ ├── security/ # 🛡️ Guards, sanitizers, validators
|
|
169
|
-
│ └── utils/ # 🔧
|
|
170
|
-
├── tests/ # ✅
|
|
178
|
+
│ └── utils/ # 🔧 Cross-cutting utilities (logging, cache, filesystem)
|
|
179
|
+
├── tests/ # ✅ comprehensive test suite, 100% coverage
|
|
171
180
|
├── .semgrep/ # 🔍 Custom SAST rules
|
|
172
181
|
├── .github/ # 🔄 CI/CD + SBOM/SLSA workflows
|
|
173
182
|
├── Dockerfile # 🐳 Hardened multi-stage container
|
|
174
183
|
└── pyproject.toml # 📋 Modern dependency management
|
|
175
184
|
```
|
|
176
185
|
|
|
186
|
+
### Migration Notice
|
|
187
|
+
|
|
188
|
+
The `taipanstack.utils` resilience modules (`circuit_breaker`, `retry`, `resilience`) are deprecated backward-compatibility shims. New code should import resilience modules directly from `taipanstack.resilience`.
|
|
189
|
+
|
|
177
190
|
---
|
|
178
191
|
|
|
179
192
|
## 🔐 DevSecOps
|
|
180
193
|
|
|
181
|
-
|
|
194
|
+
TaipanStack integrates security and quality at every level:
|
|
182
195
|
|
|
183
196
|
| Category | Tools | Purpose |
|
|
184
|
-
|
|
197
|
+
| ---------- | ------- | --------- |
|
|
185
198
|
| **SAST** | Bandit, Semgrep + custom rules | Static Application Security Testing |
|
|
186
199
|
| **SCA** | pip-audit | Dependency vulnerability scanning |
|
|
187
200
|
| **SBOM** | Syft (CycloneDX) | Software Bill of Materials |
|
|
@@ -196,7 +209,7 @@ Taipan Stack integrates security and quality at every level:
|
|
|
196
209
|
|
|
197
210
|
```yaml
|
|
198
211
|
# Runs on every push/PR
|
|
199
|
-
✓ Test Matrix → Python 3.11-3.
|
|
212
|
+
✓ Test Matrix → Python 3.11-3.15 × (Ubuntu, macOS, Windows)
|
|
200
213
|
✓ Linux Distros → Ubuntu, Debian, Fedora, openSUSE, Arch, Alpine
|
|
201
214
|
✓ Code Quality → Ruff check & format
|
|
202
215
|
✓ Type Check → Mypy strict mode
|
|
@@ -208,6 +221,13 @@ Taipan Stack integrates security and quality at every level:
|
|
|
208
221
|
|
|
209
222
|
---
|
|
210
223
|
|
|
224
|
+
## ⚙️ Environment Variables
|
|
225
|
+
|
|
226
|
+
TaipanStack supports the following environment variables for configuration:
|
|
227
|
+
|
|
228
|
+
- `STACK_ENABLE_EXPERIMENTAL`: Set to `1`, `true`, `yes`, or `on` to enable experimental features such as the JIT compiler and free-threading optimizations.
|
|
229
|
+
- `STACK_OPTIMIZATION_LEVEL`: Set the optimization level (default `1`). Use `0` for none, `1` for safe, and `2` for aggressive optimizations (requires experimental features).
|
|
230
|
+
|
|
211
231
|
## 📚 API Highlights
|
|
212
232
|
|
|
213
233
|
### Result Types (Rust-Style Error Handling)
|
|
@@ -230,7 +250,11 @@ match divide(10, 0):
|
|
|
230
250
|
### Security Guards
|
|
231
251
|
|
|
232
252
|
```python
|
|
233
|
-
from taipanstack.security.guards import
|
|
253
|
+
from taipanstack.security.guards import (
|
|
254
|
+
guard_command_injection,
|
|
255
|
+
guard_env_variable,
|
|
256
|
+
guard_path_traversal,
|
|
257
|
+
)
|
|
234
258
|
|
|
235
259
|
# Prevent path traversal attacks
|
|
236
260
|
safe_path = guard_path_traversal(user_input, base_dir="/app/data")
|
|
@@ -240,6 +264,31 @@ safe_cmd = guard_command_injection(
|
|
|
240
264
|
["git", "clone", repo_url],
|
|
241
265
|
allowed_commands=["git"]
|
|
242
266
|
)
|
|
267
|
+
|
|
268
|
+
# Safely access environment variables with bounds checking
|
|
269
|
+
safe_key = guard_env_variable(
|
|
270
|
+
"API_KEY",
|
|
271
|
+
allowed_names=["API_KEY", "DEBUG"],
|
|
272
|
+
denied_names=["AWS_SECRET_ACCESS_KEY"]
|
|
273
|
+
)
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Rate Limiting
|
|
277
|
+
|
|
278
|
+
```python
|
|
279
|
+
from taipanstack.utils.rate_limit import rate_limit
|
|
280
|
+
from taipanstack.core.result import Result, Ok, Err
|
|
281
|
+
|
|
282
|
+
@rate_limit(max_calls=5, time_window=10.0)
|
|
283
|
+
def fetch_data() -> str:
|
|
284
|
+
return "data"
|
|
285
|
+
|
|
286
|
+
# Returns an Ok('data') or Err(RateLimitError('Rate limit exceeded'))
|
|
287
|
+
match fetch_data():
|
|
288
|
+
case Ok(value):
|
|
289
|
+
print(f"Data: {value}")
|
|
290
|
+
case Err(error):
|
|
291
|
+
print(f"Rate limited: {error}")
|
|
243
292
|
```
|
|
244
293
|
|
|
245
294
|
### Retry with Exponential Backoff
|
|
@@ -287,7 +336,7 @@ match result:
|
|
|
287
336
|
### 🔗 Combining Result + Retry with Monitoring
|
|
288
337
|
|
|
289
338
|
```python
|
|
290
|
-
from taipanstack.core.result import safe
|
|
339
|
+
from taipanstack.core.result import safe
|
|
291
340
|
from taipanstack.resilience.retry import retry
|
|
292
341
|
|
|
293
342
|
@retry(
|
|
@@ -302,7 +351,7 @@ def fetch_user_profile(user_id: str) -> dict:
|
|
|
302
351
|
return api_client.get(f"/users/{user_id}")
|
|
303
352
|
|
|
304
353
|
# Retry handles transient failures, Result handles business errors
|
|
305
|
-
profile =
|
|
354
|
+
profile = fetch_user_profile("usr_456").unwrap_or({"name": "Unknown"})
|
|
306
355
|
```
|
|
307
356
|
|
|
308
357
|
### 🔗 Adaptive Resilience Pipeline
|
|
@@ -416,6 +465,8 @@ Contributions are welcome! Please check our [Contributing Guide](CONTRIBUTING.md
|
|
|
416
465
|
- 📝 Documentation improvements
|
|
417
466
|
- 🔧 Pull requests
|
|
418
467
|
|
|
468
|
+
> **🤖 Note for AI Assistants & Agents**: If you are an AI assistant contributing to this repository, you **MUST** strictly adhere to the [AI Agents Guidelines](docs/agents.md).
|
|
469
|
+
|
|
419
470
|
---
|
|
420
471
|
|
|
421
472
|
## 📝 License
|
|
@@ -426,8 +477,8 @@ This project is open-sourced under the [MIT License](LICENSE).
|
|
|
426
477
|
|
|
427
478
|
<div align="center">
|
|
428
479
|
|
|
429
|
-
|
|
480
|
+
Made with ❤️ for the Python community
|
|
430
481
|
|
|
431
|
-
[⬆ Back to Top](#-
|
|
482
|
+
[⬆ Back to Top](#-taipanstack)
|
|
432
483
|
|
|
433
484
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "taipanstack"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.7.1"
|
|
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"}
|
|
@@ -17,6 +17,7 @@ classifiers = [
|
|
|
17
17
|
"Programming Language :: Python :: 3.12",
|
|
18
18
|
"Programming Language :: Python :: 3.13",
|
|
19
19
|
"Programming Language :: Python :: 3.14",
|
|
20
|
+
"Programming Language :: Python :: 3.15",
|
|
20
21
|
"Topic :: Software Development :: Quality Assurance",
|
|
21
22
|
"Topic :: Security",
|
|
22
23
|
"Typing :: Typed",
|
|
@@ -27,7 +28,7 @@ dependencies = [
|
|
|
27
28
|
"orjson (>=3.9.0)",
|
|
28
29
|
"email-validator (>=2.0.0)",
|
|
29
30
|
"result (>=0.17.0)",
|
|
30
|
-
"pyjwt (>=2.
|
|
31
|
+
"pyjwt (>=2.15.1,<3.0.0)",
|
|
31
32
|
"argon2-cffi (>=25.1.0,<26.0.0)",
|
|
32
33
|
"pip (>=26.1,<27.0)",
|
|
33
34
|
"msgpack (>=1.2.1,<2.0.0)",
|
|
@@ -103,13 +104,15 @@ dev = [
|
|
|
103
104
|
"pygments (>=2.19.2)",
|
|
104
105
|
"hypothesis (>=6.151.12,<7.0.0)",
|
|
105
106
|
"authlib (>=1.6.11,<2.0.0)",
|
|
106
|
-
"
|
|
107
|
+
"joserfc (>=1.7.6)",
|
|
108
|
+
"cryptography (>=46.0.7,<51.0.0)",
|
|
107
109
|
"mutmut (>=3.0.0,<4.0.0)",
|
|
108
|
-
"mkdocs-material (>=9.7.
|
|
110
|
+
"mkdocs-material (>=9.7.7,<10.0.0)",
|
|
111
|
+
"pip (>=26.2.1,<27.0.0)",
|
|
109
112
|
]
|
|
110
113
|
|
|
111
114
|
docs = [
|
|
112
|
-
"mkdocs-material (>=9.7.
|
|
115
|
+
"mkdocs-material (>=9.7.7,<10.0.0)",
|
|
113
116
|
"mkdocstrings[python] (>=1.0.3,<2.0.0)",
|
|
114
117
|
]
|
|
115
118
|
|
|
@@ -160,7 +163,7 @@ max-complexity = 10
|
|
|
160
163
|
# TaipanStack bootstrapper: allow print, long lines, complex branches, docstring style, unused args
|
|
161
164
|
"taipanstack_bootstrapper.py" = ["T201", "E501", "PLR0912", "TRY300", "S603", "D205", "ARG001"]
|
|
162
165
|
# Utils: allow too many args, subprocess, random for jitter
|
|
163
|
-
"src/taipanstack/utils/*.py" = ["PLR0913", "S603", "TRY300", "S311", "TRY400"]
|
|
166
|
+
"src/taipanstack/utils/*.py" = ["PLR0913", "PLR0917", "S603", "TRY300", "S311", "TRY400", "PLR0915"]
|
|
164
167
|
# Config generators: allow long lines in generated content
|
|
165
168
|
"src/taipanstack/config/generators.py" = ["E501"]
|
|
166
169
|
# Sanitizers: allow many branches for complex validation logic
|
|
@@ -170,10 +173,10 @@ max-complexity = 10
|
|
|
170
173
|
# Core result: allow D401 for utility function docstrings
|
|
171
174
|
"src/taipanstack/core/result.py" = ["D401"]
|
|
172
175
|
# Resilience module: allow D401, too many args, random for jitter
|
|
173
|
-
"src/taipanstack/resilience/*.py" = ["PLR0913", "D401", "S311", "TRY300", "TRY400"]
|
|
174
|
-
"src/taipanstack/resilience/watchdogs/*.py" = ["PLR0913", "D401", "TRY300", "TRY400"]
|
|
175
|
-
"src/taipanstack/resilience/adaptive/*.py" = ["PLR0913", "PLR0912", "D401", "TRY300", "TRY400"]
|
|
176
|
-
"src/taipanstack/bridges/*.py" = ["PLR0913", "D401", "TRY300", "TRY400", "ANN401"]
|
|
176
|
+
"src/taipanstack/resilience/*.py" = ["PLR0913", "PLR0917", "PLR0915", "D401", "S311", "TRY300", "TRY400"]
|
|
177
|
+
"src/taipanstack/resilience/watchdogs/*.py" = ["PLR0913", "PLR0917", "D401", "TRY300", "TRY400"]
|
|
178
|
+
"src/taipanstack/resilience/adaptive/*.py" = ["PLR0913", "PLR0917", "PLR0912", "D401", "TRY300", "TRY400"]
|
|
179
|
+
"src/taipanstack/bridges/*.py" = ["PLR0913", "PLR0917", "D401", "TRY300", "TRY400", "ANN401"]
|
|
177
180
|
|
|
178
181
|
[tool.ruff.format]
|
|
179
182
|
quote-style = "double"
|
|
@@ -187,7 +190,8 @@ warn_return_any = true
|
|
|
187
190
|
warn_unused_configs = true
|
|
188
191
|
warn_unreachable = true
|
|
189
192
|
disallow_untyped_defs = true
|
|
190
|
-
disallow_any_unimported =
|
|
193
|
+
disallow_any_unimported = true
|
|
194
|
+
disallow_any_expr = true
|
|
191
195
|
no_implicit_optional = true
|
|
192
196
|
check_untyped_defs = true
|
|
193
197
|
strict_optional = 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.
|
|
8
|
+
__version__ = "0.7.1"
|
|
9
9
|
|
|
10
10
|
from taipanstack.config.version_config import (
|
|
11
11
|
VersionRecommendations,
|