Skip to main content

Weave

A Rust-backed Python library for merging nested dictionaries. One function, no runtime Python dependencies, and no mutation of your inputs.

Install the weaved distribution from PyPI:

python -m pip install weaved

The import package remains weave. Installing from source requires Rust; the extension uses PyO3 and is built with maturin.

from weave import merge

defaults = {"server": {"host": "localhost", "port": 8000}, "plugins": ["logging"]}
overrides = {"server": {"port": 9000}, "plugins": ["metrics"]}

merge(defaults, overrides)
# {"server": {"host": "localhost", "port": 9000}, "plugins": ["metrics"]}

merge(defaults, overrides, concat_lists=True)
# {"server": {"host": "localhost", "port": 9000}, "plugins": ["logging", "metrics"]}

Merge semantics

merge(left, right, *, concat_lists=False) -> dict

  • Both arguments must be dictionaries (subclasses are accepted).
  • When both values at a key are dictionaries, merge them recursively.
  • Otherwise the right value replaces the left, including None and empty values.
  • With concat_lists=True, two lists concatenate in left-to-right order at every dictionary depth. Duplicates remain; elements are not merged by index.
  • Every dictionary and list reached through dictionary values or list elements is copied. Changing those containers in the result does not change either input. Container subclasses become plain dictionaries and lists, using their stored contents rather than overridden Python methods.
  • Keys and other objects (including tuples, sets, and custom instances) retain their identity. Weave does not traverse them or call __deepcopy__. For example, a list inside an opaque tuple remains shared.
  • Repeated references to the same container are copied separately; alias relationships are not preserved.
  • Existing keys retain their left-hand insertion order. New keys are appended in right-hand order. All hashable Python keys are supported.
  • Traversed cycles or more than 256 nested dictionary/list levels raise RecursionError; Python's own stack guard can stop traversal earlier. Overwritten values are not traversed.
  • Exceptions from key hashing or equality propagate. Inputs must not be mutated during a merge, including from key callbacks.

Development

Requires CPython 3.11+ and Rust 1.85+ to build from source. Native wheels do not require Rust. The extension uses the full Python API for performance, so wheels are specific to a Python version. It holds the GIL while accessing Python objects.

uv sync
uv run pytest
uv run ruff check .
cargo fmt --check
cargo clippy --all-targets -- -D warnings

uv sync builds the extension in release mode. After editing Rust, rebuild it with uv run maturin develop --release before testing. Build distribution artifacts with uv run maturin build --release and uv run maturin sdist.

Performance

The merge walks Python containers directly through PyO3, with native dictionary copies and list concatenation. Scalar leaves stay as Python objects; there is no JSON encoding, deserialization, or conversion to Rust maps.

Run the Airspeed Velocity benchmarks against an equivalent Python implementation:

uv sync
uv run asv continuous --factor 1.15 --interleave-rounds --split HEAD^ HEAD

Benchmarks check matching results before timing and cover flat dictionaries, nested configuration, deep dictionaries, large lists, and list concatenation. Both implementations copy dict/list containers and share opaque leaves. ASV stores results in .asv/results; CI compares each pull request against its base revision on the same runner and uploads the result files as a workflow artifact. The 15% threshold filters small variations. Use release builds and measure your own workload; Python allocation and key hashing still determine much of the cost.

See local benchmark results for measured timings and the machine and sampling conditions.

Metadata

Release files for weaved 0.1.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 weaved 0.1.0
File Size Uploaded Provenance Actions
weaved-0.1.0.tar.gz 35.7 kB With provenance Details for weaved-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for weaved 0.1.0
File Actions
weaved-0.1.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for weaved-0.1.0-cp314-cp314-win_amd64.whl
weaved-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64 Details for weaved-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl
weaved-0.1.0-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for weaved-0.1.0-cp314-cp314-macosx_11_0_arm64.whl
weaved-0.1.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for weaved-0.1.0-cp311-cp311-win_amd64.whl
weaved-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details for weaved-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
weaved-0.1.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for weaved-0.1.0-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 1.1 MB

Release files / weaved-0.1.0.tar.gz

Download URL weaved-0.1.0.tar.gz
Size 35.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bcd1888490e5e730ab3f2d58e18e25a0f84ecde3fde992478b25876c5f9364ba
BLAKE2b-256 checksum
How to use checksums
74abfc9d90c5759c116acde032a59ca6c519acddd7b4214e6c6032a02c595e6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / weaved-0.1.0-cp314-cp314-win_amd64.whl

Download URL weaved-0.1.0-cp314-cp314-win_amd64.whl
Size 100.9 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
df1ff0788884dcad338fa4b924292761ec81a5cd6aa616bd67d6e1aeb5106f22
BLAKE2b-256 checksum
How to use checksums
10f34e3f4d8f0b047d4810368b05a514ff1080702ede0be426bc2d8e1c09f521
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / weaved-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl

Download URL weaved-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl
Size 216.5 kB
Tags CPython 3.14 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
dab054eb8162335a41f1bc084d7575f56961d5c0c0d38cfe9e1598330799c736
BLAKE2b-256 checksum
How to use checksums
a5352c5e3b6fcb33bd5c6196aa5a4388a0531abab453a9428b99e8ce9d827288
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / weaved-0.1.0-cp314-cp314-macosx_11_0_arm64.whl

Download URL weaved-0.1.0-cp314-cp314-macosx_11_0_arm64.whl
Size 198.2 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6bf160b0a135f78965c2b5ec6781f31aee1d0313242faf91edd1c72bbbd6be43
BLAKE2b-256 checksum
How to use checksums
8c8d7a1583d08548e153e05379c755026be1629ccf1323f2f6ce2fcc8b60c3a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / weaved-0.1.0-cp311-cp311-win_amd64.whl

Download URL weaved-0.1.0-cp311-cp311-win_amd64.whl
Size 103.1 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
3c250b51d3efb073abd5ef007154d9d2edbefea34a883f3056a340bf28abf99f
BLAKE2b-256 checksum
How to use checksums
4e19aebb706cd962fe7bdb1c08611d0acbd8f61a556061cf3c86382141fa2467
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / weaved-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL weaved-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
Size 217.2 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
6f01c0b593d38a412c326589ad6adf3bdd270c7fa4a24f172f388695fae7fd7d
BLAKE2b-256 checksum
How to use checksums
de97578593ed249c303148fd19b9559e6996fdbff7b6eddb287cfcfd37111e55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / weaved-0.1.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL weaved-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Size 199.9 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6b2f7fdd55257e8933a5b534d7f7e4c5ea4c4795e2b04abc1e0fb2da1ae32910
BLAKE2b-256 checksum
How to use checksums
b578a0dfb379018526a9421b1c0059c2e272c5fdfc23331427b37e90176f06b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Security for weaved 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for weaved-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

7 release files Full provenance

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