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/py_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.0.tar.gz (85.1 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.0-py3-none-any.whl (43.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pystack_core-0.1.0.tar.gz
  • Upload date:
  • Size: 85.1 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.0.tar.gz
Algorithm Hash digest
SHA256 1d6e76dfa20a91a4b1ea050cf6f315e9a8f2e45b214c7ee6eb23291657670d8f
MD5 b809a493031b63034d2ea0443e75011f
BLAKE2b-256 4f97b7b302d5b149fe44646a251ada19f8bcac7df04eed821ec5ca5bbcb39569

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pystack_core-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 43.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23b705153669da10874ef8f30d75c5714620dbd894c6aaf72ed6e0aea1c80c92
MD5 55397f32d17afb5458eb27e87fce806a
BLAKE2b-256 8040ff722a52337c8256b7045b4166b6c3ee584bd17b71ca87df78bf7c4df2f4

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