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, exception handlers, and routers.

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
    from myapp.exception_handlers import setup_exception_handlers

    configure_dependencies(runtime=app.state.core_runtime)
    setup_exception_handlers(app)

    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".

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

core_framework-3.1.0.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

core_framework-3.1.0-py3-none-any.whl (464.7 kB view details)

Uploaded Python 3

File details

Details for the file core_framework-3.1.0.tar.gz.

File metadata

  • Download URL: core_framework-3.1.0.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.9

File hashes

Hashes for core_framework-3.1.0.tar.gz
Algorithm Hash digest
SHA256 67eec190dcfcad3bb8a90efca17c1293c8451996093061d600ec0728ea6c5a5b
MD5 a521f8d3be0b5a805ac883029e6597ba
BLAKE2b-256 b6b07d83ace3b813f9ddf1aaa49fefd1c2d68813505df5ac9c73d2a21b841ec1

See more details on using hashes here.

File details

Details for the file core_framework-3.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for core_framework-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce0333ff6f00f0b1d17b71a005c3c2805d4dec11d2fe16b980a0da2502006f82
MD5 22bc640fc7faed89740d9bbdd423e7cb
BLAKE2b-256 21d42ad9f23ab46e1e04fe9a6fca50e15b132c37acfc042980b4d7d70923e7f3

See more details on using hashes here.

Release history Release notifications | RSS feed

4.0.0

2 files

3.3.0

2 files

3.2.0

2 files

This release

3.1.0 This release

2 files

3.0.0

2 files

2.3.3

2 files

2.3.2

2 files

2.3.1

2 files

2.3.0

2 files

2.2.0

2 files

2.1.0

2 files

2.0.0

2 files

1.8.1

2 files

1.8.0

2 files

1.7.0

2 files

1.6.0

2 files

1.5.0

2 files

1.4.0

2 files

1.3.0

2 files

1.2.0

2 files

1.0.0

2 files

0.3.0

2 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