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.1.0 Features

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

Core Runtime

  • 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

  • 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

  • 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.1.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

Testing

The project includes comprehensive test coverage:

  • 79 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=py_core

Development

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

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

# Run tests
pytest

# Run linting
ruff check py_core
black py_core
mypy py_core

Contributing

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

License

GPL-3.0 License - see LICENSE for details.

Community

Download files

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

Source Distribution

pystack_core-0.1.1.tar.gz (86.4 kB view details)

Uploaded Source

Built Distribution

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

pystack_core-0.1.1-py3-none-any.whl (44.3 kB view details)

Uploaded Python 3

File details

Details for the file pystack_core-0.1.1.tar.gz.

File metadata

  • Download URL: pystack_core-0.1.1.tar.gz
  • Upload date:
  • Size: 86.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.0

File hashes

Hashes for pystack_core-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bbd2307574948817a2b640c06275ecba1bdc86e7f77165c3429a30d5a1a05142
MD5 45b9111d79c7b39d36a5d2099eb52c5c
BLAKE2b-256 08f0f08b3081d5ef376d98002c28afa515335921d8338146e39a2b8840299e3d

See more details on using hashes here.

File details

Details for the file pystack_core-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pystack_core-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 44.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.0

File hashes

Hashes for pystack_core-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3e71dab0613cbabcd954db148432e8b9068722e517b89faac855203035b6426e
MD5 9124d7a5dec252a519503025a9425b96
BLAKE2b-256 9e034ed88762d69a85ce9bf315bd024a2e5bf718f06266a85a3ce8dbb63a697f

See more details on using hashes here.

Supported by

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