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    # the module, and the `knf` executable
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.1

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.1
File
pyknf-0.3.1-cp39-abi3-win_arm64.whl CPython 3.9 abi3 Windows ARM64 Details
pyknf-0.3.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
pyknf-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
pyknf-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details
pyknf-0.3.1-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.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
pyknf-0.3.1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
pyknf-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 5.6 MB

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

Download URL pyknf-0.3.1-cp39-abi3-win_arm64.whl
Size 582.6 kB
Tags CPython 3.9 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
898f2f59b963265c4cb35a5bfb18fc31af9f8bfe8a9de6a84650eada897d9faf
BLAKE2b-256 checksum
How to use checksums
4235233ac4a807b83cb934e492f577717958f48093d575d40d3514956483ec32
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.1-cp39-abi3-win_amd64.whl

Download URL pyknf-0.3.1-cp39-abi3-win_amd64.whl
Size 608.9 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
d34b1c88d1ebb9f0947720886b0c2bda86e3c31ddc8eead0f281304fbb744ad1
BLAKE2b-256 checksum
How to use checksums
6ffd7ea9730fa4eb54672ac37bbfd330e79ab3b0c2ca4f2d0f988b339f6fda29
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.1-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL pyknf-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl
Size 911.9 kB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
04d585131f6a16c1f8fb71db9f39629d10218743e5ac8faaeda0e5e438a120e0
BLAKE2b-256 checksum
How to use checksums
09a1c010e6cbcc34756f0ca2abf2e8ca727531b4db3359b9cab2455304fce529
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.1-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL pyknf-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl
Size 839.5 kB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
cec63f32aa81a41ab98b653648b55c65ae5affd06f931f29dd67c596a670e41e
BLAKE2b-256 checksum
How to use checksums
fa888802b3efd12c4fdd399a14ebea68272eeb85e323828067eaa9b58f41862d
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.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pyknf-0.3.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 695.8 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
f06f47f46012482f8b0fb94d881ab94e483146a166878c27f7c3758f5fd68276
BLAKE2b-256 checksum
How to use checksums
a3f9995ef8632492765629cd2fb32739542abc85b787d9b6dc57965dbb842115
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.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pyknf-0.3.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 661.7 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
2849a619f7938a99600cbf5e18648641aa9c0ec686934c8f16a95a868066f1db
BLAKE2b-256 checksum
How to use checksums
a328c86132179431c5d110e7e8d3df44a08a0656b61310bf25c9eef62f322e49
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.1-cp39-abi3-macosx_11_0_arm64.whl

Download URL pyknf-0.3.1-cp39-abi3-macosx_11_0_arm64.whl
Size 638.8 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e14587ecd9e103ccea81450b114688a2a06832aaf22cf8d00e6bc45921f94b55
BLAKE2b-256 checksum
How to use checksums
c64e7099a6288a63684add156eeac51226bbe7ae3e47342131e65df12da932f9
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.1-cp39-abi3-macosx_10_12_x86_64.whl

Download URL pyknf-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl
Size 655.2 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
b49e209ad42d1cad19e9e8a9ebfbbc0f9d3d129566598d0464b87c24c2a82582
BLAKE2b-256 checksum
How to use checksums
17ead410ad839ecea4b59fa30305d242c870830cb070826891e4209db93a1b92
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

This release

0.3.1 This release

8 release files

0.3.0

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