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 py_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 py_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.2.tar.gz (34.7 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.2-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pystack_core-0.1.2.tar.gz
  • Upload date:
  • Size: 34.7 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.2.tar.gz
Algorithm Hash digest
SHA256 acc81edceaf8c93dcb8ac8a12da1e57cfa70e7e69d160e5d4923e39da356dc9c
MD5 ce06281717cb4e9d20d34f2c5142692b
BLAKE2b-256 a62c72d6a2371526ce9948a6a368a0a1fe93146f82dabcdcdcb147dcda5a3b3a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pystack_core-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 16.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8634db7339d1525ecda0fe50d4ec29e66fcb2f14aa8e6a58699262e830886b5e
MD5 ff86a2683cfbcc83c713fcf1ade1a8de
BLAKE2b-256 0dcbbb9ac2497229a68325d3623d9838e9f4b8ba36c3a9d20fcfb16d65c4c225

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