Skip to main content

TaipanStack - Modular, secure, and scalable Python stack for robust development

Project description

๐Ÿ TaipanStack

The Modern Python Foundation

Launch secure, high-performance Python applications in seconds.

CI Python Coverage Code Style Type Checked License Security SBOM SLSA PyPI


Features โ€ข Quick Start โ€ข Architecture โ€ข DevSecOps โ€ข API โ€ข Contributing


โœจ Why TaipanStack?

"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.

๐Ÿ›ก๏ธ Security First

  • Path traversal protection
  • Command injection guards
  • Input sanitizers & validators
  • Secret detection integration
  • SBOM + SLSA supply-chain attestation

โšก High Performance

  • uvloop async event loop
  • orjson fast JSON serialization
  • Pydantic v2 validation
  • Performance benchmarks with regression detection

๐ŸŽฏ Rust-Style Error Handling

  • Ok/Err Result types
  • Explicit error propagation
  • Pattern matching support
  • No silent failures

๐Ÿ”ง Developer Experience

  • Pre-configured quality tools
  • 100% code coverage (1006 tests)
  • Architecture enforcement
  • Hardened Docker template

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.11+ (supports 3.11, 3.12, 3.13, 3.14)
  • Poetry (install guide)

Installation

From PyPI

pip install taipanstack

From Source

# Clone the repository
git clone https://github.com/gabrielima7/TaipanStack.git
cd TaipanStack

# Install dependencies
poetry install --with dev

# Run quality checks
make all

Verify Installation

# 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 benchmark

๐Ÿ“ Architecture

TaipanStack 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      โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Project Structure

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

๐Ÿ” DevSecOps

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

CI Pipeline

# 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 release

๐Ÿ“š API Highlights

Result Types (Rust-Style Error Handling)

from 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}")

Security Guards

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"]
)

Retry with Exponential Backoff

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)

Circuit Breaker

from taipanstack.utils.circuit_breaker import circuit_breaker

@circuit_breaker(failure_threshold=5, timeout=30)
def call_external_service() -> Response:
    return service.call()

๐Ÿ”— Combining Result + Circuit Breaker

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}")

๐Ÿ”— Combining Result + Retry with Monitoring

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"})

Intelligent Caching

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 cached

Fallbacks & Timeouts

from 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()

๐Ÿณ Docker

# Build hardened image
docker build -t taipanstack:latest .

# Run (rootless, read-only)
docker run --rm --read-only taipanstack:latest

Security features: multi-stage build, Alpine base (<50MB), non-root appuser (UID 1000), healthcheck, no shell in runtime.


๐Ÿ› ๏ธ Tech Stack

Runtime Quality DevSecOps
  • Pydantic v2
  • Orjson
  • Uvloop
  • Structlog
  • Result
  • Ruff
  • Mypy
  • Bandit
  • Pytest + Hypothesis
  • mutmut
  • pytest-benchmark
  • GitHub Actions
  • Syft + Cosign (SBOM/SLSA)
  • Dependabot
  • Pre-commit
  • Poetry
  • Docker (Alpine, rootless)

๐Ÿค Contributing

Contributions are welcome! Please check our Contributing Guide for details on:

  • ๐Ÿ› Bug reports
  • โœจ Feature requests
  • ๐Ÿ“ Documentation improvements
  • ๐Ÿ”ง Pull requests

๐Ÿ“ License

This project is open-sourced under the MIT License.


Made with โค๏ธ for the Python community

โฌ† Back to Top

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

taipanstack-0.3.10.tar.gz (60.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

taipanstack-0.3.10-py3-none-any.whl (70.9 kB view details)

Uploaded Python 3

File details

Details for the file taipanstack-0.3.10.tar.gz.

File metadata

  • Download URL: taipanstack-0.3.10.tar.gz
  • Upload date:
  • Size: 60.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for taipanstack-0.3.10.tar.gz
Algorithm Hash digest
SHA256 7c917bb606bf4654c1046844273314223ee8fcd22e59b5e638d1c3e711e75efe
MD5 62046233840016dad7b651e182eb16bb
BLAKE2b-256 354b8ee5ea1cc0056b76891a8525887bc03b05c54264cfa4e3bfc33b6a82c258

See more details on using hashes here.

Provenance

The following attestation bundles were made for taipanstack-0.3.10.tar.gz:

Publisher: publish.yml on gabrielima7/TaipanStack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file taipanstack-0.3.10-py3-none-any.whl.

File metadata

  • Download URL: taipanstack-0.3.10-py3-none-any.whl
  • Upload date:
  • Size: 70.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for taipanstack-0.3.10-py3-none-any.whl
Algorithm Hash digest
SHA256 360765db7928b85bb002a49f90883eeb7c9ee140aca20f57147733b1c51c9ca2
MD5 d90170b3a1993f3f682cffeb5a70d262
BLAKE2b-256 7257c9b3ff2a7dc3adc91f919691bd9c6af838d11d981924bd0b6fcd15053502

See more details on using hashes here.

Provenance

The following attestation bundles were made for taipanstack-0.3.10-py3-none-any.whl:

Publisher: publish.yml on gabrielima7/TaipanStack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page