Launch secure, high-performance Python applications in seconds.
Features β’ Quick Start β’ Architecture β’ DevSecOps β’ API β’ Contributing
"Write less, build better."
TaipanStack is a battle-tested foundation for production-grade Python projects that combines security, performance, and developer experience into a single, cohesive toolkit.
|
|
|
|
- Python 3.11+ (supports 3.11, 3.12, 3.13, 3.14)
- Poetry (install guide)
pip install taipanstack# Clone the repository
git clone https://github.com/gabrielima7/TaipanStack.git
cd TaipanStack
# Install dependencies
poetry install --with dev
# Run quality checks
make all# Run tests with 100% coverage (1006 tests)
make test
# Check architecture contracts
make lint-imports
# Run security scans
make security
# Run property-based fuzzing
make property-test
# Run performance benchmarks
make benchmarkTaipanStack follows a clean, layered architecture with strict dependency rules enforced by Import Linter.
βββββββββββββββββββββββββββββββββββββββ
β Application β
β (src/app/main.py) β
βββββββββββββββββββ¬ββββββββββββββββββββ
β
βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββ
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Security β β Config β β Utils β
β guards, saniti- β β models, β β logging, retry β
β zers, validatorsβ β generators β β metrics, fs β
ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ
β β β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββ
βΌ
βββββββββββββββββββββββββββββββββββββββ
β Core β
β Result types, base patterns β
βββββββββββββββββββββββββββββββββββββββ
TaipanStack/
βββ src/
β βββ app/ # Application entry point
β βββ taipanstack/
β βββ core/ # π― Result types, functional patterns
β βββ config/ # βοΈ Configuration models & generators
β βββ security/ # π‘οΈ Guards, sanitizers, validators
β βββ utils/ # π§ Logging, metrics, retry, filesystem
βββ tests/ # β
1006 tests, 100% coverage
βββ .semgrep/ # π Custom SAST rules
βββ .github/ # π CI/CD + SBOM/SLSA workflows
βββ Dockerfile # π³ Hardened multi-stage container
βββ pyproject.toml # π Modern dependency management
TaipanStack integrates security and quality at every level:
| Category | Tools | Purpose |
|---|---|---|
| SAST | Bandit, Semgrep + custom rules | Static Application Security Testing |
| SCA | Safety, pip-audit | Dependency vulnerability scanning |
| SBOM | Syft (CycloneDX) | Software Bill of Materials |
| SLSA | Cosign (Sigstore) | Artifact signing & attestation |
| Types | Mypy (strict) | Compile-time type checking |
| Lint | Ruff | Lightning-fast linting & formatting |
| Arch | Import Linter | Dependency rule enforcement |
| Test | Pytest, Hypothesis, mutmut | Property-based & mutation testing |
| Perf | pytest-benchmark | Performance regression detection |
| Containers | Docker (Alpine, rootless) | Hardened-by-default images |
# Runs on every push/PR
β Test Matrix β Python 3.11-3.14 Γ (Ubuntu, macOS, Windows)
β Linux Distros β Ubuntu, Debian, Fedora, openSUSE, Arch, Alpine
β Code Quality β Ruff check & format
β Type Check β Mypy strict mode
β Security β Bandit + Semgrep (custom rules)
β Architecture β Import Linter contracts
β Benchmarks β Performance regression (>5% = fail)
β SBOM + SLSA β Supply-chain attestation on releasefrom taipanstack.core.result import Result, Ok, Err, safe
@safe
def divide(a: int, b: int) -> float:
return a / b
# Explicit error handling with pattern matching
match divide(10, 0):
case Ok(value):
print(f"Result: {value}")
case Err(error):
print(f"Error: {error}")from taipanstack.security.guards import guard_path_traversal, guard_command_injection
# Prevent path traversal attacks
safe_path = guard_path_traversal(user_input, base_dir="/app/data")
# Prevent command injection
safe_cmd = guard_command_injection(
["git", "clone", repo_url],
allowed_commands=["git"]
)from taipanstack.utils.retry import retry
@retry(max_attempts=3, on=(ConnectionError, TimeoutError))
async def fetch_data(url: str) -> dict:
return await http_client.get(url)from taipanstack.utils.circuit_breaker import circuit_breaker
@circuit_breaker(failure_threshold=5, timeout=30)
def call_external_service() -> Response:
return service.call()from taipanstack.core.result import safe, Ok, Err
from taipanstack.utils.circuit_breaker import CircuitBreaker
breaker = CircuitBreaker(failure_threshold=3, timeout=60, name="payments")
@breaker
@safe
def charge_customer(customer_id: str, amount: float) -> dict:
return payment_gateway.charge(customer_id, amount)
# Both circuit protection AND explicit error handling
result = charge_customer("cust_123", 49.99)
match result:
case Ok(receipt):
print(f"Payment successful: {receipt}")
case Err(error):
print(f"Payment failed safely: {error}")from taipanstack.core.result import safe, unwrap_or
from taipanstack.utils.retry import retry
@retry(
max_attempts=3,
on=(ConnectionError, TimeoutError),
on_retry=lambda attempt, max_a, exc, delay: print(
f"β οΈ Attempt {attempt}/{max_a} failed, retrying in {delay:.1f}s..."
),
)
@safe
def fetch_user_profile(user_id: str) -> dict:
return api_client.get(f"/users/{user_id}")
# Retry handles transient failures, Result handles business errors
profile = unwrap_or(fetch_user_profile("usr_456"), {"name": "Unknown"})from taipanstack.utils.cache import cached
from taipanstack.core.result import Result
@cached(ttl=60)
async def get_user_data(user_id: int) -> Result[dict, Exception]:
return await db.fetch(user_id) # Only Ok() results are cachedfrom taipanstack.utils.resilience import fallback, timeout
from taipanstack.core.result import Result
@fallback(fallback_value={"status": "offline"}, exceptions=(TimeoutError,))
@timeout(seconds=5.0)
async def fetch_remote_status() -> Result[dict, Exception]:
return await api.get_status()# Build hardened image
docker build -t taipanstack:latest .
# Run (rootless, read-only)
docker run --rm --read-only taipanstack:latestSecurity features: multi-stage build, Alpine base (<50MB), non-root appuser (UID 1000), healthcheck, no shell in runtime.
| Runtime | Quality | DevSecOps |
|---|---|---|
|
|
|
Contributions are welcome! Please check our Contributing Guide for details on:
- π Bug reports
- β¨ Feature requests
- π Documentation improvements
- π§ Pull requests
This project is open-sourced under the MIT License.
Made with β€οΈ for the Python community