Shared config loader, env resolver, and generic CRUD API factory for Analytic AI services.
Project description
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_HOSTCLICKHOUSE_PORTCLICKHOUSE_DATABASECLICKHOUSE_USERNAMECLICKHOUSE_PASSWORDCLICKHOUSE_PROTOCOL(tcp|http)CLICKHOUSE_SECURE(true/false)
Documentation
For detailed usage, API reference, and advanced features, see:
- User Manual – comprehensive guide with examples
- Environment Variables – all supported environment variables
- ClickHouse Support – ClickHouse-specific features
- Migration Guide – upgrading from previous versions
- Changelog – version history and changes
Key Features
Recommended Usage Pattern
Use
load_config_from_pathonly once at service startup to read connection parameters.
After that, always useConfigStore.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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file configuration_core-0.2.2.tar.gz.
File metadata
- Download URL: configuration_core-0.2.2.tar.gz
- Upload date:
- Size: 41.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8110cfbbc963b483ee5d98f5d3d517a5ef56541c10c76ed6f4cebf702c08b94
|
|
| MD5 |
d17e11f55508947d39d5383983ddd95c
|
|
| BLAKE2b-256 |
7662afaf366c1af4079ff5751e9223c6ce1cf5b72693ea4e98bb6a4d7d97c5c8
|
Provenance
The following attestation bundles were made for configuration_core-0.2.2.tar.gz:
Publisher:
publish.yml on sreeyenan/configflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
configuration_core-0.2.2.tar.gz -
Subject digest:
f8110cfbbc963b483ee5d98f5d3d517a5ef56541c10c76ed6f4cebf702c08b94 - Sigstore transparency entry: 1574159806
- Sigstore integration time:
-
Permalink:
sreeyenan/configflow@14bae9967b50446ebafc38f2f25e06727a4cc928 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/sreeyenan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14bae9967b50446ebafc38f2f25e06727a4cc928 -
Trigger Event:
push
-
Statement type:
File details
Details for the file configuration_core-0.2.2-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: configuration_core-0.2.2-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 335.7 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
639ae6eb7bf6fd2dc8a4741f62228fc8e001cb9f2221cd4236cc5b89762bbe2a
|
|
| MD5 |
caddaa79b53c9a5b2296c3c8627e8b19
|
|
| BLAKE2b-256 |
2842caeb59c91f4c4d0300b4eca6141ffec354c770d68d062b4a4a724a0b00c4
|
Provenance
The following attestation bundles were made for configuration_core-0.2.2-cp311-cp311-win_amd64.whl:
Publisher:
publish.yml on sreeyenan/configflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
configuration_core-0.2.2-cp311-cp311-win_amd64.whl -
Subject digest:
639ae6eb7bf6fd2dc8a4741f62228fc8e001cb9f2221cd4236cc5b89762bbe2a - Sigstore transparency entry: 1574159938
- Sigstore integration time:
-
Permalink:
sreeyenan/configflow@14bae9967b50446ebafc38f2f25e06727a4cc928 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/sreeyenan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14bae9967b50446ebafc38f2f25e06727a4cc928 -
Trigger Event:
push
-
Statement type:
File details
Details for the file configuration_core-0.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: configuration_core-0.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0658bcc753e03e642f7fea08269099b56b6c774b1008ce4e06a45684f8f06f6b
|
|
| MD5 |
a2b7b4558a13e29317df42e80a286af3
|
|
| BLAKE2b-256 |
926f0647d86c33fcba702eb550474fce58458073d1ab6a25c11ff7526a1eb7ce
|
Provenance
The following attestation bundles were made for configuration_core-0.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
publish.yml on sreeyenan/configflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
configuration_core-0.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
0658bcc753e03e642f7fea08269099b56b6c774b1008ce4e06a45684f8f06f6b - Sigstore transparency entry: 1574159855
- Sigstore integration time:
-
Permalink:
sreeyenan/configflow@14bae9967b50446ebafc38f2f25e06727a4cc928 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/sreeyenan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14bae9967b50446ebafc38f2f25e06727a4cc928 -
Trigger Event:
push
-
Statement type:
File details
Details for the file configuration_core-0.2.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: configuration_core-0.2.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ i686, manylinux: glibc 2.5+ i686
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a93f3a83f461418ccf9265cad5194da673dcb2c809858b8c8be19d3eca049295
|
|
| MD5 |
723bdb940cfeca09ba71a2ecee02be11
|
|
| BLAKE2b-256 |
84f11f18ccdc086189d706461f07ce941b8b95f0f1710073b879242ae2eeddea
|
Provenance
The following attestation bundles were made for configuration_core-0.2.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl:
Publisher:
publish.yml on sreeyenan/configflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
configuration_core-0.2.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl -
Subject digest:
a93f3a83f461418ccf9265cad5194da673dcb2c809858b8c8be19d3eca049295 - Sigstore transparency entry: 1574159825
- Sigstore integration time:
-
Permalink:
sreeyenan/configflow@14bae9967b50446ebafc38f2f25e06727a4cc928 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/sreeyenan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14bae9967b50446ebafc38f2f25e06727a4cc928 -
Trigger Event:
push
-
Statement type:
File details
Details for the file configuration_core-0.2.2-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: configuration_core-0.2.2-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 379.1 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f951f04738e199332e270094b801ad38580b2f1e9809da0d139594008df3ea47
|
|
| MD5 |
7fd2c2ef6f17d6a489fb3635a5eb19f3
|
|
| BLAKE2b-256 |
bba74b0749b4224479d2b59a772a12cfae35c8e3220ac88c70d126891d59b855
|
Provenance
The following attestation bundles were made for configuration_core-0.2.2-cp311-cp311-macosx_11_0_arm64.whl:
Publisher:
publish.yml on sreeyenan/configflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
configuration_core-0.2.2-cp311-cp311-macosx_11_0_arm64.whl -
Subject digest:
f951f04738e199332e270094b801ad38580b2f1e9809da0d139594008df3ea47 - Sigstore transparency entry: 1574159908
- Sigstore integration time:
-
Permalink:
sreeyenan/configflow@14bae9967b50446ebafc38f2f25e06727a4cc928 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/sreeyenan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14bae9967b50446ebafc38f2f25e06727a4cc928 -
Trigger Event:
push
-
Statement type:
File details
Details for the file configuration_core-0.2.2-cp311-cp311-macosx_10_9_x86_64.whl.
File metadata
- Download URL: configuration_core-0.2.2-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 391.2 kB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cec02325c034f9726fcaf51667141a954c411c7de1b149beb33f50b7ffd1b96
|
|
| MD5 |
3e1ea4dfa579709975f876b13f8f70e9
|
|
| BLAKE2b-256 |
60d8469c46fdadf3f66db202a1b2a5043078dbde9f7cca4a3dd10dd243af5ac9
|
Provenance
The following attestation bundles were made for configuration_core-0.2.2-cp311-cp311-macosx_10_9_x86_64.whl:
Publisher:
publish.yml on sreeyenan/configflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
configuration_core-0.2.2-cp311-cp311-macosx_10_9_x86_64.whl -
Subject digest:
0cec02325c034f9726fcaf51667141a954c411c7de1b149beb33f50b7ffd1b96 - Sigstore transparency entry: 1574159883
- Sigstore integration time:
-
Permalink:
sreeyenan/configflow@14bae9967b50446ebafc38f2f25e06727a4cc928 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/sreeyenan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14bae9967b50446ebafc38f2f25e06727a4cc928 -
Trigger Event:
push
-
Statement type: