{"id":50043905,"url":"https://github.com/maacck/bedrock-py","last_synced_at":"2026-05-24T10:00:42.239Z","repository":{"id":358484559,"uuid":"1232631618","full_name":"maacck/bedrock-py","owner":"maacck","description":"Modular Python framework for building applications with manifest-driven modules, dependency resolution, and lifecycle hooks.","archived":false,"fork":false,"pushed_at":"2026-05-18T04:48:28.000Z","size":1342,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-21T09:20:42.176Z","etag":null,"topics":["agentic-coding","modular-design","modular-framework","module-system","python"],"latest_commit_sha":null,"homepage":"https://bedrock-py.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maacck.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-08T05:51:39.000Z","updated_at":"2026-05-18T01:46:08.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/maacck/bedrock-py","commit_stats":null,"previous_names":["maacck/bedrock-py"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/maacck/bedrock-py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maacck%2Fbedrock-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maacck%2Fbedrock-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maacck%2Fbedrock-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maacck%2Fbedrock-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maacck","download_url":"https://codeload.github.com/maacck/bedrock-py/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maacck%2Fbedrock-py/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33429192,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T22:14:44.296Z","status":"online","status_checked_at":"2026-05-24T02:00:06.296Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agentic-coding","modular-design","modular-framework","module-system","python"],"created_at":"2026-05-21T04:39:59.552Z","updated_at":"2026-05-24T10:00:42.167Z","avatar_url":"https://github.com/maacck.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bedrock\n\nA modular Python application framework with manifest-driven module loading, lifecycle management, and contrib modules for common capabilities.\n\nFramework-agnostic core — no HTTP dependency in the runtime.\n\n## Status\n\n**Early-stage (0.1.0).** The core runtime works and is under active development, but APIs may change.\n\nWhat exists today:\n\n- Module registry with dependency resolution and lifecycle hooks\n- Dependency injection container with singleton/transient/scoped lifetimes\n- Hook system for structured call/response extension points (sync, async, robust)\n- SQLAlchemy 2.0 database layer with Alembic migrations\n- Cache system with memory and Redis.\n- Signal/event system (inspired by Blinker)\n- Typer-based CLI for module and database management\n- Utility library (lazy loading, introspection)\n\nWhat's still planned:\n\n- Additional contrib modules\n- Broader test coverage (currently: signal, cache schema, cache locks, lazy settings)\n\n## Quick start\n\n```bash\n# Install from PyPI\nuv add bedrock-core\n\n# Or install from source for local development\ngit clone https://github.com/maacck/bedrock-py.git\ncd bedrock-py\nuv sync --all-packages\n\n# Verify\nuv run bedrock -v\n\n# Run tests\nuv run pytest packages/bedrock/tests/\n```\n\n### Basic usage\n\n```python\nimport bedrock\n\n# Initialize the runtime (discovers and loads modules)\nbedrock.setup()\n\n# Access key singletons\nfrom bedrock.module import apps          # ModuleRegistry\nfrom bedrock.database import db          # DatabaseManager\n```\n\n## Monorepo structure\n\nThis repository is a `uv` workspace:\n\n```\npackages/\n├── bedrock/           # Core runtime\n└──bedrock-cli/       # Scaffolding CLI (early, 0.0.1)\n```\n\n## Core runtime (`packages/bedrock`)\n\n### Standard module structure\n\n```\nmy_app/\n├── __init__.py\n├── manifest.yaml    # Module identity and dependencies\n├── models.py        # SQLAlchemy models (optional)\n├── entities.py      # Pydantic models for validation\n├── service.py       # Business logic\n├── exc.py           # Module exceptions\n└── bootstrap.py     # Lifecycle hooks\n```\n\n### Module system\n\nManifest-driven module loading with explicit dependency management:\n\n```python\nfrom bedrock.module.registry import ModuleRegistry\n\napps = ModuleRegistry()\napps.install(\"inventory\")  # Validates dependencies, loads in order\napps.populate()            # Runs on_load hooks for all modules\n```\n\n**Module manifest** (`manifest.yaml`):\n\n```yaml\ntitle: inventory\ndescription: Inventory management module\nversion: 0.1.0\ndepends_on:\n  - products\n  - warehouse\ncommands: \"commands:app\"  # Optional: Typer app for CLI integration\n```\n\n**Lifecycle hooks** (in `bootstrap.py`):\n\nBedrock always calls bootstrap hooks with keyword arguments. Hooks should explicitly declare the named parameters they need using keyword-only signatures:\n\n```python\ndef on_load(*, registry, app):\n    \"\"\"Called when module is first loaded.\n    registry=ModuleRegistry, app=AppConfig\n    \"\"\"\n    pass\n\ndef ready(*, registry, app):\n    \"\"\"Called when all modules are loaded and ready.\"\"\"\n    pass\n\ndef on_shutdown(*, registry, app):\n    \"\"\"Called during graceful shutdown.\"\"\"\n    pass\n```\n\nAvailable named parameters (`registry`, `app`, `container`, `hooks`) are injected by the registry based on what each hook declares:\n\n```python\ndef on_load(*, registry, app, container, hooks):\n    \"\"\"All four parameters available: registry, app, container, hooks\"\"\"\n    pass\n```\n\n### Dependency injection\n\nLightweight DI container with three service lifetimes:\n\n```python\nfrom bedrock.di import container, provider, inject, Lifetime\n\n@provider\nclass MyService:\n    pass\n\n@inject(svc=MyService)\ndef do_work(*, svc):\n    svc.do_something()\n\n# Override for tests\nwith container.override(MyService, FakeService()):\n    do_work()\n```\n\n### Hook system\n\nStructured extension points where modules declare specs and register implementations:\n\n```python\nfrom bedrock.hooks import hooks\n\nns = hooks.namespace(\"auth\")\n\n@ns.spec\ndef authenticate(user, password): ...\n\n@ns.impl(priority=10)\ndef check_password(user, password): ...\n\nns.call(\"authenticate\", user=\"alice\", password=\"s3cret\")\n```\n\n### Database layer\n\nSQLAlchemy 2.0 integration with declarative models, session management, and Alembic migrations:\n\n```python\nfrom bedrock.database import db, BedrockModel\nfrom sqlalchemy import Column, String, Integer\n\nclass Product(BedrockModel):\n    __tablename__ = \"products\"\n\n    id = Column(Integer, primary_key=True)\n    name = Column(String(100), nullable=False)\n\n# Transactional session management\nwith db.session_scope() as session:\n    product = Product(name=\"Widget\")\n    session.add(product)\n\n# Query builder with filters, sorting, pagination\nfrom bedrock.database.service import search_filter_sort_paginate\n\nwith db.session_scope() as session:\n    results = search_filter_sort_paginate(\n        db_session=session,\n        model=Product,\n        filter_specs=[{\"field\": \"name\", \"op\": \"ilike\", \"value\": \"%widget%\"}],\n        sort_key=\"name\",\n        page=1,\n        limit=20,\n    )\n```\n\n**CLI for migrations:**\n\n```bash\nbedrock db revision --message \"add products table\"\nbedrock db upgrade\nbedrock db history\n```\n\n## CLI commands\n\n```bash\n# Module management\nbedrock app inspect \u003cmodule\u003e   # Validate manifest and bootstrap\nbedrock app info \u003cmodule\u003e      # Display module details\nbedrock app install \u003cmodule\u003e   # Run migrations and hooks\n\n# Database migrations\nbedrock db revision --message \"description\"\nbedrock db upgrade [revision]\nbedrock db downgrade [revision]\nbedrock db heads               # Show latest revisions\nbedrock db current             # Show current revision\nbedrock db history             # Show migration history\n\n# Run module commands\nbedrock run \u003cmodule\u003e \u003ccommand\u003e  # Execute module-specific CLI\n```\n\n## Dependencies\n\n**Core runtime:**\n- `pydantic` / `pydantic-settings` — Data validation and settings\n- `sqlalchemy` \u003e= 2.0 — Database ORM\n- `alembic` — Database migrations\n- `pyyaml` — Manifest parsing\n- `loguru` — Logging\n- `orjson` — Fast JSON serialization\n- `typer` — CLI framework\n\n**Optional:**\n- `redis` — Redis cache backend (`uv add bedrock-core[cache-redis]`)\n\n## Architecture principles\n\n1. **Framework-agnostic core** — No HTTP dependencies in the module system\n2. **Explicit modularity** — Manifests declare identity and dependencies\n3. **Clean layer boundaries** — Models → Entities → Services → API\n4. **Predictable conventions** — Strict structure for humans and AI\n\n## Testing\n\n```bash\nuv run pytest packages/bedrock/tests/\n```\n\nCoverage is limited — currently covers signal system and lazy settings.\n\n## Documentation\n\nDocs site source lives in `docs-web/` (Fumadocs/Next.js):\n\n```bash\ncd docs-web\npnpm install\npnpm dev\n```\n\n## License\nBedrock is licensed under the MIT License. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaacck%2Fbedrock-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaacck%2Fbedrock-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaacck%2Fbedrock-py/lists"}