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 (664 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 (664 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/                # โœ… 664 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"})

๐Ÿณ 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.5.tar.gz (51.6 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.5-py3-none-any.whl (57.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: taipanstack-0.3.5.tar.gz
  • Upload date:
  • Size: 51.6 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.5.tar.gz
Algorithm Hash digest
SHA256 1279f5fc4352b2409a282927ca244392ada1f5a55a5254dcd2282b58ca14f921
MD5 7e8ed11219a55da9a62e6c6a6cf115a8
BLAKE2b-256 da6ca53e6c9d8691d4a822e698f3f5308f1090b2554840f308b1f08dc7f4cd55

See more details on using hashes here.

Provenance

The following attestation bundles were made for taipanstack-0.3.5.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.5-py3-none-any.whl.

File metadata

  • Download URL: taipanstack-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 57.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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 28b753b8f339fd228e6eb33ec8bfd7aabb63d790eae4aaafed63b2bada724e20
MD5 57a194234d56468ce773e29872aaac8d
BLAKE2b-256 00db4d2fed260f0e0ba96d4389e337446b0d56e4922046d98af9d4f1dac924b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for taipanstack-0.3.5-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