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
- Usage Guide - Comprehensive usage examples and patterns
- API Documentation - Complete API reference
- v0.2.0 Features - Latest release features
- Changelog - Version history and changes
- Examples - Working code examples
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
- GitHub: https://github.com/TrixSec/pystack-core
- Telegram: https://t.me/Trixsec
- Issues: https://github.com/TrixSec/pystack-core/issues
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pystack_core-0.2.0.tar.gz.
File metadata
- Download URL: pystack_core-0.2.0.tar.gz
- Upload date:
- Size: 59.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78c38720519fda658795bdda7af5c7df82162f80c34c6b37005026a318669b11
|
|
| MD5 |
6a4cbbfcb2dd5b9cef76633be7c8638d
|
|
| BLAKE2b-256 |
2ec0aef095468fb9458604dd416fee43482419ce3ca422b577b96a79a15ddaa8
|
File details
Details for the file pystack_core-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pystack_core-0.2.0-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6085d9b198985538be930dc0d1cacc0df4add9564e93e5ae48076544004b5757
|
|
| MD5 |
ac8f30176a0bb92ac951ab4cfc19ddc8
|
|
| BLAKE2b-256 |
d4ee7624baf7018707279350e2f55878f9713567705f7d18f16f0c8ed1aa2ee0
|