Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

glom-dict

ci documentation pypi version

Custom Dictionary with glom path compatible get, set and delete methods.

https://glom.readthedocs.io/en/latest/

For easy access to and operations on nested data.

Installation

python -m pip install glom-dict

Examples

>>> from glom_dict import GlomDict
>>> d = GlomDict(my_dict={"a": {"b": "c"}})
>>> d["my_dict.a.b"]
 'c'

>>> d["my_dict.a.b"] = "C"
>>> d["my_dict.a.b"]
 'C'

Better error messages.

>>> d = GlomDict({'a': {'b': None}})
>>> d["a.b.c"]
Traceback (most recent call last):
...
PathAccessError: could not access 'c', index 2 in path Path('a', 'b', 'c'), got error: ...

Glom Paths

from glom_dict import GlomDict, Path
>>> my_path = Path("a", "b", 1)
>>> d = GlomDict({"a": {"b": ["it", "works", "with", "lists", "too"]}})
>>> d[my_path]
'works'

For more examples refer to the excellent glom tutorial.

https://glom.readthedocs.io/en/latest/tutorial.html

Details

Based on collections.UserDict

Implemented methods

  • __getitem__ - glom.glom()
  • __setitem__ - glom.assign()
  • __delitem__ - glom.delete()
  • assign - glom.assign() - can pass missing callable to automatically backfill missing structures.
  • update - Works but no special behavior

Download files

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

Source Distribution

glom-dict-0.0.2a0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

glom_dict-0.0.2a0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file glom-dict-0.0.2a0.tar.gz.

File metadata

  • Download URL: glom-dict-0.0.2a0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Darwin/21.5.0

File hashes

Hashes for glom-dict-0.0.2a0.tar.gz
Algorithm Hash digest
SHA256 61d92dc9befb3ee2c058fd05b1fff102160507c6b0a3c1bc60851b30de06d14f
MD5 4b5e45ef934f7417fba26260642d6b36
BLAKE2b-256 04936eef46f07bb6d4f049a0a5cbe4d41d14e4a3a63c15abd0ca34580fd26bb7

See more details on using hashes here.

File details

Details for the file glom_dict-0.0.2a0-py3-none-any.whl.

File metadata

  • Download URL: glom_dict-0.0.2a0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Darwin/21.5.0

File hashes

Hashes for glom_dict-0.0.2a0-py3-none-any.whl
Algorithm Hash digest
SHA256 e24f5dd34bc85f32e2dbf59549516deef3197fe4ad66d2a9968acb5ea48c2339
MD5 fb437ef5318d25f7a05e999a537d1a55
BLAKE2b-256 b67ce9bd98449a8b3b9bd10dec5ddb42503040ac4b633da266b56cee5a608614

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.2a0 This release

2 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