Skip to main content

Fuso

uv Ruff License: MIT Download/Month PyPI Version Read the Docs

fuso comes from the Italian word fusione, which translates to fusion. This is exactly what this library does; it creates a fusion between two dictionaries.

The goal of this library is to offer a customizable way of deeply merging dictionaries. In its simplest form, fuso offers an experience like other well-established dictionary merging libraries such as deepmerge, mergedeep.

However, where this library differs is that it allows the user to specify custom merge_functions for specific keys.

For example, you may want to concatenate lists for one key, but keep overwrite behavior for other keys. With fuso, this is possible.

Installation

You can install fuso via pip:

pip install fuso

Usage

Here's a basic example of how to use fuso to merge two dictionaries:

from fuso import merge_dict

dict1 = {"settings": {"theme": "dark", "plugins": ["plugin1", "plugin2"]}}
dict2 = {"settings": {"plugins": ["plugin3"], "language": "en"}}
merged_dict = merge_dict(dict1, dict2)
print(merged_dict)
# {
#    "settings": {
#      "theme": "dark",
#      "plugins": ["plugin1", "plugin2", "plugin3"],
#      "language": "en"
#    }
# }

Merge semantics

  • Dicts are merged recursively.
  • Lists are concatenated.
  • Scalars are overwritten by updates.
  • None in updates keeps the original value.
  • Merging non-None values of different types raises TypeError.
  • Duplicate lookup keys in to_list_of_dicts_by_key raise KeyError.

Ordering

  • merge_dict returns keys sorted alphabetically by default.
  • You can control key order with key_order (partial orders are supported).

Documentation

For more detailed documentation, including advanced usage and customization options, please visit the official documentation.

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests on the GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Changes

To see changes by version check the changelog.

Metadata

Release files for fuso 0.4.1

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

Source distribution (sdist)

Source distribution for fuso 0.4.1
File Size Uploaded
fuso-0.4.1.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fuso 0.4.1
File Interpreter ABI Platform
fuso-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.3 kB

Release files / fuso-0.4.1.tar.gz

Download URL fuso-0.4.1.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1e90ee52e0643a5d46394051b5f358184c1ae7775f852489e343361be5622b83
BLAKE2b-256 checksum
How to use checksums
98b3e000790cd990e29df34fbec95c91107481d0081beea4797436c2376da0c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","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 / fuso-0.4.1-py3-none-any.whl

Download URL fuso-0.4.1-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c62d94d39523adf63b1c1305a74662a61f2abbf0a6f6c536151ea7dc003cd05c
BLAKE2b-256 checksum
How to use checksums
843eb9de1b5a1a0c8e568baa19f40be81e4eaf00b7efc93de9b181ccccb2c692
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","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.4.1 This release

2 release files

0.4.0

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.0

2 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