Skip to main content

The settingspec cover

SettingSpec Check Crates.io Version PyPI Version NPM Version

SettingSpec

  1. Concepts
    1. Single file convenience
    2. Declarative profiles as environments
    3. Language independent
    4. Easy secrets
      1. SecretSpec
      2. Dotenv
  2. Learn more

Concepts

Single file convenience

With a single source of truth, i.e., settingspec.toml, you don't need to mentally merge settings from multiple files, say common.toml, dev.toml, prod.toml, etc. No surprise overwrites. One file for all environments, all languages, all submodules.

Declarative profiles as environments

[spec]                               # Optional: Declare the specification here
profile.key = "SETTINGSPEC_PROFILE"  # Default: Environment variable name to switch between profiles
profile.options = [                  # Optional: Enables strict checking of per-profile declarations
  "dev",
  "stage",
  "prod",
]
profile.default = "dev"  # Optional: Default profile when the switch is not set

[settings]                 # Declare the settings here with syntax: `<key>.<profile>.<directive> = <value>`
key1.default.val = "val1"  # Default value for all profiles
key1.prod.val = "prod1"    # Override the default value when SETTINGSPEC_PROFILE=prod

# Strictly define different values for different profiles
key2.dev.val = "dev2"      # When SETTINGSPEC_PROFILE=dev, key2=dev2
key2.stage.val = "stage2"
key2.prod.val = "prod2"

Overrides are intentional and kept in plain sight (see key1).

By not defining a default value, you can ensure that you never miss adding a value for a specific profile (e.g. this file will refuse to load if key2.prod declaration is missing).

Language independent

The command-line tool settingspec can export the final settings into well-known formats such as toml, json, yaml, etc., or hard-coded modules such as .py, .js, .lua, etc., write them to disk, print, or pipe them via stdin or even export as environment variables, allowing you to use a single settingspec.toml without worrying about the target language.

[spec]
export.file = true  # Default: Export all settings into settings.toml
# export.file = {   # Optional: Fine-grained control over what to export
#   "settings.json" = true,
#   "settings.yaml" = {
#     key1 = true,
#     group1 = true,
#     group2.subgroup = true,
#     group3.subgroup.key1 = false,
#     "#tag1" = true,
#   },
# }
export.skip_gitignore = false  # Default: Auto-append exported files to .gitignore if inside a git repo
export.mode = 0x600     # Default: File permission mode for the exported files
export.keep = false     # Default: Cleanup the exported files after the program exits
export.stdout = "toml"  # Optional: Print in toml format
export.env = "PREFIX_"  # Optional: Export as environment variables prefixed with this string
export.stdin = "toml"   # Optional: Pass settings to program stdin in specified format

[settings]
key1.default.val = "val1"
group1.key1.default.val = "group1val1"
group2.subgroup.key1.default.val = "group2val1"
group3.subgroup.key1.default.val = "group3val1"
group3.subgroup.key1.default.tags = ["tag1", "tag2"]

Now export the final settings as declared.

settingspec export

Or keep watching to export when settingspec.toml changes.

settingspec watch

Or directly run the program with exported settings.

settingspec run -- [your program]...

If no export option is specified, the default behavior is to export all settings into settings.toml.

Easy secrets

Unlike regular settings, secrets aren't supposed to be easily visible. So, they are best declared inside hidden/encrypted files and passed via environment variables or via stdin.

However, with SettingSpec, we can ensure that they are actually set and also include them in the final exported settings.

SecretSpec

You can pair up SettingSpec with a declarative secrets manager such as SecretSpec.

secretspec.toml

[project]
name = "my-app"
revision = "1.0"

[profiles.default]
SECRET1 = { description = "Secret One", required = true }
SECRET2 = { description = "Secret Two", required = false }

settingspec.toml

[spec]
profile.options = ["dev", "stage", "prod"]

[settings]
secret1.default.env = "SECRET1"  # Load value from $SECRET1

# Override the default value from environment variables
secret2.default.val = "defaultvalue"  # Default value if $SECRET2 is not set
secret2.default.env = "SECRET2"       # Load value from $SECRET2 if set
secret2.prod.env = "PRODSECRET"       # Load value from $PRODSECRET if SETTINGSPEC_PROFILE=prod

With these set up, run:

secretspec run -- settingspec run -- [your program]...

Dotenv

Or keep things simple with Dotenv.

[spec]
profile.options = ["dev", "stage", "prod"]

envfile.default = ".env"    # Default environment file
envfile.stage = ".env.age"  # Also supports age-encrypted env files
envfile.prod = "-"          # Read from stdin, encrypted or not

# decryption.key.env = "SETTINGSPEC_DECRYPTION_KEY"  # Default
# decryption.key.path = "~/.ssh/"                    # Default

[settings]
secret1.default.env = "SECRET1"     # Load value from $SECRET1

Learn more

Check out the settingspec.toml example file and full specification for more details.

Metadata

Release files for settingspec 0.5.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 settingspec 0.5.0
File Size Uploaded
settingspec-0.5.0.tar.gz 43.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for settingspec 0.5.0
File
settingspec-0.5.0-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details
settingspec-0.5.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
settingspec-0.5.0-py3-none-win32.whl Python 3 none Windows x86-32 Details
settingspec-0.5.0-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details
settingspec-0.5.0-py3-none-musllinux_1_2_i686.whl Python 3 none Linux musl 1.2+ x86-32 Details
settingspec-0.5.0-py3-none-musllinux_1_2_armv7l.whl Python 3 none Linux musl 1.2+ ARMv7l Details
settingspec-0.5.0-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details
settingspec-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
settingspec-0.5.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl Python 3 none Linux glibc 2.17+ IBM System/390x Details
settingspec-0.5.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl Python 3 none Linux glibc 2.17+ PowerPC 64-le Details
settingspec-0.5.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl Python 3 none Linux glibc 2.17+ x86-32 Details
settingspec-0.5.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl Python 3 none Linux glibc 2.17+ ARMv7l Details
settingspec-0.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
settingspec-0.5.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
settingspec-0.5.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 14.7 MB

Release files / settingspec-0.5.0.tar.gz

Download URL settingspec-0.5.0.tar.gz
Size 43.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c2eccae1d8a7202a97b3c3789d30aeb1c1e673ed6cd559b80e4aa5abafa6e51b
BLAKE2b-256 checksum
How to use checksums
618adfc130815dcb77731e03fcb608a42439b00d342570be9ce2c377c98b0450
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / settingspec-0.5.0-py3-none-win_arm64.whl

Download URL settingspec-0.5.0-py3-none-win_arm64.whl
Size 844.6 kB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
57cf8aa6bdd21315c3f0620b7533b6bb0221b7206b5897057f5be900898546bf
BLAKE2b-256 checksum
How to use checksums
2f60d76a03af4e6516e93272a631be7769e11a39d01996322de3046832e9a019
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / settingspec-0.5.0-py3-none-win_amd64.whl

Download URL settingspec-0.5.0-py3-none-win_amd64.whl
Size 908.2 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
6d01abffd4dd76e32f276e0ab3b33c4ffe051026f58b0a645284235fe22b5da0
BLAKE2b-256 checksum
How to use checksums
e16bc90334e6e49cd392644fe0a2e97b196cc70b08c399bff4930a4b8cab9b87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / settingspec-0.5.0-py3-none-win32.whl

Download URL settingspec-0.5.0-py3-none-win32.whl
Size 881.4 kB
Tags Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
6dc05b6ef0b9f74f41a8ac85ca9673854c3a2270d26ce77281fac3cc096b4265
BLAKE2b-256 checksum
How to use checksums
1af43067c4bca272069c454fa7fd0f3926bf0a889f8817ffad63e9c6344aaaa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / settingspec-0.5.0-py3-none-musllinux_1_2_x86_64.whl

Download URL settingspec-0.5.0-py3-none-musllinux_1_2_x86_64.whl
Size 1.1 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
2d8d403173060e538f0ac1b328c4a8d6125597839f06e34070248a13f5405fdb
BLAKE2b-256 checksum
How to use checksums
c3ca67f2e6e8ce3ce90fd50b3b7d0c5ac23bc3ae95852f915fc1d5171bb6137e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / settingspec-0.5.0-py3-none-musllinux_1_2_i686.whl

Download URL settingspec-0.5.0-py3-none-musllinux_1_2_i686.whl
Size 1.1 MB
Tags Linux musl 1.2+ x86-32 Python 3
SHA-256 checksum
How to use checksums
6c90bdac5c67dbb47b87ce4c3d551553785d65c6f24bb478ae3713a4c9e4f8f7
BLAKE2b-256 checksum
How to use checksums
eaab630b83387b0a64a730eb0d4548d5555fad0487846a9e526def70eda60adf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / settingspec-0.5.0-py3-none-musllinux_1_2_armv7l.whl

Download URL settingspec-0.5.0-py3-none-musllinux_1_2_armv7l.whl
Size 1.0 MB
Tags Linux musl 1.2+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
8bae49dfa6c01501f75dc4827811769770fb68f358810856723689c2fca9edc4
BLAKE2b-256 checksum
How to use checksums
34b5e27fbf97baa330d5ce5cf713fb2527669bd5b2c36bd2313dd2cc22606b54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / settingspec-0.5.0-py3-none-musllinux_1_2_aarch64.whl

Download URL settingspec-0.5.0-py3-none-musllinux_1_2_aarch64.whl
Size 975.5 kB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
b7be1c9073d9ecb311a7156575133e571859a623b9b7ea8d8f2f4953b292726b
BLAKE2b-256 checksum
How to use checksums
a18fe6b2c242fa93f719aa60543db4a3ad8f426a9dc7436d1afa793fe2b8ae31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / settingspec-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL settingspec-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 998.3 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
3ad51abe7cd4feebad77cb50edaa31f9599d3f66266025ac30fab6d5da7d803c
BLAKE2b-256 checksum
How to use checksums
87ebe21e16fafdf38f0f770df202e1a5ddb2a62eb43dafdbbb3fd67cdbe6126d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / settingspec-0.5.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL settingspec-0.5.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Size 1.1 MB
Tags Linux glibc 2.17+ IBM System/390x Python 3
SHA-256 checksum
How to use checksums
5e584a164d27556bd4300257464f1ee58b4037be2e237514b6f08e029333a69a
BLAKE2b-256 checksum
How to use checksums
ce0e600fdf023ead490dc054517d2d1ae20d864f609962b60991872f6a9a675e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / settingspec-0.5.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL settingspec-0.5.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Size 1.1 MB
Tags Linux glibc 2.17+ PowerPC 64-le Python 3
SHA-256 checksum
How to use checksums
8277f4e5bfc1e7050bb8e2347c0697fde4c8f93f3ab621a1229c3566d1281e6e
BLAKE2b-256 checksum
How to use checksums
c24a0e9ddd9d18e060b73490516270997e6948c01c7d2a071d79768eb2d59c43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / settingspec-0.5.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL settingspec-0.5.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Size 1.0 MB
Tags Linux glibc 2.17+ x86-32 Python 3
SHA-256 checksum
How to use checksums
fa2d8ee7e8ea7dd2c56d80b27290c736fd3136ce3ec67ba8111e2707817b8976
BLAKE2b-256 checksum
How to use checksums
91b917d83178e228893ff70061e57bb2e14ad112e62b24e5abced3fd50d31a21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / settingspec-0.5.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL settingspec-0.5.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 975.7 kB
Tags Linux glibc 2.17+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
24bc348d8207e6b63a7a772aec581416c56336fb13e941f3a43a36c4c49d5699
BLAKE2b-256 checksum
How to use checksums
38436086c68f893819c8572545ceec94a719ff4692f7cc95f2e142d1e632d0d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / settingspec-0.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL settingspec-0.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 928.3 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
072118f416e1ebc609c6484c3bd977a24286844058fbe58b135183363ecf1d0f
BLAKE2b-256 checksum
How to use checksums
f99f0d2cc115947385b5998613790db5275dc745a10f4f6a12cee856c0a56658
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / settingspec-0.5.0-py3-none-macosx_11_0_arm64.whl

Download URL settingspec-0.5.0-py3-none-macosx_11_0_arm64.whl
Size 873.5 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e57ed64e5ab03b958fc63bbebe2f2eb50632fdf9bc5e3d42a193f01a69b31cbd
BLAKE2b-256 checksum
How to use checksums
31f001152ac07e9c0d98f0d22ebf8f8071adbdb89ae46e5632361bb37aa6aa22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / settingspec-0.5.0-py3-none-macosx_10_12_x86_64.whl

Download URL settingspec-0.5.0-py3-none-macosx_10_12_x86_64.whl
Size 962.9 kB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
311983436c2a6c1781e4d2f9f22f99d15b3625a9c6010b1a18a5d009ab40749d
BLAKE2b-256 checksum
How to use checksums
629c947a2bc29d0e372951cd05dec1f1d0f9044eddf15405680a2cc6f4727991
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.7.0

16 release files

0.6.0

16 release files

0.5.1

16 release files

This release

0.5.0 This release

16 release files

0.4.0

16 release files

0.3.0

16 release files

0.2.0

16 release files

0.1.2

16 release files

0.1.1

16 release files

0.1.0

1 release file

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