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

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

Built distributions (wheels)

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

Download URL settingspec-0.1.2.tar.gz
Size 31.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bbcb297c9ede52fdb97b0ea5c45c823f08a9fa12fb39ad060dd8194362d70f53
BLAKE2b-256 checksum
How to use checksums
0e24bc10408b9beab10c148a4a3ea0e98a7b565d99406ff67f6776f81c1bb17e
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.2-py3-none-win_arm64.whl

Download URL settingspec-0.1.2-py3-none-win_arm64.whl
Size 543.4 kB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
113fd8c1ae15435c33bea9ab3af51354acdadd071595245f1ba8f3336b962dff
BLAKE2b-256 checksum
How to use checksums
bc33da4c714267728bdbec6565e4621799678558480359158c223f507088c76c
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.2-py3-none-win_amd64.whl

Download URL settingspec-0.1.2-py3-none-win_amd64.whl
Size 581.7 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
ceb4c4126c84ee9ebef2db4a9090a34d371e4dc8fb0f7caaafc008d104e5fad8
BLAKE2b-256 checksum
How to use checksums
e2ef03ac0311cc7a097a212831bb8194e0be7fbc4e0b3608372506632b6b864a
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.2-py3-none-win32.whl

Download URL settingspec-0.1.2-py3-none-win32.whl
Size 552.0 kB
Tags Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
45a8ab4b912f73c0f128098a6255dee4fde1ac86d9e0fbc6477a4a089333e5c1
BLAKE2b-256 checksum
How to use checksums
4cb76b078bcc3b0ba977108ae0275a77bfec301c19aea1ba0573cbad5da72d4e
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.2-py3-none-musllinux_1_2_x86_64.whl

Download URL settingspec-0.1.2-py3-none-musllinux_1_2_x86_64.whl
Size 718.5 kB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
a8536843b2c8f4b9588c51829a8ccc869c72c1fdde52bc278e472fd5401ed6fe
BLAKE2b-256 checksum
How to use checksums
801f138c4714c192386f624b49ac9e398d02f6cf085e8e9e6059f5fc63e27cea
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.2-py3-none-musllinux_1_2_i686.whl

Download URL settingspec-0.1.2-py3-none-musllinux_1_2_i686.whl
Size 716.1 kB
Tags Linux musl 1.2+ x86-32 Python 3
SHA-256 checksum
How to use checksums
4afe2d1f5918fabb1d2599e1fec548c004346c2609e96e80e2477a857dc7c383
BLAKE2b-256 checksum
How to use checksums
0df5c1ba7884ff262f6c9765db44cdf2c95eeabdde7392a659c2eca1f99440cf
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.2-py3-none-musllinux_1_2_armv7l.whl

Download URL settingspec-0.1.2-py3-none-musllinux_1_2_armv7l.whl
Size 679.3 kB
Tags Linux musl 1.2+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
d5849ef7afdf579806752360700482c4213b08ff5040bd0dbd19c0668df68c7a
BLAKE2b-256 checksum
How to use checksums
737b8af2a65583a85180fbffda7bdcc9d00e3e2fef21a81eb9f4cfa01195cf8a
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.2-py3-none-musllinux_1_2_aarch64.whl

Download URL settingspec-0.1.2-py3-none-musllinux_1_2_aarch64.whl
Size 669.6 kB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
680b99856f77026bdbc2302b678db670655b0b110eae617d144bc2fe46d29e33
BLAKE2b-256 checksum
How to use checksums
8b405826b5f46dcd31c24215c16b1b754d6a8205435c44cac3d6fd43823c6a7f
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.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL settingspec-0.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 663.6 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
0aa6f7de7ead5ffdeaf53e9078572652c59a438bee7c8ca0b68472863831f87a
BLAKE2b-256 checksum
How to use checksums
0287adaad3642eda47e54aff826e0c4bede38e034a6d19e81c606209ac096f13
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.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL settingspec-0.1.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Size 744.8 kB
Tags Linux glibc 2.17+ IBM System/390x Python 3
SHA-256 checksum
How to use checksums
916c27987cbf457551eb9a07b852f80a2ff3e2ee989168c42663ff595068e13a
BLAKE2b-256 checksum
How to use checksums
8fc069c8345a826aa9a7a7ab4123740b5dc7bbca576b9dda515bee5a921bb033
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.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL settingspec-0.1.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Size 710.4 kB
Tags Linux glibc 2.17+ PowerPC 64-le Python 3
SHA-256 checksum
How to use checksums
53137fb07085cbc0e4ad4ce21b2dabb7dcdd9e7857289fe0a503651dd1d22258
BLAKE2b-256 checksum
How to use checksums
5579e89175380d78c6932f176d8472482b4dd4ccbf3062c9e75c6085ad15801c
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.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL settingspec-0.1.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Size 687.2 kB
Tags Linux glibc 2.17+ x86-32 Python 3
SHA-256 checksum
How to use checksums
238b4df08fbbd8c9394efa8aa0c0578584e839ab5d0be9e4a5c173a4924e4806
BLAKE2b-256 checksum
How to use checksums
6cdb10a63227d82c7ce8dc110514e0cc118c9040ed9471d5f376f4c16f7a544b
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.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL settingspec-0.1.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 648.8 kB
Tags Linux glibc 2.17+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
c6fcfe5382beeaf77cfaec36abedfcc8dc0063823e550de6e42326e098fc6bb0
BLAKE2b-256 checksum
How to use checksums
1e7e72b2ce9f3561ccd3c5299da933441cfd64b4d3dc777a86e7457d16b5359c
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.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL settingspec-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 620.1 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
d8b5ce64d185cc8fe7986a2eaed0e2a6db3c0527e52a748328da115a525d661b
BLAKE2b-256 checksum
How to use checksums
5599f8f5f250058be778044845a250e38e21d5ac8009d185c5f9b412959b5bd5
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.2-py3-none-macosx_11_0_arm64.whl

Download URL settingspec-0.1.2-py3-none-macosx_11_0_arm64.whl
Size 582.1 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b932d8d1e59e8859d144bec7fa75a4277dd756041e32ec5d0e91a1e74fbc1ad1
BLAKE2b-256 checksum
How to use checksums
4931fce0367c9654c6728974f3db3380347ac4d6c5c570f7248286e2480bd695
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.2-py3-none-macosx_10_12_x86_64.whl

Download URL settingspec-0.1.2-py3-none-macosx_10_12_x86_64.whl
Size 634.3 kB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
23f52b160afbaf4d02399ee5da7a855538cd6d817d10896775d305d326485b84
BLAKE2b-256 checksum
How to use checksums
f4e71b97f48b47167baa7e2b07c72817a52ee82a92b59f1228ca11b19a182930
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.1.2 This release

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