Skip to main content

The settingspec cover

SettingSpec Check Crates.io Version PyPI Version NPM Version

Table of contents

  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 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.4.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.4.0
File Size Uploaded
settingspec-0.4.0.tar.gz 42.7 kB Details

Built distributions (wheels)

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

Total release size: 14.6 MB

Release files / settingspec-0.4.0.tar.gz

Download URL settingspec-0.4.0.tar.gz
Size 42.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4f5d1ec47a89192de2f2ca64846cd08ca87f18e934c6dc7ead448e4dc3a752e2
BLAKE2b-256 checksum
How to use checksums
a73dc0c09c47b44fecf7d650dcf3823631a85e95af0e79a4e244a25723db7ec2
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.4.0-py3-none-win_arm64.whl

Download URL settingspec-0.4.0-py3-none-win_arm64.whl
Size 831.7 kB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
344ce8f62f5009753a0f07d4b73e7e70633b8d5a52e91f647db8390c2fed0543
BLAKE2b-256 checksum
How to use checksums
ac25e2ae010f01b3515bf2428754784bd24598442a324e8ebe8e67b4240adda2
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.4.0-py3-none-win_amd64.whl

Download URL settingspec-0.4.0-py3-none-win_amd64.whl
Size 896.5 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
9f0ac74ec6e3fb0cf62b309b54740c2f7267b8f4f03c805f7ac95172f2cf487a
BLAKE2b-256 checksum
How to use checksums
d23fe4c5799b55db8eeb39d7ff5bdfd8666b28481f03553b9103ccba5dd96c85
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.4.0-py3-none-win32.whl

Download URL settingspec-0.4.0-py3-none-win32.whl
Size 870.1 kB
Tags Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
dd97f2cee414969ea8bcfc2b5a31945c78903a6854af1bfbd31daf342882d234
BLAKE2b-256 checksum
How to use checksums
b4dd6675eeea6a57bce5418b16b9281d68a24b82df1b43dfeac41b38b98e91fa
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.4.0-py3-none-musllinux_1_2_x86_64.whl

Download URL settingspec-0.4.0-py3-none-musllinux_1_2_x86_64.whl
Size 1.0 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
5bcb96daf41070a3d836be305a58c2982733585201a0fbba36a777265803bf94
BLAKE2b-256 checksum
How to use checksums
92ec84c37237ff18308360168baa0d5ed4c3f336ee647056e54e410ed08457df
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.4.0-py3-none-musllinux_1_2_i686.whl

Download URL settingspec-0.4.0-py3-none-musllinux_1_2_i686.whl
Size 1.0 MB
Tags Linux musl 1.2+ x86-32 Python 3
SHA-256 checksum
How to use checksums
2914e1249798d8bb976db7ef7494c42ab6a61e783c3ea9d3e9f3bfd27e56c6ac
BLAKE2b-256 checksum
How to use checksums
b12948e93c4c72d3d9684ae99d295e75d3d7c9886f7bc53ba28be2d491b8babd
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.4.0-py3-none-musllinux_1_2_armv7l.whl

Download URL settingspec-0.4.0-py3-none-musllinux_1_2_armv7l.whl
Size 994.4 kB
Tags Linux musl 1.2+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
04f85a9d0956a6a49749706ad21c8ebe475a6f5e7d811d05b676e85df03718c0
BLAKE2b-256 checksum
How to use checksums
e6a5fe3df2e3716b3f1bcb0c44d677264cfbe2ea160aa3cf5a1c70e9d942cb1c
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.4.0-py3-none-musllinux_1_2_aarch64.whl

Download URL settingspec-0.4.0-py3-none-musllinux_1_2_aarch64.whl
Size 964.2 kB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
1019167f526262c127327065374ad27e93505102ed88b804c6a6def6745678b4
BLAKE2b-256 checksum
How to use checksums
0963bd4c47d5028dda02480fca6e6351f1abd4cc436aa08ecaea8f2c229813ea
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.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL settingspec-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 987.5 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
03050741f5a53403bce6e15feb0981f2267121299e72efa19b887b3a75308ea7
BLAKE2b-256 checksum
How to use checksums
15118bd424ab542b64763b9e9acb58681a2b6fbc9f3f96280b3f7d966d9841ff
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.4.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL settingspec-0.4.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
6b4b6911b1e38575a6b38364935640ddca5305116875db634ba7589a711a6150
BLAKE2b-256 checksum
How to use checksums
705db3fd1b68e6d2e416f9a68a056b5af0d4169dbf24b27ebddb48ba284defe2
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.4.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL settingspec-0.4.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
174cbbaf409db1b4b3021e4b51db8bf539857be03d7599bb239863a0b8c39336
BLAKE2b-256 checksum
How to use checksums
b09f355f73e50f2f8cd0c589651c943ae1ec7a24f470e55181fc8aac00d95303
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.4.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL settingspec-0.4.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
562db91675d953f331ff0cfc27da00c50ed3c68443cc0eb81351f5a8e2b6a7e9
BLAKE2b-256 checksum
How to use checksums
0b160fc635eab7846bacbbe084739a4ec51ac4b9720141f053bef2c8ee4f4fc2
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.4.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL settingspec-0.4.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 964.8 kB
Tags Linux glibc 2.17+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
b3012d278ddc47092f2b8148e88e51e159b983125f114b56b98e1e1528d11683
BLAKE2b-256 checksum
How to use checksums
1efd854abdc94ca7ebe148bfcab8d54458299a21a40ee46a1989b3987df11a1b
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.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL settingspec-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 916.3 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
314e2162a65a383e1fa591b70a7f76be9e3a209501f19cad9b41538c0d51ac51
BLAKE2b-256 checksum
How to use checksums
a6ea6de1be23b85a2866bfb2e365790e1851420050dd239b4bd7e8eba3173cbc
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.4.0-py3-none-macosx_11_0_arm64.whl

Download URL settingspec-0.4.0-py3-none-macosx_11_0_arm64.whl
Size 863.2 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f6b7b387c6e26c32e9ce6428cdd70524523c35cf1455fd04ea4100130967dd1a
BLAKE2b-256 checksum
How to use checksums
eb5431a2339e8d717f3dbd7db741461a0e52be66c0354d9b0a7fea6bf9b70bf5
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.4.0-py3-none-macosx_10_12_x86_64.whl

Download URL settingspec-0.4.0-py3-none-macosx_10_12_x86_64.whl
Size 953.3 kB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c2072bf19247e13a0bfa0b876b2518563cc86f3ae7fd1ffa13be164ff8a3d61d
BLAKE2b-256 checksum
How to use checksums
472bda3d246022dbc10b81d2f2e824f147db3bd63b09e638477da4f332309eec
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

0.5.0

16 release files

This release

0.4.0 This release

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