Skip to main content

PyPI Version Python Versions License

GitHub Stars GitHub Forks GitHub Issues Last Commit

Repo Size Latest Release Telegram

pystack-core

Author : Trix Cyrus (Vicky)

Operating System for Python Applications

pystack-core is a unified runtime layer that provides essential application infrastructure through a single, coherent API. Instead of installing and configuring 20+ packages, install pystack-core and gain instant access to configuration, logging, HTTP, caching, databases, AI, scheduling, metrics, and more.

Vision

Every Python application should start with a solid foundation. pystack-core aims to become the standard runtime layer that Python developers begin their applications with.

Installation

pip install pystack-core

Quick Start

from pystack_core import App

app = App()

# Everything is configured and ready to use
response = await app.http.get("https://api.example.com/users")
await app.cache.set("users", response.json)
users = await app.db.query("SELECT * FROM users")
app.logger.info("Fetched users", count=len(users))

Features

  • Configuration: Unified configuration from environment variables, files, and remote sources
  • Logging: Structured logging with automatic context injection
  • HTTP Client: Automatic retry, timeout, metrics, and tracing
  • Cache: Multi-backend caching (Memory, Redis, Disk)
  • Database: Unified database interface (PostgreSQL, MySQL, SQLite, MongoDB)
  • AI: Provider-agnostic AI interface (OpenAI, Anthropic, Gemini)
  • Queue: Background tasks with multiple backends
  • Scheduler: Cron and natural language scheduling
  • Secrets: Unified secrets management
  • Metrics: Automatic metrics collection and export
  • Events: Event bus for cross-module communication
  • Authentication: Multiple auth strategies
  • CLI: Project scaffolding and development tools
  • Plugin System: Extensible plugin architecture

Documentation

Quick Start

import asyncio
from pystack_core import App, AppConfig

async def main():
    # Create application with configuration
    config = AppConfig(
        name="my-app",
        environment="production",
        log_level="INFO"
    )
    app = App(config=config)
    
    # Start the application
    await app.start()
    
    # Use the logger
    app.logger.info("Application started")
    
    # Stop the application
    await app.stop()

asyncio.run(main())

For more examples, see the examples directory.

v0.2.0 Features

The current release (v0.2.0) includes production-ready implementations of:

HTTP Client

  • Automatic retry with exponential backoff
  • Configurable timeout management
  • Metrics collection (requests, success rate, latency)
  • Circuit breaker for fault tolerance
  • Basic auth and bearer token support
  • Middleware pipeline for request/response processing

Cache System

  • Multi-backend support (Memory, Redis, Disk)
  • TTL support with automatic expiration
  • LRU eviction for memory cache
  • Statistics tracking (hit rate, cache size)
  • Batch operations for efficiency
  • Cache manager for unified backend management

Database System

  • SQLite and PostgreSQL support
  • Transaction management with context managers
  • Connection pooling support
  • Structured query results with metadata
  • Batch query execution
  • Database manager for unified backend management

Core Runtime (from v0.1.0)

  • Application lifecycle management with async support
  • Dependency injection container with singleton/transient resolution
  • Middleware pipeline for cross-cutting concerns
  • Context management for application state
  • Startup and shutdown hooks with error isolation

Configuration System (from v0.1.0)

  • Multi-source configuration loading (environment, YAML, JSON, TOML)
  • Automatic type conversion (strings to bool, int, float, JSON)
  • Pydantic schema validation with detailed error reporting
  • Smart configuration merging from multiple sources
  • Nested configuration value management

Logging System (from v0.1.0)

  • Structured logging with automatic context injection
  • Multiple formatters (console with colors, JSON, text)
  • Async logging with queue-based processing for high performance
  • File handlers with rotation support
  • Request tracking with async-safe contextvars
  • Cloud logging adapters (CloudWatch, Loggly)

Performance

pystack-core v0.2.0 is designed for high-performance scenarios:

  • Logging: 10,000+ logs/sec throughput
  • Configuration: 1,000+ loads/sec
  • App startup: <1 second
  • App shutdown: <1 second
  • Dependency resolution: 10,000+ resolutions/sec
  • HTTP client: Sub-millisecond request overhead
  • Cache operations: 100,000+ ops/sec (memory backend)
  • Database queries: Optimized with connection pooling

Testing

The project includes comprehensive test coverage:

  • 100+ tests covering all core functionality
  • Integration tests for all modules
  • Performance benchmarks meeting production targets
  • Memory efficiency tests
# Run tests
pytest

# Run with coverage
pytest --cov=pystack_core

Development

# Clone the repository
git clone https://github.com/TrixSec/pystack-core.git
cd pystack-core

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run linting
ruff check pystack_core
black pystack_core
mypy pystack_core

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

GPL-3.0 License - see LICENSE for details.

Community

Metadata

Release files for pystack-core 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pystack-core 0.2.0
File Size Uploaded Provenance Actions
pystack_core-0.2.0.tar.gz 59.1 kB Without provenance Details for pystack_core-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pystack-core 0.2.0
File Interpreter ABI Platform Actions
pystack_core-0.2.0-py3-none-any.whl Python 3 none any Details for pystack_core-0.2.0-py3-none-any.whl

Total release size: 76.2 kB

Release files / pystack_core-0.2.0.tar.gz

Download URL pystack_core-0.2.0.tar.gz
Size 59.1 kB
Tags Source
SHA-256 checksum
How to use checksums
78c38720519fda658795bdda7af5c7df82162f80c34c6b37005026a318669b11
BLAKE2b-256 checksum
How to use checksums
2ec0aef095468fb9458604dd416fee43482419ce3ca422b577b96a79a15ddaa8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / pystack_core-0.2.0-py3-none-any.whl

Download URL pystack_core-0.2.0-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6085d9b198985538be930dc0d1cacc0df4add9564e93e5ae48076544004b5757
BLAKE2b-256 checksum
How to use checksums
d4ee7624baf7018707279350e2f55878f9713567705f7d18f16f0c8ed1aa2ee0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Security for pystack-core 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page