Skip to main content

pyknf

Merge layered JSON and TOML configuration files into a dict. This is the same Rust merge the knf command line runs, called natively.

pip install pyknf    # also installs the `knf` executable (the knf-cli package)
from knf import deep_merge

config = deep_merge(["base.toml", "prod.json"], override={"server": {"port": 8080}})

Files are merged left to right, exactly like knf base.toml prod.json. Objects merge key by key. Arrays, scalars and None replace wholesale. If you pass override, it is merged last as one more layer, which makes it the Python version of --set. It must be a dict of JSON-like values: None, bool, int (within 64 bits), float, str, list/tuple and nested dicts with str keys, at most 128 levels deep and without cycles. Anything else raises TypeError or ValueError naming the key path, before any file is read.

A file that can't be read raises FileNotFoundError, PermissionError or IsADirectoryError, as open() would. Invalid JSON or TOML raises knf.ParseError, a ValueError like json.JSONDecodeError. TOML datetimes come back as their TOML spelling in a str.

See the project README for the merge semantics in full.

Release files for pyknf 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for pyknf 0.3.0
File
pyknf-0.3.0-cp39-abi3-win_arm64.whl CPython 3.9 abi3 Windows ARM64 Details
pyknf-0.3.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
pyknf-0.3.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
pyknf-0.3.0-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details
pyknf-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
pyknf-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
pyknf-0.3.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
pyknf-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 3.2 MB

Release files / pyknf-0.3.0-cp39-abi3-win_arm64.whl

Download URL pyknf-0.3.0-cp39-abi3-win_arm64.whl
Size 279.7 kB
Tags CPython 3.9 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
85d51ffc3b17945b9bdf56e0c3c75bea38f47293861aea1bad4a47b96bec9756
BLAKE2b-256 checksum
How to use checksums
e4deb97d8efabd1306403ec2a27216b0a1e2b1d8c5845187efa314138c4fbcd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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 / pyknf-0.3.0-cp39-abi3-win_amd64.whl

Download URL pyknf-0.3.0-cp39-abi3-win_amd64.whl
Size 291.8 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
337b0afc3bf73f7fcae23e11673abb6a8c59aac37c1c1ae09fd10ee9d174a288
BLAKE2b-256 checksum
How to use checksums
6125f5b10a8ba0d0a34e48b420b11f914d0b80e90084e1321a0ef341ab0898a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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 / pyknf-0.3.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL pyknf-0.3.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 594.5 kB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
d3f431f8f6c7234073b6fcbe31cac041c1ecbd3095c0be02c2dc5542ad57831b
BLAKE2b-256 checksum
How to use checksums
f0b1b35a0f090b02334ed6b0fc0c55fade8579cbec6f363eabf7ebfce32e17a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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 / pyknf-0.3.0-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL pyknf-0.3.0-cp39-abi3-musllinux_1_2_aarch64.whl
Size 542.0 kB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
80d930dddd3c72fe74ccde182afc7f4e7ed6eb164360d0108b5a5b8214f74d63
BLAKE2b-256 checksum
How to use checksums
5040c89e53a9218fc6dbf878781155504dca8bf8156f205ace6936bcef4882f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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 / pyknf-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pyknf-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 381.7 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
c8ad31d14e87e9abf1f5d9e5b2f7d4ca997d76b5efc7599800329dd02b6b22a0
BLAKE2b-256 checksum
How to use checksums
ac61b6e33e527c08e26d3b496d1fc53612e354baa3927c0b643e27ac7a0064dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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 / pyknf-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pyknf-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 363.0 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
e5afcff2d4726582b03b739b44a5851c5b2cd0f9ca8d065539364b0fee8354a0
BLAKE2b-256 checksum
How to use checksums
57e0cd5e16ac4f1ddbd7431b06dceaa96bf74f678f714edf3d82e40c627324ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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 / pyknf-0.3.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL pyknf-0.3.0-cp39-abi3-macosx_11_0_arm64.whl
Size 346.8 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
53b37cf9a40c6f363b422eaddc83d36dd9267e34281a83fc529f77de2b757eaa
BLAKE2b-256 checksum
How to use checksums
7a528e702a28c2b358639a909e6d197ab94fad89dde1a6eb0e4e0adf53244482
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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 / pyknf-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL pyknf-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 350.6 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
819eddedbe8824fcbc6c86b27694a677b879bdbcac62ae91ff5ce2697f7c356e
BLAKE2b-256 checksum
How to use checksums
aff8f4c6f24dda869f35ad28bb930edc29ea64c9a052c56f551d2889f40d25d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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.3.1

8 release files

This release

0.3.0 This release

8 release files

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