Skip to main content

strata

Multi-dimensional, topologically-driven, dependency-resolving configuration framework, built to handle the complexities of advanced projects.

strata separates what an application needs configured (Variable classes) from where values come from (Layer classes: constructor kwargs, CLI arguments, environment variables, TOML files, in-code defaults). A ConfigSpec joins a list of Variables with an ordered list of Layers, checks at import time that every Variable has at least one provider and that no dependency cycles exist, and produces a Config class. Instantiating it resolves every Variable: the first Layer that can produce a value wins, layer methods can depend on other Variables by naming them as parameters, and every provider's outcome (satisfied, unsatisfied, pruned) is recorded for inspection.

Install

pip install strata

Python 3.10+. Depends on boltons (and tomli on 3.10).

Usage

from strata import (Variable, Layer, ConfigSpec, ConfigFilePath,
                    KwargLayer, CLILayer, EnvVarLayer, TOMLFileLayer)


class ServerHost(Variable):
    cli_arg_name = 'host'
    is_config_kwarg = True
    config_key = 'server.host'


class ServerPort(Variable):
    cli_arg_name = 'port'
    is_config_kwarg = True
    config_key = 'server.port'


class SecretKey(Variable):
    env_var_name = 'APP_SECRET_KEY'


class HostURL(Variable):
    "Full URL of the server, derived from host and port."


class DevDefaultLayer(Layer):
    def server_host(self):
        return '127.0.0.1'

    def server_port(self):
        return 5000

    def secret_key(self):
        return 'dev-only-secret'

    def host_url(self, server_host, server_port):  # depends on two Variables
        return f'http://{server_host}:{server_port}/'


VAR_LIST = [ServerHost, ServerPort, SecretKey, HostURL, ConfigFilePath]
spec = ConfigSpec(VAR_LIST, [KwargLayer, CLILayer, EnvVarLayer,
                             TOMLFileLayer, DevDefaultLayer])
Config = spec.make_config()

config = Config(config_file_path='app.toml')
config.server_port  # kwarg, else --port, else [server] port in app.toml, else 5000
config.host_url     # 'http://127.0.0.1:5000/'

Drop DevDefaultLayer from the list to get a production spec that refuses to start without real values: instantiation raises ConfigException naming each unresolved Variable and every Layer's reason for not providing it.

See ARCHITECTURE.md for the resolution model and the Variable hints each built-in Layer reads.

License

BSD 3-clause, see LICENSE.

Metadata

Release files for strata 26.0.0

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

Source distribution (sdist)

Source distribution for strata 26.0.0
File Size Uploaded
strata-26.0.0.tar.gz 29.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for strata 26.0.0
File Interpreter ABI Platform
strata-26.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 55.9 kB

Release files / strata-26.0.0.tar.gz

Download URL strata-26.0.0.tar.gz
Size 29.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5186b9b16beb496d953268669682e06cafb38e3ad0c381067cb890f69c33115f
BLAKE2b-256 checksum
How to use checksums
42cfc14ad2f15d658ed64204819e1b15443a74f066fd95728ebf3847ff9fedf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Sep 30, 2026.

Transparency log

Release files / strata-26.0.0-py3-none-any.whl

Download URL strata-26.0.0-py3-none-any.whl
Size 26.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72bb71fca8564a121838c38fa2a92d57b3c47b74c831d206d32f7cea6e1423a5
BLAKE2b-256 checksum
How to use checksums
406d591b0a343359affa04e723fdb3a460016da12731114561ae0eb0d177bdfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Sep 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

26.0.0 This release

2 release files

0.0.0dev

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