Skip to main content

configflow

Shared config loader, environment variable resolver, and generic CRUD API factory for Analytic AI services.

What it does

  • File-based config loading – load JSON config files with automatic ${ENV_VAR} placeholder resolution
  • ClickHouse-backed config store – versioned config management with live updates (no redeployment needed)
  • Generic CRUD API factory – create full REST APIs for any ClickHouse table in one function call
  • Config Management API – standardized config endpoints with versioning and reload support
  • Environment variable resolution – supports ${VAR} and ${VAR:default} patterns
  • ClickHouse table utilities – create tables with MergeTree engines, materialized views, projections

Installation

Basic Installation (Config Loading Only)

pip install configuration-core

With API Support (FastAPI + Pydantic)

pip install configuration-core[api]

With Everything (API + Cython Protection)

pip install configuration-core[all]

Quick Start

File-based Config Loading

from pathlib import Path
from configflow import load_config_from_path

# Load JSON config with automatic ${ENV_VAR} resolution
config = load_config_from_path(Path("config/config.json"))
print(config["database"]["host"])  # Resolved from environment

ClickHouse-backed Config Store

from configflow import ConfigStore, load_config_from_path

# Load initial config from file (once at startup)
cfg = load_config_from_path(Path("config/config.json"))

# Create versioned config store backed by ClickHouse
store = ConfigStore(
    initial_config=cfg,
    clickhouse_params=cfg["clickhouse"],
    config_name="my_service_config",
    environment="production",
)

# Get live config from database (cached after first call)
live_config = store.get_config()

# Update config at runtime (no redeployment needed)
store.patch_config({"threshold": 0.95})

# Reload from database
fresh_config = store.get_config(refresh=True)

Generic CRUD API (NEW in v0.2.0)

from fastapi import FastAPI
from configflow import create_crud_router
from clickhouse_core import ClickHouseConfig, get_client

app = FastAPI()

# Create full CRUD API for any ClickHouse table
crud_router = create_crud_router(
    table_name="users",
    clickhouse_client=get_client(ClickHouseConfig.from_env()),
    primary_key="user_id",
)

app.include_router(crud_router, prefix="/api/users", tags=["Users"])

# Now you have:
# GET /api/users?limit=10&offset=0
# GET /api/users/{user_id}
# POST /api/users
# PUT /api/users/{user_id}
# DELETE /api/users/{user_id}

Config Management API (NEW in v0.2.0)

from fastapi import FastAPI
from configflow import create_config_router, ConfigStore

app = FastAPI()

store = ConfigStore(
    initial_config=cfg,
    clickhouse_params=cfg["clickhouse"],
    config_name="service_config",
)

# Add standardized config endpoints
config_router = create_config_router(store)
app.include_router(config_router, prefix="/api/config", tags=["Config"])

# Provides:
# GET /api/config - Get current config
# PATCH /api/config - Partial update
# PUT /api/config - Full replace
# POST /api/config/reload - Reload from database

Dependencies

  • clickhouse-core (≥0.2.4) – shared ClickHouse connectivity library
  • fastapi (≥0.100.0) – optional, for API features
  • pydantic (≥2.0.0) – optional, for API features

Configuration

Environment variables for ClickHouse connection (inherited from clickhouse-core):

  • CLICKHOUSE_HOST
  • CLICKHOUSE_PORT
  • CLICKHOUSE_DATABASE
  • CLICKHOUSE_USERNAME
  • CLICKHOUSE_PASSWORD
  • CLICKHOUSE_PROTOCOL (tcp|http)
  • CLICKHOUSE_SECURE (true/false)

Documentation

For detailed usage, API reference, and advanced features, see:

Key Features

Recommended Usage Pattern

Use load_config_from_path only once at service startup to read connection parameters.
After that, always use ConfigStore.get_config() to get live config from the database.

Why?

JSON file ConfigStore (DB)
When to use Startup only All runtime reads
Supports live updates ❌ No – requires redeploy ✅ Yes – patch at runtime
Versioned history ❌ No ✅ Yes – full version history
Shared across pods ❌ No – each pod reads its own file ✅ Yes – all pods share one DB

Environment Variable Resolution

  • Supports ${VAR} and ${VAR:default} patterns in JSON config files
  • Variables are resolved at config read time
  • DB stores raw placeholders; resolution happens on each get_config() call
  • Same config works across all environments (dev/staging/prod)

Generic CRUD API Factory

  • Generate full REST APIs for any ClickHouse table
  • Automatic query building with filters, pagination, sorting
  • Type-safe Pydantic models generated from table schema
  • Customizable routes and permissions

License

See LICENSE file for details.

Author

sreeyenan (sreeyenanek@gmail.com)

Version

Current version: 0.2.2

Metadata

Release files for configuration-core 0.2.3

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

Source distribution (sdist)

Source distribution for configuration-core 0.2.3
File Size Uploaded
configuration_core-0.2.3.tar.gz 42.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for configuration-core 0.2.3
File
configuration_core-0.2.3-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
configuration_core-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
configuration_core-0.2.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.11 CPython 3.11 Linux glibc 2.5+ x86-32, Linux glibc 2.17+ x86-32 Details
configuration_core-0.2.3-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
configuration_core-0.2.3-cp311-cp311-macosx_10_9_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.9+ x86-64 Details

Total release size: 5.9 MB

Release files / configuration_core-0.2.3.tar.gz

Download URL configuration_core-0.2.3.tar.gz
Size 42.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9c1d4ed18a94f6595a93bcd5608794232bdfc26a5ae640f3d974fe2dfb6b3ef9
BLAKE2b-256 checksum
How to use checksums
c8459463089b28a79fae5e811d3f9859c09d0c2e324b0a2920e7ca172447e6aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release files / configuration_core-0.2.3-cp311-cp311-win_amd64.whl

Download URL configuration_core-0.2.3-cp311-cp311-win_amd64.whl
Size 351.1 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
4d250d51e062eb35d7246c4a2c69bc2f443147d1afab3d4ef6c18fe496b7dae4
BLAKE2b-256 checksum
How to use checksums
fa015460c9a88f9d81b5ae1dfea68b38a8eb1cd88c2489157c44f868d17591b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release files / configuration_core-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL configuration_core-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.4 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
52ff71a0f863090bfbe1d087f054c55ef7ab1d6525f280157b83621dd3cb33d0
BLAKE2b-256 checksum
How to use checksums
704ec073ea66d4f9437f42010a401537de08a2e0febc6d52b1c4858124d6d20e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release files / configuration_core-0.2.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl

Download URL configuration_core-0.2.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Size 2.3 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-32 Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
9f85eb446d82100c50c52bf34b0ff4cf38d26c50854da5d78239e52de57fcfda
BLAKE2b-256 checksum
How to use checksums
287d286c692ad576655c518c6b1b7c18cd385d1b1c962442de36a5c3a81490de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release files / configuration_core-0.2.3-cp311-cp311-macosx_11_0_arm64.whl

Download URL configuration_core-0.2.3-cp311-cp311-macosx_11_0_arm64.whl
Size 398.6 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0da69a75b640688287862710caedb918d2b60cc2c7a0ab71d968193c99724b9b
BLAKE2b-256 checksum
How to use checksums
78e53c609bee11374043c3c2060e7354ec7312df647d684e8a392c49009e87cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release files / configuration_core-0.2.3-cp311-cp311-macosx_10_9_x86_64.whl

Download URL configuration_core-0.2.3-cp311-cp311-macosx_10_9_x86_64.whl
Size 412.6 kB
Tags CPython 3.11 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
1829ec3b7bce1fbf8619f151300ab52f778cd23109abf0834c84c038fd04a4d1
BLAKE2b-256 checksum
How to use checksums
6366d6c12ba27d4cb8bb5a0bf85851945f373762862ca5e627523c5348215e22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.3 This release

6 release files

0.2.2

6 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