Skip to main content

The settingspec cover

SettingSpec Check Crates.io Version PyPI Version NPM Version

  1. Concepts
    1. Single file convenience
    2. Declarative profiles / 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 / 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 (or specify fine-grained file map)
# 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 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"  # Load environment variables from this file for all profiles
envfile.prod = "-"        # Load environment variables from stdin when SETTINGSPEC_PROFILE=prod

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

Learn more

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

Release files for settingspec 0.3.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.3.0
File Size Uploaded
settingspec-0.3.0.tar.gz 32.1 kB Details

Built distributions (wheels)

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

Total release size: 9.8 MB

Release files / settingspec-0.3.0.tar.gz

Download URL settingspec-0.3.0.tar.gz
Size 32.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ef87ee4def0486438be995f740126c8abe44a37f5fc8693f7dc8f74464f3ca7f
BLAKE2b-256 checksum
How to use checksums
90a9733a852556977f356b83168914ed354f230bb265a80c0f1fd72e8a145a40
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.3.0-py3-none-win_arm64.whl

Download URL settingspec-0.3.0-py3-none-win_arm64.whl
Size 547.2 kB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
045e1d23fe3c9b6aa46766f7ee3627778321c5679a256d60327633a65385b8d5
BLAKE2b-256 checksum
How to use checksums
70571a97092bd2e36b61fbb603d274107e535e752a6ae4785bcbfd5683aea622
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.3.0-py3-none-win_amd64.whl

Download URL settingspec-0.3.0-py3-none-win_amd64.whl
Size 586.2 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
043e549f2b015dda9557e8341db785eab60361748827744b6e8a606d7e445416
BLAKE2b-256 checksum
How to use checksums
0f20aabcbb130c8f504873ef070ecb0550a0a50fea6874cec83ce0a0b4c794ac
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.3.0-py3-none-win32.whl

Download URL settingspec-0.3.0-py3-none-win32.whl
Size 556.3 kB
Tags Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
6030fee9bedb68db978dac34614ee4e6ed22e5174aa46f21cb8ec878f82fd934
BLAKE2b-256 checksum
How to use checksums
097481a4f9658fe741420f2cfe4002c7afa390bdf13e39234a3e235f5cd13a58
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.3.0-py3-none-musllinux_1_2_x86_64.whl

Download URL settingspec-0.3.0-py3-none-musllinux_1_2_x86_64.whl
Size 721.8 kB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
4a9043881a36506e37512ce3b4449c0e80670fab4882f6e9d75b2abb3c21b350
BLAKE2b-256 checksum
How to use checksums
4fd3d312e8f1515f50689f95ceaaf790069c09e968d8aabae8005efe2004a09b
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.3.0-py3-none-musllinux_1_2_i686.whl

Download URL settingspec-0.3.0-py3-none-musllinux_1_2_i686.whl
Size 718.7 kB
Tags Linux musl 1.2+ x86-32 Python 3
SHA-256 checksum
How to use checksums
84789ba53b9bdc07b697dee9368f6b5903cb91777950d557b2ad49f695ce89a6
BLAKE2b-256 checksum
How to use checksums
3349e1114251004417d7bde40a17fa5b5279413b58b2741e6948a204c071fdd3
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.3.0-py3-none-musllinux_1_2_armv7l.whl

Download URL settingspec-0.3.0-py3-none-musllinux_1_2_armv7l.whl
Size 682.9 kB
Tags Linux musl 1.2+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
2e7786d16bd6627bef38628b2a6ecd26f12d8a53ef2ef33a55110cb53e494909
BLAKE2b-256 checksum
How to use checksums
dd9cdd44cc1edc05692d174c1976e493a6c49caeb6c95d375e1c4751c147eb45
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.3.0-py3-none-musllinux_1_2_aarch64.whl

Download URL settingspec-0.3.0-py3-none-musllinux_1_2_aarch64.whl
Size 673.3 kB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
81ab5977ca62150417cd8e0bb78e57648580d107cf146d2608fc9627afae82e3
BLAKE2b-256 checksum
How to use checksums
669344da4f0695288274db3e40df474cb8a8740a7e6cdf28255f95eaae739d74
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.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL settingspec-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 667.4 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
568537d37aac744ff1c6dadcb06cfff7f7fa59ca804fd84d5cdb0a3568c4a1ec
BLAKE2b-256 checksum
How to use checksums
178f61ff892a85bb1065a1d8e3c99ffa1fa92c0402e880915d7e321b6edaba9e
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.3.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL settingspec-0.3.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Size 748.7 kB
Tags Linux glibc 2.17+ IBM System/390x Python 3
SHA-256 checksum
How to use checksums
bf8f8c1c684aa835ea092982b8ab17985477c80c8578f1f4cf385c31c15042f3
BLAKE2b-256 checksum
How to use checksums
0091a26aae8ea6ca369ba3aa61b39a5df3afb1956a8502327275552aa1bcbab0
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.3.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL settingspec-0.3.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Size 714.5 kB
Tags Linux glibc 2.17+ PowerPC 64-le Python 3
SHA-256 checksum
How to use checksums
2e24a489a035626f0e27d2adf428a659bd39bcc978def61081541cc8fa8ef636
BLAKE2b-256 checksum
How to use checksums
c7f69313d4f00dd37519d205a7a2e8fcf82303481bbb085cdd5ee3a420d0fc01
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.3.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL settingspec-0.3.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Size 690.6 kB
Tags Linux glibc 2.17+ x86-32 Python 3
SHA-256 checksum
How to use checksums
589f8e1331b5526237d68f0d9351d09b00be8709d83ae548cb802f128ac0d6dd
BLAKE2b-256 checksum
How to use checksums
d5e01f9aa7386d54febb19c4adb770ba2000cc15bbc7e92c095185e97f4a0740
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.3.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL settingspec-0.3.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 651.6 kB
Tags Linux glibc 2.17+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
2e8507e3419d0dacad2efb41d5a5989931aad1e04641572ac74ed3a7be74e367
BLAKE2b-256 checksum
How to use checksums
279dc8e47523174ec9267b4e61d452643146423e350f98c0b9514683fea67af5
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.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL settingspec-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 623.7 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
d82b14f074d02376482609ddffe64f9c388d43e2eb90fc23c70cb17ad3b5e1ea
BLAKE2b-256 checksum
How to use checksums
ddb66442132e1aa88ebf850262f425dbfa53e854e7612da1aefe96b387158d5c
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.3.0-py3-none-macosx_11_0_arm64.whl

Download URL settingspec-0.3.0-py3-none-macosx_11_0_arm64.whl
Size 585.8 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e3aad60dbb0a71fc93b8422471feb628eada9806352043dfcce7f890eb1d8250
BLAKE2b-256 checksum
How to use checksums
56ae0fffe233d5dd944daeab05215dac7f3024de18e89b92bbbf815aef7e0403
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.3.0-py3-none-macosx_10_12_x86_64.whl

Download URL settingspec-0.3.0-py3-none-macosx_10_12_x86_64.whl
Size 638.4 kB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
f17482c06255afcde17642d2642dae513abc2eb6af959923a760ec671bb07fab
BLAKE2b-256 checksum
How to use checksums
55b3e7a7da0d048d5194ab01f340de8de5ba7f9d49646cf62602f4ae805669f8
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

This release

0.3.0 This release

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