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.1.1

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.1.1
File Size Uploaded
settingspec-0.1.1.tar.gz 31.0 kB Details

Built distributions (wheels)

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

Download URL settingspec-0.1.1.tar.gz
Size 31.0 kB
Tags Source
SHA-256 checksum
How to use checksums
151d5ed2e05d4ae3a8f3764e1d796a3c496c8107e5dcd669ec8944978d38a073
BLAKE2b-256 checksum
How to use checksums
86b29a22cacd4bf5394ee02d6a08f8882b28c007035261a26e2e164170976554
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.1.1-py3-none-win_arm64.whl

Download URL settingspec-0.1.1-py3-none-win_arm64.whl
Size 542.6 kB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
36503417d6b8eb2ae59f30a09b4b299140c821a971fc2848325afbf83a69afe6
BLAKE2b-256 checksum
How to use checksums
163c7d135b847befb88be9026d1a3968cace2b21c4113c8a41d3be15e7abf140
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.1.1-py3-none-win_amd64.whl

Download URL settingspec-0.1.1-py3-none-win_amd64.whl
Size 580.6 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
df3508da089e1df135cd7e5a61bf149e26fe7f58fb908f044028b3697750c001
BLAKE2b-256 checksum
How to use checksums
82ae1d515ba05e059ff2c25f9a810cdcf4301b2b0b830aa56b437fa47c19ae1d
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.1.1-py3-none-win32.whl

Download URL settingspec-0.1.1-py3-none-win32.whl
Size 551.9 kB
Tags Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
57e12ecdc7c6eae44e3aca0ab8fd1db7104b92e53f66cfb928f28a9137aa18b6
BLAKE2b-256 checksum
How to use checksums
2afab43875c78af23a65e5bda335743ba6b68f22a9f68f85800657a56c296501
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.1.1-py3-none-musllinux_1_2_x86_64.whl

Download URL settingspec-0.1.1-py3-none-musllinux_1_2_x86_64.whl
Size 717.9 kB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
4547334beed3e967b83ed6514776f352152da0e2735bfca6f122d689e991c88c
BLAKE2b-256 checksum
How to use checksums
a7f5affeac04f866a6419713556776b14e741e3608659370a388b2bc234d0dab
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.1.1-py3-none-musllinux_1_2_i686.whl

Download URL settingspec-0.1.1-py3-none-musllinux_1_2_i686.whl
Size 715.6 kB
Tags Linux musl 1.2+ x86-32 Python 3
SHA-256 checksum
How to use checksums
cabd936db9d5fa8f72a3c5374c68fc82dd820fd721c689bbf826424ccf0b69e0
BLAKE2b-256 checksum
How to use checksums
4e2fffa56e0787d9a6d7204c1cf3e3c0a34217fc166350a91c3148da5a0f7b9b
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.1.1-py3-none-musllinux_1_2_armv7l.whl

Download URL settingspec-0.1.1-py3-none-musllinux_1_2_armv7l.whl
Size 678.9 kB
Tags Linux musl 1.2+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
71fe53438cae330184c4c70b81e89c416dc41f7aa435bda755dabd7eb112a4ab
BLAKE2b-256 checksum
How to use checksums
0af50d35f58a285f8b2d22c0a19b415ea22020b03828281cc4e2acc82d231380
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.1.1-py3-none-musllinux_1_2_aarch64.whl

Download URL settingspec-0.1.1-py3-none-musllinux_1_2_aarch64.whl
Size 668.7 kB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
652db6c4de0e2ff3a45c802cbe6b38bbf13a8795c5291fe4a122d92be18ed7b9
BLAKE2b-256 checksum
How to use checksums
dc7854b0b4d1692566f92c524c3089db03a63b013afb697f846a705d83ddf153
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.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL settingspec-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 663.2 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
0813f4032e74dc06393a2846b1a63d4eaf32a25df6b95f49d0d160a33f66e27c
BLAKE2b-256 checksum
How to use checksums
910d0ddc89fb52349ddef4fdc375e9aa840dd5db0fd411abf2bc59ce334e10c7
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.1.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL settingspec-0.1.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Size 744.1 kB
Tags Linux glibc 2.17+ IBM System/390x Python 3
SHA-256 checksum
How to use checksums
4bc8743180076c6bfaa34632cabca40618294e6fb7e7088e898aa1cc761a391e
BLAKE2b-256 checksum
How to use checksums
f4365e39e4b9a31972ecac0f7a30d4ae55d401bfc95ffe5c1de0a7629e450116
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.1.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL settingspec-0.1.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Size 709.6 kB
Tags Linux glibc 2.17+ PowerPC 64-le Python 3
SHA-256 checksum
How to use checksums
7784e6286c534f566ff5ecdb7b95916a2736c065d409d8767a7e7de7f916f3e2
BLAKE2b-256 checksum
How to use checksums
875e3275d9e412c9a5da9565a1d8c420914ee18760df2fd84913bc2235f5ae54
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.1.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL settingspec-0.1.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Size 687.0 kB
Tags Linux glibc 2.17+ x86-32 Python 3
SHA-256 checksum
How to use checksums
684cdaae0767f8410c91e9a3c52727c6d5c18b3236b19cf40f26020001df421f
BLAKE2b-256 checksum
How to use checksums
2fa3fd1fc8afd3843e197fb37f1fa400f505c317fb3d3a1316512d2a58904c8d
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.1.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL settingspec-0.1.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 649.2 kB
Tags Linux glibc 2.17+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
1bd901cc7fa6e20668f258cf3b6a67560ed9afcfa82d75d2347da303133f810f
BLAKE2b-256 checksum
How to use checksums
0e7945ea6bbeac3f94fcbde4448bf0129f068408096d3829b6f7658a7dbda602
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.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL settingspec-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 619.1 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
71416344b3b4d2b994b2124f709f1186a01dae1b6fb2dd93f173c9db54767362
BLAKE2b-256 checksum
How to use checksums
c15bf1a6d30325702444c6b948ab5942386dc8571776e5f84b26a9b403cb808b
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.1.1-py3-none-macosx_11_0_arm64.whl

Download URL settingspec-0.1.1-py3-none-macosx_11_0_arm64.whl
Size 581.3 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e0b8b018fa3c06d1da9655545903ea3499bb6ed31dadbd09cc66f16ae4fc922f
BLAKE2b-256 checksum
How to use checksums
426565964461583d7d29c2279d45fec7f10235345385a2ff00e183f42eb3ad5d
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.1.1-py3-none-macosx_10_12_x86_64.whl

Download URL settingspec-0.1.1-py3-none-macosx_10_12_x86_64.whl
Size 633.9 kB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
13bd4cfe8c2bc130201adbd69145338244831ccc657ae8656cc4f4489d0f7899
BLAKE2b-256 checksum
How to use checksums
13c6c0675d415bf630f7e19279c04d7940d2cff7dac191499163e7187f17f7d1
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.1.2

16 release files

This release

0.1.1 This release

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