Skip to main content

Core framework

Install from PyPI as core-framework, import core_framework. MIT — LICENSE. Repository, PyPI.

Documentation

Doc Purpose
docs/README.md Doc map (platform, design, library, domains, deployments)
docs/library/package-api.md Host import surface and upgrade tables
CHANGELOG.md Release notes (SemVer)

Install

uv add core-framework

Pin hosts to a locked version. On each bump, read CHANGELOG.md and the host-upgrade tables in package-api.md.

Local development

Use Python 3.14. Install uv and Docker.

Tracked config.toml at the repo root is the local-dev settings file (dummy values; no production secrets). Production renders from config.toml.template via deploy envsubst — see architecture decisions.

docker compose -f deploy/app/docker-compose.dev.yaml up -d
uv sync --locked --all-extras --dev
uv run cf-alembic
make run

Firebase: copy firebase_config.example.json to firebase_config.json at the repo root and replace with your Firebase project’s service account JSON from the console.

For make test, use the Firebase CLI (Auth emulator). Stop DB/Redis: docker compose -f deploy/app/docker-compose.dev.yaml down.

Pre-commit: uv sync --dev installs pre-commit. Enable hooks with uv run pre-commit install (ruff, mdformat, uv-lock, and other checks in .pre-commit-config.yaml).

Hosts

In your host app, load Settings or a Settings subclass from core_framework.core.settings, pass it to init_app from core_framework.main, then wire host-specific dependencies and routers. init_app already runs core exception handlers; host-only types use register_exception_handler.

from core_framework.main import init_app
from fastapi import FastAPI

from myapp.settings import HostSettings, load_default_settings


def build_app(settings: HostSettings | None = None) -> FastAPI:
    resolved = settings if settings is not None else load_default_settings()
    app = init_app(resolved)

    from myapp.bootstrap import configure_dependencies

    configure_dependencies(runtime=app.state.core_runtime)

    from myapp.api.router import router

    app.include_router(router)
    return app

From the host repository root, run uv run cf-alembic. See core-framework-migration.

Worker: production also runs the ARQ worker (arq core_framework.worker.main.WorkerSettings, or a host composition that calls the same startup path). Schedules and tasks: workers.md. Composition details: package-api.md (Default deployment entrypoints).

Observability: OpenTelemetry OTLP (not Logfire). Under [observability], set enabled and otlp_endpoint (required when enabled outside local); drop logfire_token / LOGFIRE_TOKEN. Same-host Grafana LGTM stack: deploy/observability/ and observability-lgtm-setup.md. Host upgrade table: package-api.md — observability OTLP.

Host pytest

In your host repository, add the core-framework[testing] extra to dev or test dependencies. In tests/conftest.py, register pytest_core_framework_config (returns TestConfig) and a session-scoped anyio_backend fixture that returns "asyncio". The extra also wraps tests with Blockbuster so core_framework cannot perform stdlib blocking I/O on the asyncio loop.

import pytest

from core_framework.testing import TestConfig

from myapp.settings import load_default_settings


def pytest_core_framework_config() -> TestConfig:
    from myapp.main import build_app

    return TestConfig(
        settings_loader=load_default_settings,
        app_factory=build_app,
    )


@pytest.fixture(scope="session")
def anyio_backend() -> str:
    return "asyncio"

See Package API — Testing and testing plugin design.

Metadata

Release files for core-framework 4.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for core-framework 4.2.1
File Size Uploaded
core_framework-4.2.1.tar.gz 1.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for core-framework 4.2.1
File Interpreter ABI Platform
core_framework-4.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 2.5 MB

Release files / core_framework-4.2.1.tar.gz

Download URL core_framework-4.2.1.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
5c00aeccd62ae6ca205c9b0d78b87e6bf7bdfaabd64adb1ee57abb2cdf7859f4
BLAKE2b-256 checksum
How to use checksums
2b96fc573a7dd19e70a5300b7e9e6713937efceae50da221f7370ddcece57a4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.7.9

Release files / core_framework-4.2.1-py3-none-any.whl

Download URL core_framework-4.2.1-py3-none-any.whl
Size 681.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8ecaf2f4aa30637952d8f9e2fdde2f96c8743c803759c1abe55c88be87df704
BLAKE2b-256 checksum
How to use checksums
4afb1cdd77bb07644fa39be72f5cfd3fe3ad379deb4c7e3d669cc6adb5e6ddf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.7.9

Release history Release notifications | RSS feed

This release

4.2.1 This release

2 release files

4.2.0

2 release files

4.1.0

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.3.0

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.3.3

2 release files

2.3.2

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.8.1

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.0.0

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page