Skip to main content

A playful blend of dict and utility/library.

Project description

Dictory

A playful blend of "dict" and "utility/library".

Overview

dictory is a Python package providing useful utilities to work with Python dictionaries. It aims to simplify common dictionary operations and improve your productivity when dealing with nested dicts, mapping, merging, and more.

Features

  • Safe get/set/update/delete operations.
  • Dict merging and diffing.
  • Conversion helpers.
  • Flattening and unflattening dictionaries.
  • Type checking and validation.
  • Customizable key transformations.
  • Support for nested structures.
  • Efficient handling of large dictionaries.
  • Performance optimizations for common operations.

Installation

Using pip,

pip install .
# or for development:
pip install -e .

Using uv,

uv pip install .
# or for development:
uv pip install -e .

Usage

from dictory import dict_utils

# Example: Safe get from nested dict
nested = {"a": {"b": {"c": 123}}}
result = dict_utils.safely_deep_get(nested, "a.b.c")  # 123

# Example: Check if a nested key exists
nested = {"a": {"b": {"c": 123}}}
exists = dict_utils.has_nested(nested, "a.b.c")  # True

# Example : safely deep update a nested dict
nested = {"a": {"b": {"c": 123}}}
dict_utils.safely_deep_update(nested, {"a": {"b": {"d": 456}}})
# nested is now {"a": {"b": {"c": 123, "d": 456}}}

# Example: Delete a nested key
nested = {"a": {"b": {"c": 123}}}
dict_utils.delete_nested(nested, "a.b.c")
# nested is now {"a": {"b": {}}}

# Example: flatten_dict 
flat = dict_utils.flatten_dict({"a": {"b": {"c": 123}}})
# flat is now {"a.b.c": 123}        

Development

Install developer dependencies:

uv sync --extra dev

Run tests:

uv run pytest

License

MIT License

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Authors

Acknowledgements

This project was inspired by the need for more efficient dictionary manipulation in Python. Thanks to the open-source community for their contributions and support.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dictory-0.1.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dictory-0.1.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file dictory-0.1.2.tar.gz.

File metadata

  • Download URL: dictory-0.1.2.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.12

File hashes

Hashes for dictory-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d41d8f6261fc5a4f4df17f987e88ce3f7477b308ca7cefcbfe584ad913f5ae37
MD5 c8c09f4b56dbdc468ee29710a8557372
BLAKE2b-256 f877f9010943723f462c157352fed69a56c2b15d46d421fe0345fddb3166edea

See more details on using hashes here.

File details

Details for the file dictory-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: dictory-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.12

File hashes

Hashes for dictory-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9a8a7da410ddacf57c17b81ecd602dc35f75f126c6669f2326b6b929e8c44a2b
MD5 f54622b8eb10c6fd37f78079a119d4ca
BLAKE2b-256 d500da556df2e8e1236bf0b34f76bb2f3f5cf4f59138c0fed1429b63ed76daa4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page