Skip to main content

pydictutils

Deep merge, flatten, pick, omit

Installation

pip install pydictutils

💡 Usage Examples

Basic Operations

from pylib_dictutils import deep_merge, flatten_dict, pick, omit

# Deep merge dictionaries
dict1 = {"a": 1, "b": {"c": 2}}
dict2 = {"b": {"d": 3}, "e": 4}
merged = deep_merge(dict1, dict2)
# {'a': 1, 'b': {'c': 2, 'd': 3}, 'e': 4}

# Flatten nested dictionary
nested = {"a": 1, "b": {"c": 2, "d": 3}}
flat = flatten_dict(nested)
# {'a': 1, 'b.c': 2, 'b.d': 3}

# Pick specific keys
data = {"name": "John", "age": 30, "city": "NYC"}
picked = pick(data, ["name", "age"])
# {'name': 'John', 'age': 30}

# Omit specific keys
omitted = omit(data, ["age"])
# {'name': 'John', 'city': 'NYC'}

AI/ML Use Cases

from pylib_dictutils import deep_merge, flatten_dict, pick, omit

# Merge API responses with defaults
default_config = {"model": "gpt-4", "temperature": 0.7}
user_config = {"temperature": 0.9}
final_config = deep_merge(default_config, user_config)

# Flatten ML model parameters
model_params = {"layers": {"hidden": 128, "output": 10}}
flat_params = flatten_dict(model_params)
# {'layers.hidden': 128, 'layers.output': 10}

📚 API Reference

See package documentation for complete API reference.

🤖 AI Agent Friendly

This package is optimized for AI agents and code generation tools:

  • Clear function names and signatures
  • Comprehensive docstrings with examples
  • Type hints for better IDE support
  • Common use cases documented
  • Zero dependencies for reliability

License

MIT

Release files for pylib-dictutils 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 pylib-dictutils 0.1.0
File Size Uploaded
pylib_dictutils-0.1.0.tar.gz 2.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pylib-dictutils 0.1.0
File Interpreter ABI Platform
pylib_dictutils-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 4.7 kB

Release files / pylib_dictutils-0.1.0.tar.gz

Download URL pylib_dictutils-0.1.0.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0f4cdb1ab3b9a802d2e150994d47f8a4ee4d076f187f70466623834c78fb3b22
BLAKE2b-256 checksum
How to use checksums
19b1f1dc0a546adb063c5ecba7f6eeecf500efe964383847f1768e12b3a90d3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pylib_dictutils-0.1.0-py3-none-any.whl

Download URL pylib_dictutils-0.1.0-py3-none-any.whl
Size 2.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
764899dd4576dc3cffa2f948477ea1229465e9d4b3731970abd05c185ac87fa2
BLAKE2b-256 checksum
How to use checksums
6e7ce0306323dac816dfb5c829af28f9a3681220de484ffba08b3f98157de3ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

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