Metadata-Version: 2.4
Name: bedrock-core
Version: 0.1.0
Summary: A modular Python application framework with manifest-driven module loading, lifecycle management, and contrib modules.
Keywords: framework,modular,module-system,lifecycle,sqlalchemy
Author: maacck
Author-email: maacck <c.mai@madainchina.com>
License-Expression: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Typing :: Typed
Requires-Dist: alembic>=1.18.4
Requires-Dist: asgiref>=3.8.1
Requires-Dist: loguru>=0.7.0
Requires-Dist: orjson>=3.11.8
Requires-Dist: pydantic>=2.12.5
Requires-Dist: pydantic-settings>=2.13.1
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: sqlalchemy>=2.0.49
Requires-Dist: typer>=0.24.1
Requires-Dist: redis>=4.2.0 ; extra == 'cache-redis'
Requires-Python: >=3.12
Project-URL: Bug Tracker, https://github.com/maacck/bedrock-py/issues
Project-URL: Documentation, https://bedrock-py.com
Project-URL: Homepage, https://bedrock-py.com
Project-URL: Repository, https://github.com/maacck/bedrock-py
Provides-Extra: cache-redis
Description-Content-Type: text/markdown

# bedrock

`bedrock` is the runtime core of the Bedrock modular framework.

It provides manifest-driven module loading, lifecycle management, and first-party contrib modules for common capabilities.

## Status

**The core runtime is fully implemented and functional.**

This package contains production-ready subsystems:

- Module registry with dependency resolution and lifecycle hooks
- Dependency injection container with singleton/transient/scoped lifetimes
- Hook system for structured call/response extension points (sync, async, robust)
- SQLAlchemy 2.0 database layer with Alembic migrations
- Cache system with memory and Redis backends
- Signal/event system (blinker-derived)
- Typer-based CLI for module and database management
- Comprehensive utility library (lazy loading, introspection, string helpers)

## Installation

```bash
# With uv (recommended)
uv add bedrock-core

# With poetry
poetry add bedrock-core

# With pip
pip install bedrock-core
```

## Quick Start

```python
import bedrock

# Initialize the runtime (discovers and loads modules)
bedrock.setup()

# Access key singletons
from bedrock.module import apps          # ModuleRegistry
from bedrock.database import db          # DatabaseManager
from bedrock.contrib.cache import cache  # CacheService
```

## Key Singletons

| Singleton | Class | Import |
|-----------|-------|--------|
| `apps` | `ModuleRegistry` | `from bedrock.module import apps` |
| `container` | `Container` | `from bedrock.di import container` |
| `hooks` | `HookRegistry` | `from bedrock.hooks import hooks` |
| `db` | `DatabaseManager` | `from bedrock.database import db` |
| `cache` | `CacheService` | `from bedrock.contrib.cache import cache` |

## Module Structure

```
modules/
└── inventory/
    ├── __init__.py
    ├── manifest.yaml    # Module identity and dependencies
    ├── models.py        # SQLAlchemy models (optional)
    ├── entities.py      # Pydantic models for validation
    ├── service.py       # Business logic
    ├── exc.py           # Module exceptions
    └── bootstrap.py     # Lifecycle hooks
```

## Architecture

Bedrock is framework-agnostic by design. The core runtime has no HTTP dependencies and is usable in:

- API servers (FastAPI, Flask, etc.)
- Background workers (Celery, etc.)
- CLI tools
- Scripts and automation

For more details, see the [documentation](https://bedrock-py.com).
