taipanstack 0.6.1__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.1 → taipanstack-0.7.1}/PKG-INFO +79 -29
- {taipanstack-0.6.1 → taipanstack-0.7.1}/README.md +76 -27
- {taipanstack-0.6.1 → taipanstack-0.7.1}/pyproject.toml +15 -11
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/__init__.py +1 -1
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/bridges/_imports.py +1 -1
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/bridges/db_bridge.py +26 -59
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/bridges/http_bridge.py +24 -10
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/bridges/web_bridge.py +3 -3
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/config/generators.py +7 -7
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/config/models.py +2 -2
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/config/version_config.py +3 -2
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/core/compat.py +12 -7
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/core/optimizations.py +14 -7
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/core/result.py +93 -59
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/resilience/adaptive/adaptive_breaker.py +50 -41
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/resilience/adaptive/adaptive_retry.py +34 -10
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/resilience/adaptive/bulkhead.py +119 -49
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/resilience/adaptive/orchestrator.py +128 -43
- {taipanstack-0.6.1 → 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.1 → taipanstack-0.7.1}/src/taipanstack/resilience/retry.py +321 -128
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/resilience/watchdogs/_base.py +7 -0
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/resilience/watchdogs/config_watcher.py +10 -3
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/resilience/watchdogs/health_pinger.py +36 -16
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/resilience/watchdogs/resource_watcher.py +25 -4
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/security/decorators.py +138 -68
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/security/guards.py +95 -49
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/security/jwt.py +95 -14
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/security/models.py +40 -20
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/security/sanitizers.py +53 -22
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/security/validators.py +33 -6
- {taipanstack-0.6.1 → 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.1 → taipanstack-0.7.1}/src/taipanstack/utils/concurrency.py +24 -12
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/utils/filesystem.py +11 -7
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/utils/logging.py +81 -56
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/utils/rate_limit.py +132 -62
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/utils/serialization.py +14 -4
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/utils/subprocess.py +40 -14
- taipanstack-0.6.1/src/taipanstack/resilience/resilience.py +0 -229
- taipanstack-0.6.1/src/taipanstack/utils/cache.py +0 -184
- {taipanstack-0.6.1 → taipanstack-0.7.1}/LICENSE +0 -0
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/bridges/__init__.py +0 -0
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/config/__init__.py +0 -0
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/core/__init__.py +0 -0
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/resilience/__init__.py +0 -0
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/resilience/adaptive/__init__.py +0 -0
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/resilience/watchdogs/__init__.py +0 -0
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/security/__init__.py +0 -0
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/security/password.py +0 -0
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/security/types.py +0 -0
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/utils/circuit_breaker.py +0 -0
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/utils/context.py +0 -0
- {taipanstack-0.6.1 → taipanstack-0.7.1}/src/taipanstack/utils/resilience.py +0 -0
- {taipanstack-0.6.1 → 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
|
-
- **Clean Code & Refactoring**: Significantly reduced cyclomatic complexity across compatibility shims, validators, filesystems, and token buckets. Enforced strict web bridge type hints and clean keyword parameters (PR #971, #976, #979, #984, #988, #993, #997, #1002, #1003).
|
|
96
|
-
- **QA and Standardized Testing**: Fully standardized test file nomenclature, verified **1,460+ passing tests** with 100% genuine branch coverage, and added rigorous microservice chaos engineering simulations (PR #972, #975, #981, #986, #990, #992, #994, #999, #1004).
|
|
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,7 +224,7 @@ 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
|
|
@@ -227,21 +235,25 @@ TaipanStack/
|
|
|
227
235
|
│ ├── resilience/ # 🌊 Reliability patterns (circuit breakers, retries, watchdogs)
|
|
228
236
|
│ ├── security/ # 🛡️ Guards, sanitizers, validators
|
|
229
237
|
│ └── utils/ # 🔧 Cross-cutting utilities (logging, cache, filesystem)
|
|
230
|
-
├── tests/ # ✅
|
|
238
|
+
├── tests/ # ✅ comprehensive test suite, 100% coverage
|
|
231
239
|
├── .semgrep/ # 🔍 Custom SAST rules
|
|
232
240
|
├── .github/ # 🔄 CI/CD + SBOM/SLSA workflows
|
|
233
241
|
├── Dockerfile # 🐳 Hardened multi-stage container
|
|
234
242
|
└── pyproject.toml # 📋 Modern dependency management
|
|
235
243
|
```
|
|
236
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
|
+
|
|
237
249
|
---
|
|
238
250
|
|
|
239
251
|
## 🔐 DevSecOps
|
|
240
252
|
|
|
241
|
-
|
|
253
|
+
TaipanStack integrates security and quality at every level:
|
|
242
254
|
|
|
243
255
|
| Category | Tools | Purpose |
|
|
244
|
-
|
|
256
|
+
| ---------- | ------- | --------- |
|
|
245
257
|
| **SAST** | Bandit, Semgrep + custom rules | Static Application Security Testing |
|
|
246
258
|
| **SCA** | pip-audit | Dependency vulnerability scanning |
|
|
247
259
|
| **SBOM** | Syft (CycloneDX) | Software Bill of Materials |
|
|
@@ -256,7 +268,7 @@ Taipan Stack integrates security and quality at every level:
|
|
|
256
268
|
|
|
257
269
|
```yaml
|
|
258
270
|
# Runs on every push/PR
|
|
259
|
-
✓ Test Matrix → Python 3.11-3.
|
|
271
|
+
✓ Test Matrix → Python 3.11-3.15 × (Ubuntu, macOS, Windows)
|
|
260
272
|
✓ Linux Distros → Ubuntu, Debian, Fedora, openSUSE, Arch, Alpine
|
|
261
273
|
✓ Code Quality → Ruff check & format
|
|
262
274
|
✓ Type Check → Mypy strict mode
|
|
@@ -268,6 +280,13 @@ Taipan Stack integrates security and quality at every level:
|
|
|
268
280
|
|
|
269
281
|
---
|
|
270
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
|
+
|
|
271
290
|
## 📚 API Highlights
|
|
272
291
|
|
|
273
292
|
### Result Types (Rust-Style Error Handling)
|
|
@@ -290,7 +309,11 @@ match divide(10, 0):
|
|
|
290
309
|
### Security Guards
|
|
291
310
|
|
|
292
311
|
```python
|
|
293
|
-
from taipanstack.security.guards import
|
|
312
|
+
from taipanstack.security.guards import (
|
|
313
|
+
guard_command_injection,
|
|
314
|
+
guard_env_variable,
|
|
315
|
+
guard_path_traversal,
|
|
316
|
+
)
|
|
294
317
|
|
|
295
318
|
# Prevent path traversal attacks
|
|
296
319
|
safe_path = guard_path_traversal(user_input, base_dir="/app/data")
|
|
@@ -300,6 +323,31 @@ safe_cmd = guard_command_injection(
|
|
|
300
323
|
["git", "clone", repo_url],
|
|
301
324
|
allowed_commands=["git"]
|
|
302
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}")
|
|
303
351
|
```
|
|
304
352
|
|
|
305
353
|
### Retry with Exponential Backoff
|
|
@@ -347,7 +395,7 @@ match result:
|
|
|
347
395
|
### 🔗 Combining Result + Retry with Monitoring
|
|
348
396
|
|
|
349
397
|
```python
|
|
350
|
-
from taipanstack.core.result import safe
|
|
398
|
+
from taipanstack.core.result import safe
|
|
351
399
|
from taipanstack.resilience.retry import retry
|
|
352
400
|
|
|
353
401
|
@retry(
|
|
@@ -362,7 +410,7 @@ def fetch_user_profile(user_id: str) -> dict:
|
|
|
362
410
|
return api_client.get(f"/users/{user_id}")
|
|
363
411
|
|
|
364
412
|
# Retry handles transient failures, Result handles business errors
|
|
365
|
-
profile =
|
|
413
|
+
profile = fetch_user_profile("usr_456").unwrap_or({"name": "Unknown"})
|
|
366
414
|
```
|
|
367
415
|
|
|
368
416
|
### 🔗 Adaptive Resilience Pipeline
|
|
@@ -476,6 +524,8 @@ Contributions are welcome! Please check our [Contributing Guide](CONTRIBUTING.md
|
|
|
476
524
|
- 📝 Documentation improvements
|
|
477
525
|
- 🔧 Pull requests
|
|
478
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
|
+
|
|
479
529
|
---
|
|
480
530
|
|
|
481
531
|
## 📝 License
|
|
@@ -486,9 +536,9 @@ This project is open-sourced under the [MIT License](LICENSE).
|
|
|
486
536
|
|
|
487
537
|
<div align="center">
|
|
488
538
|
|
|
489
|
-
|
|
539
|
+
Made with ❤️ for the Python community
|
|
490
540
|
|
|
491
|
-
[⬆ Back to Top](#-
|
|
541
|
+
[⬆ Back to Top](#-taipanstack)
|
|
492
542
|
|
|
493
543
|
</div>
|
|
494
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
|
-
- **Clean Code & Refactoring**: Significantly reduced cyclomatic complexity across compatibility shims, validators, filesystems, and token buckets. Enforced strict web bridge type hints and clean keyword parameters (PR #971, #976, #979, #984, #988, #993, #997, #1002, #1003).
|
|
38
|
-
- **QA and Standardized Testing**: Fully standardized test file nomenclature, verified **1,460+ passing tests** with 100% genuine branch coverage, and added rigorous microservice chaos engineering simulations (PR #972, #975, #981, #986, #990, #992, #994, #999, #1004).
|
|
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,7 +165,7 @@ 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
|
|
@@ -169,21 +176,25 @@ TaipanStack/
|
|
|
169
176
|
│ ├── resilience/ # 🌊 Reliability patterns (circuit breakers, retries, watchdogs)
|
|
170
177
|
│ ├── security/ # 🛡️ Guards, sanitizers, validators
|
|
171
178
|
│ └── utils/ # 🔧 Cross-cutting utilities (logging, cache, filesystem)
|
|
172
|
-
├── tests/ # ✅
|
|
179
|
+
├── tests/ # ✅ comprehensive test suite, 100% coverage
|
|
173
180
|
├── .semgrep/ # 🔍 Custom SAST rules
|
|
174
181
|
├── .github/ # 🔄 CI/CD + SBOM/SLSA workflows
|
|
175
182
|
├── Dockerfile # 🐳 Hardened multi-stage container
|
|
176
183
|
└── pyproject.toml # 📋 Modern dependency management
|
|
177
184
|
```
|
|
178
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
|
+
|
|
179
190
|
---
|
|
180
191
|
|
|
181
192
|
## 🔐 DevSecOps
|
|
182
193
|
|
|
183
|
-
|
|
194
|
+
TaipanStack integrates security and quality at every level:
|
|
184
195
|
|
|
185
196
|
| Category | Tools | Purpose |
|
|
186
|
-
|
|
197
|
+
| ---------- | ------- | --------- |
|
|
187
198
|
| **SAST** | Bandit, Semgrep + custom rules | Static Application Security Testing |
|
|
188
199
|
| **SCA** | pip-audit | Dependency vulnerability scanning |
|
|
189
200
|
| **SBOM** | Syft (CycloneDX) | Software Bill of Materials |
|
|
@@ -198,7 +209,7 @@ Taipan Stack integrates security and quality at every level:
|
|
|
198
209
|
|
|
199
210
|
```yaml
|
|
200
211
|
# Runs on every push/PR
|
|
201
|
-
✓ Test Matrix → Python 3.11-3.
|
|
212
|
+
✓ Test Matrix → Python 3.11-3.15 × (Ubuntu, macOS, Windows)
|
|
202
213
|
✓ Linux Distros → Ubuntu, Debian, Fedora, openSUSE, Arch, Alpine
|
|
203
214
|
✓ Code Quality → Ruff check & format
|
|
204
215
|
✓ Type Check → Mypy strict mode
|
|
@@ -210,6 +221,13 @@ Taipan Stack integrates security and quality at every level:
|
|
|
210
221
|
|
|
211
222
|
---
|
|
212
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
|
+
|
|
213
231
|
## 📚 API Highlights
|
|
214
232
|
|
|
215
233
|
### Result Types (Rust-Style Error Handling)
|
|
@@ -232,7 +250,11 @@ match divide(10, 0):
|
|
|
232
250
|
### Security Guards
|
|
233
251
|
|
|
234
252
|
```python
|
|
235
|
-
from taipanstack.security.guards import
|
|
253
|
+
from taipanstack.security.guards import (
|
|
254
|
+
guard_command_injection,
|
|
255
|
+
guard_env_variable,
|
|
256
|
+
guard_path_traversal,
|
|
257
|
+
)
|
|
236
258
|
|
|
237
259
|
# Prevent path traversal attacks
|
|
238
260
|
safe_path = guard_path_traversal(user_input, base_dir="/app/data")
|
|
@@ -242,6 +264,31 @@ safe_cmd = guard_command_injection(
|
|
|
242
264
|
["git", "clone", repo_url],
|
|
243
265
|
allowed_commands=["git"]
|
|
244
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}")
|
|
245
292
|
```
|
|
246
293
|
|
|
247
294
|
### Retry with Exponential Backoff
|
|
@@ -289,7 +336,7 @@ match result:
|
|
|
289
336
|
### 🔗 Combining Result + Retry with Monitoring
|
|
290
337
|
|
|
291
338
|
```python
|
|
292
|
-
from taipanstack.core.result import safe
|
|
339
|
+
from taipanstack.core.result import safe
|
|
293
340
|
from taipanstack.resilience.retry import retry
|
|
294
341
|
|
|
295
342
|
@retry(
|
|
@@ -304,7 +351,7 @@ def fetch_user_profile(user_id: str) -> dict:
|
|
|
304
351
|
return api_client.get(f"/users/{user_id}")
|
|
305
352
|
|
|
306
353
|
# Retry handles transient failures, Result handles business errors
|
|
307
|
-
profile =
|
|
354
|
+
profile = fetch_user_profile("usr_456").unwrap_or({"name": "Unknown"})
|
|
308
355
|
```
|
|
309
356
|
|
|
310
357
|
### 🔗 Adaptive Resilience Pipeline
|
|
@@ -418,6 +465,8 @@ Contributions are welcome! Please check our [Contributing Guide](CONTRIBUTING.md
|
|
|
418
465
|
- 📝 Documentation improvements
|
|
419
466
|
- 🔧 Pull requests
|
|
420
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
|
+
|
|
421
470
|
---
|
|
422
471
|
|
|
423
472
|
## 📝 License
|
|
@@ -428,8 +477,8 @@ This project is open-sourced under the [MIT License](LICENSE).
|
|
|
428
477
|
|
|
429
478
|
<div align="center">
|
|
430
479
|
|
|
431
|
-
|
|
480
|
+
Made with ❤️ for the Python community
|
|
432
481
|
|
|
433
|
-
[⬆ Back to Top](#-
|
|
482
|
+
[⬆ Back to Top](#-taipanstack)
|
|
434
483
|
|
|
435
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,
|