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.2.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.2.0
File Size Uploaded
settingspec-0.2.0.tar.gz 31.3 kB Details

Built distributions (wheels)

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

Download URL settingspec-0.2.0.tar.gz
Size 31.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f420018af9285860722047c2b974a7ecb762b2344050314656375a8d04c75ca7
BLAKE2b-256 checksum
How to use checksums
6e00c2ced74762b2f0b1ddf340d530dc3451d065b58d3b8b84150cd2cacd87b5
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.2.0-py3-none-win_arm64.whl

Download URL settingspec-0.2.0-py3-none-win_arm64.whl
Size 545.9 kB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
719dd7f8564d383c86305e4882121208bd6d0d65659bc6d5e468310d890cf589
BLAKE2b-256 checksum
How to use checksums
9727e43bd86e53d1079691658b5eb92ed5ae329677f4fe197197b9300fbf7a9b
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.2.0-py3-none-win_amd64.whl

Download URL settingspec-0.2.0-py3-none-win_amd64.whl
Size 584.1 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
5beb9b5c203db95741b1539587c16375b67af974cbb4072ae76dc8103e6f8dc4
BLAKE2b-256 checksum
How to use checksums
fc85929fae62a81325533e1322bb77867b23e1e3b3ebfbf0d893790a43ae1290
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.2.0-py3-none-win32.whl

Download URL settingspec-0.2.0-py3-none-win32.whl
Size 554.7 kB
Tags Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
ba9e033f0d6cfe38353c99234276523eb2fefbae55ff87f06f8698beaa9635d8
BLAKE2b-256 checksum
How to use checksums
2323f231e3861caea8fc7a15cbde42cacf4b8228d45026163a066e0b0b420ecb
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.2.0-py3-none-musllinux_1_2_x86_64.whl

Download URL settingspec-0.2.0-py3-none-musllinux_1_2_x86_64.whl
Size 720.0 kB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
95bf21f8176d51e13d5b4ea7331ebe34aa2459a4b77211be52b8d796beb1891b
BLAKE2b-256 checksum
How to use checksums
da597d103234eddd556c7772488d7ea2ae74c594f40ec71f32d555349c589806
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.2.0-py3-none-musllinux_1_2_i686.whl

Download URL settingspec-0.2.0-py3-none-musllinux_1_2_i686.whl
Size 718.0 kB
Tags Linux musl 1.2+ x86-32 Python 3
SHA-256 checksum
How to use checksums
7dfa5fa951e306cc3d7ee3eda774a9c3f3b524423fa90f85b76594ead4551825
BLAKE2b-256 checksum
How to use checksums
7e1aa441eeef57f34ac23474a77f7b7364e9c0a639687d908c8a2be75ec377ba
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.2.0-py3-none-musllinux_1_2_armv7l.whl

Download URL settingspec-0.2.0-py3-none-musllinux_1_2_armv7l.whl
Size 681.2 kB
Tags Linux musl 1.2+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
59095c11241a5e79d2affdab01ee0d7c17d801f2b041be0193fd8102aad35de9
BLAKE2b-256 checksum
How to use checksums
29293caf21144c30722033c680f986c0dfc02b2270ca350ac1da81cf4348cb0f
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.2.0-py3-none-musllinux_1_2_aarch64.whl

Download URL settingspec-0.2.0-py3-none-musllinux_1_2_aarch64.whl
Size 671.3 kB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
a2419feaafdff020bacd79c730d25d3c552728c4827c07b0031115832b6a9e06
BLAKE2b-256 checksum
How to use checksums
86051519e1529193382bec2eed5a54ad360ece12e6489160b176fc9116338b34
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.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL settingspec-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 665.2 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
c4e08fcbbeb69c961ad054ce4feb4457564dcac9bc7ede7c0b2f581976548ffd
BLAKE2b-256 checksum
How to use checksums
e64b70a26710fa7d0c622871e5632822d14be6b0cdb4cf72eaa39d48dfe63691
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.2.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL settingspec-0.2.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Size 746.9 kB
Tags Linux glibc 2.17+ IBM System/390x Python 3
SHA-256 checksum
How to use checksums
f8fa516a7619d0c0520326831c76ecb0d509ac3beb51b8e254890a15fb98964c
BLAKE2b-256 checksum
How to use checksums
269c37055f6595b0befb806a1e2091941b785efa1fd9c80d8a4f7a579859c8fb
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.2.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL settingspec-0.2.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Size 712.5 kB
Tags Linux glibc 2.17+ PowerPC 64-le Python 3
SHA-256 checksum
How to use checksums
51b7d3dc96a7bf225801ead0152cea5f7e041a4be8438fb2173073256c1f1cfc
BLAKE2b-256 checksum
How to use checksums
dcb857791d9c43b38b8d5247862476e95d926ac8acbc40674507e9e14846a74b
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.2.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL settingspec-0.2.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Size 689.2 kB
Tags Linux glibc 2.17+ x86-32 Python 3
SHA-256 checksum
How to use checksums
c3cda36aaa52fb3f0ead2dafaed6961c38c952074e1775af108e2526ab151e30
BLAKE2b-256 checksum
How to use checksums
0becd6cec6d2ec70d591b1eb00fe0660ab6ca8f055fcbe84fa88dfbbe8e07b59
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.2.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL settingspec-0.2.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 651.0 kB
Tags Linux glibc 2.17+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
12e75cc36c8175bee4927ea7334c43855fdc4488fc82752d43a4933bf3614ba2
BLAKE2b-256 checksum
How to use checksums
fbacded4c5c31cd2a97676f3aaef2056a7794334d634ac5f11f862a92c2c6cba
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.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL settingspec-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 622.1 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
1f91e4ad677174c946a13d32e25ff8eefdf927a5c8f8d2883834e47866594fa7
BLAKE2b-256 checksum
How to use checksums
e2a8439bc66b157f2aa99d16b469ea419e657ff3f39e93a929e0cf60ff0db1d0
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.2.0-py3-none-macosx_11_0_arm64.whl

Download URL settingspec-0.2.0-py3-none-macosx_11_0_arm64.whl
Size 584.0 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8b8d22a073d81450654be4b340b882e790b7f5f3b0e72e64cc047bc44ddeb83a
BLAKE2b-256 checksum
How to use checksums
3e7ca04a2af1cbe3016c81f3768bcb7fb4af0706138baf033a894da20506e1d9
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.2.0-py3-none-macosx_10_12_x86_64.whl

Download URL settingspec-0.2.0-py3-none-macosx_10_12_x86_64.whl
Size 636.0 kB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
721582cebcf56cd7441e51f8d3f17df98e59b60a67317538ae29909f5e9aa036
BLAKE2b-256 checksum
How to use checksums
b8ae4de76d8453782d5f406affd54504d1c83f22acc0692c4c590a16a31512ed
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.2.0 This release

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