Skip to main content

Configuration library with field provenance and secret support

Project description

Cistell

Cistell

A powerful, transparent configuration library with provenance tracking and secret support for Rust and Python.

crates.io PyPI CI Status CodSpeed GitHub license


Overview

Cistell is a configuration resolution engine providing zero-boilerplate settings loading with robust accountability. Built heavily in Rust, it brings performance, type safety, and correctness across two ecosystems:

  • Rust (cistell-core, cistell-macros): Native library with a convenient #[derive(Config)] procedural macro.
  • Python (cistell): Performant bindings that serve as an idiomatic drop-in replacement for the original pure-Python cistell, extending its features with exact provenance APIs and fast resolution.

There's no more guessing where a config value came from. cistell tells you exactly how it resolved each field across 7 different possible priority layers, all while keeping secrets secure.

Features & Highlights

  • Field Provenance Tracking: Inquire exactly where any configuration state was materialized from.
  • Priority Resolution Chain: Values fall through an exact, strictly ordered 7-level priority chain.
  • Secret Management: Built-in Secret<T> wrapper (Rust) and secret=True kwargs (Python) natively redact sensitive config properties across logs and display operations.
  • Zero-Boilerplate Derivation: Simple attribute tagging configures fallback defaults and variable names.

Quick Start (Rust)

Add cistell-core to your Cargo.toml:

[dependencies]
cistell-core = "0.1.0"
use cistell_core::{Config, Secret};

#[derive(Config, Debug)]
struct ServerConfig {
    #[config(default = "127.0.0.1")]
    host: String,

    #[config(default = 8080)]
    port: u16,

    #[config(env = "API_KEY")]
    api_key: Secret<String>,
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let cfg = ServerConfig::load()?;

    println!("Resolved Host: {}", cfg.host);
    // Explain the provenance
    println!("Provenance:\n{}", cistell_core::explain(&cfg));

    Ok(())
}

Quick Start (Python)

Install via pip or uv:

pip install cistell
from cistell import ConfigBase, ConfigField

class MySettings(ConfigBase):
    host = ConfigField("127.0.0.1")
    port = ConfigField(8080)
    api_key = ConfigField("default-key", secret=True)

cfg = MySettings()

print(cfg.host)
print(cfg.api_key) # prints 'default-key'

# Inspect how values were resolved
print(cfg.explain())

# Export a redacted immutable dictionary
print(cfg.safe_dict())

Priority Chain

When resolving a field, Cistell checks the following layers in exact descending order of priority.

Priority Level Source Description
1 Explicit/Overridden Programmatically set at runtime via instantiation or context overrides.
2 Environment Variable Matches PREFIX_FIELD_NAME (or specifically configured env key).
3 Environment File Value parsed statically from a .env file.
4 Selected Config File Value loaded from a specifically pointed config.toml, config.yaml, or .json.
5 pyproject.toml Defaults pulled directly from Python packaging [tool.yourapp] namespace (if applicable).
6 Default Config File The default generic configuration file found in the working directory.
7 Hardcoded Defaults Fallback static definition assigned via macro #[config(default = ...)] or python ConfigField(default).

Feature Flags (Rust)

You can opt-in to parsing requirements in your Cargo.toml for cistell-core:

Feature Default Description
toml TOML file support
yaml YAML file support
json JSON file support
serde Enable Serialize/Deserialize on Secret<T>
zeroize Enable zero-on-drop mapping for Secret<T>

Secret Fields

Keeping secrets out of crash reports and debug prints is critical. By using Secret<T> (Rust) or ConfigField(secret=True) (Python), any underlying representation correctly implements traits or __repr__ functions that output "***" rendering it harmless to standard printing vectors out of the box.

Provenance

Need to figure out if your port was configured by .env, Docker env injection, or fell-back to the code default?

Use cfg.explain() to log the materialized source configuration on startup. Use cfg.safe_dict() to retrieve an inert representation of configuration states. Both functions intrinsically hide secret parameters gracefully.

Python Compatibility

  • Minimum Version: Python 3.12+
  • Dependencies: No Python dependencies. All complex loading natively invokes Rust via PyO3.
  • Available natively via pre-built wheels across Linux (manylinux), macOS (x86_64, arm64), and Windows.

License

Cistell is distributed freely under the MIT License. CENSE).

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

cistell-0.1.1.tar.gz (63.0 kB view details)

Uploaded Source

Built Distributions

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

cistell-0.1.1-cp313-cp313-win_amd64.whl (377.9 kB view details)

Uploaded CPython 3.13Windows x86-64

cistell-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (551.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

cistell-0.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (531.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

cistell-0.1.1-cp313-cp313-macosx_11_0_arm64.whl (483.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

cistell-0.1.1-cp313-cp313-macosx_10_12_x86_64.whl (500.9 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

cistell-0.1.1-cp312-cp312-win_amd64.whl (378.3 kB view details)

Uploaded CPython 3.12Windows x86-64

cistell-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (552.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

cistell-0.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (531.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

cistell-0.1.1-cp312-cp312-macosx_11_0_arm64.whl (484.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

cistell-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl (501.4 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

File details

Details for the file cistell-0.1.1.tar.gz.

File metadata

  • Download URL: cistell-0.1.1.tar.gz
  • Upload date:
  • Size: 63.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cistell-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3c4c82c696508b37fc0d86641e3c5e80214c8412bdeb93a71762730c6c6278d6
MD5 8eed2fd418e2f8cd7ac6bbd1e0739e1e
BLAKE2b-256 daab20b2aa8d437302913782aa21b0987d17cfbbf48d2bf105510853ed4f0385

See more details on using hashes here.

File details

Details for the file cistell-0.1.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: cistell-0.1.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 377.9 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cistell-0.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d48df105075e2e1ad67715655f365167c664d4b250f63f19e8d5f1786af3e02b
MD5 be246f31f7c90c49c5eeae0e7f50ab52
BLAKE2b-256 82fae4fcd607d947a4e697740a6c4372754547439322e7e248898aaa57287c28

See more details on using hashes here.

File details

Details for the file cistell-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cistell-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1f8f8527d55fe8cf29f8985c4e40a9955748e9b0d30380372dcfa4c9eb43c2c8
MD5 6cae9f6bf025d53c52b77359d5422853
BLAKE2b-256 b8099b42269f1b8da1385fcd8d8b25af2f7d75c0a161f84872859e5016928b63

See more details on using hashes here.

File details

Details for the file cistell-0.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cistell-0.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bdc09f5b45e32abfa66d5bf30a091e9de3dfe25126fd003c66f2f0b7b4df672b
MD5 46bb5d656836c9c4b83fa58ff9bb1eb6
BLAKE2b-256 8b62db7d4fe244ec1b7ebcd0c3157b9a47fa85a502be068956fd3fb93f0c8754

See more details on using hashes here.

File details

Details for the file cistell-0.1.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cistell-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e4aa4c4ee534ada6608900cc89a11bcaba0a350d0ec16e3e3af45d60f8bc19ec
MD5 2f686f55ce3dc349c06743f8027bb025
BLAKE2b-256 86d8cafb8571c9e66bd6b3dcc4ff1058faebc32cbc46c1a3f735650c140d3c5b

See more details on using hashes here.

File details

Details for the file cistell-0.1.1-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for cistell-0.1.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f782d6931f24c6b244363eb71fb68c32c77b64c326fbb7d70374afaaf4a81ee4
MD5 45eb3a5f3ff9cf31a451967057ee4876
BLAKE2b-256 24a7bdad50f5c1fc66518a50da6cafc686444a9afdb345b4a81d902dbac95c3d

See more details on using hashes here.

File details

Details for the file cistell-0.1.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: cistell-0.1.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 378.3 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cistell-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0a56c933f70b6073ff94ac1ef191e72dff7bdd2df6b1613356abdc3fa55d40de
MD5 08e18d118924f63788b762282e67b841
BLAKE2b-256 6ffbcc3d0df31a4b946b99067cbfec7628d0ac070d4a9e033c671da62e251304

See more details on using hashes here.

File details

Details for the file cistell-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cistell-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ef6bbd5ed807025617699271c67e333b533ab71b794ad44207cd94f1da9e746e
MD5 7c71713484a04a17a51852ee635fc876
BLAKE2b-256 0ab031e6f89e9bd6f5d772ba1ea3a7ef46986538c57d826f5e7ec98b74bd2820

See more details on using hashes here.

File details

Details for the file cistell-0.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cistell-0.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 90db7d0e1ba240c6c69ea06f4d631ab96e41d0630315116ec44a144d302d4a0c
MD5 fda7289240e0e06bc41f5d2f52a427db
BLAKE2b-256 346e179444ada8464ae069380e336be493de06087717344d1cc3ca4013001103

See more details on using hashes here.

File details

Details for the file cistell-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cistell-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 32e5986b4a59919bce6c0c88c7432b7a3a1560a1d9afd7db4f952c78130591c4
MD5 757c00a1bd402c69dcf99c147293fc53
BLAKE2b-256 086f346bea09dcec18bd760a0348866a4a5cec3a1c126b376399cbdf3cc98fd2

See more details on using hashes here.

File details

Details for the file cistell-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for cistell-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8b41a43dbfc74534091bf8d95b21333ec97aa74ee4d3cf2358a2f080581c65fc
MD5 045d9d34bd01dac3caa1ae1e76093eb2
BLAKE2b-256 a88aa150e71f6357890e8cd39a08fb7eae81c35274b4ebf30d82572e67d98537

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