SprigConfig

Spring Boot-style configuration for Python applications

View the Project on GitHub derikgw/sprig-config

Philosophy

SprigConfig is built on a set of guiding principles that inform every design decision. Understanding these principles helps you use the library effectively and predict its behavior.


Core Principles

1. Config behavior is more important than file format

What your configuration does matters more than how it’s written. SprigConfig focuses on predictable, deterministic behavior regardless of whether you use YAML, JSON, or TOML.

The merge algorithm, import resolution, and secret handling work identically across all formats. Parsing is treated as a leaf concern—a detail that shouldn’t affect configuration semantics.

2. Parsing is a leaf concern

SprigConfig separates configuration behavior (merging, profiles, imports) from file parsing. This means:

3. Backward compatibility is sacred in 1.x

Every 1.x release maintains backward compatibility with previous 1.x releases. Existing projects continue to work without changes. Breaking changes are reserved for 2.0.

4. 2.0 only when contracts change

A major version bump happens only when public APIs or documented behavior must change. We avoid version inflation—2.0 means something significant changed.


Design Philosophy

Explicit over implicit

Configuration behavior should be obvious from looking at the files. SprigConfig avoids magic that makes configuration hard to understand.

Deterministic over convenient

Given the same inputs, SprigConfig always produces the same output. There are no race conditions, random behaviors, or order-dependent surprises.

Traceability over minimalism

Every configuration value should be traceable to its source. SprigConfig injects metadata that tells you:

This makes debugging configuration issues straightforward—you can see exactly where each value came from.

Debuggable at 3am

When something goes wrong in production, you need to understand your configuration quickly. SprigConfig is designed to make this easy:


What SprigConfig Is Not

SprigConfig is intentionally focused. It does not:

This focus allows SprigConfig to do its core job exceptionally well.


Supported Formats

SprigConfig supports formats that natively express hierarchical configuration:

Format Supported Reason
YAML Yes Native hierarchy, comments, readability
JSON Yes Strict, portable, tooling support
TOML Yes Modern, stdlib support in Python 3.11+
INI No Flat format requiring invented semantics
Properties No Flat format requiring dot-splitting

Flat formats are not supported because they would require inventing behavior for:

This invented behavior would violate the principle that configuration behavior should be explicit and predictable.


Contributing Considerations

When contributing to SprigConfig, keep these principles in mind:

  1. Preserve existing behavior unless explicitly changing it
  2. Avoid format-specific logic in core paths
  3. Include tests that validate behavior across formats
  4. Choose clarity over cleverness
  5. Document behavior that affects configuration semantics

See CONTRIBUTING.md for detailed guidelines.


← Back to Documentation