Skip to main content

Core framework package (import as core_framework)

Project description

Core framework

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

Install

uv add core-framework

Local development

Use Python 3.14. Install uv and Docker.

docker compose -f 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 docker-compose.dev.yaml down.

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.

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.

Project details


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-2.2.0.tar.gz (728.2 kB view details)

Uploaded Source

Built Distribution

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

core_framework-2.2.0-py3-none-any.whl (399.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: core_framework-2.2.0.tar.gz
  • Upload date:
  • Size: 728.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.9

File hashes

Hashes for core_framework-2.2.0.tar.gz
Algorithm Hash digest
SHA256 007bc55e091d9538ce4f5921ea464f919f29cf2e296ab606fca94d91e4cf4043
MD5 58b7a7f96eb861c1ba9185305aff041a
BLAKE2b-256 9d56d1b43aa248966ccd4056d26b00ab5a451c2e2cdc005c86318fd870b7ad5f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for core_framework-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38b9a7f6f29621007fd7a8cdd311fe4798254a597ab69c7cced2ff114810c096
MD5 6d5fda40447f175703f54760eec8e052
BLAKE2b-256 2751dd7d9ed86bf6535f974de36b5ff8bfdfd40116cd1fd61c6da2e544269280

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 Pingdom Monitoring Sentry Error logging StatusPage Status page