Skip to main content

dotdict-bench

Benchmarking for dot-accessible dict packages in python

deps

More test ideas? Submit an issue!

Package Information

As of 2022-09-21 23:11:19.354375

Package Version Last Commit Stars Forks Description
addict 2.4.0 Tue, 05 Jan 2021 07:16:38 GMT 2277 137 (i)
python-box 6.0.2 Sat, 02 Apr 2022 02:24:21 GMT 2062 89 (i)
dotmap 1.3.30 Wed, 06 Apr 2022 16:26:33 GMT 366 43 (i)
dotwiz 0.4.0 Wed, 21 Sep 2022 22:23:19 GMT 20 1 (i)
easydict 1.9 Sun, 28 Feb 2021 10:26:53 GMT 207 39 (i)
dotsi 0.0.3 Sun, 22 Nov 2020 16:48:22 GMT 18 1 (i)
dictlib 1.1.5 Thu, 15 Aug 2019 23:10:47 GMT 14 3 (i)
diot 0.1.6 Thu, 12 May 2022 20:37:59 GMT 7 2 (i)

Creating an object of the dict subclass

How the packages create an object of the dict subclass

Created
addict {'a': {'b': {'c': 1}}} Type: Dict
python-box {'a': {'b': {'c': 1}}} Type: Box
dotmap DotMap(a=DotMap(b=DotMap(c=1))) Type: DotMap
dotwiz ✫(a=✫(b=✫(c=1))) Type: DotWiz
easydict {'a': {'b': {'c': 1}}} Type: EasyDict
dotsi {'a': {'b': {'c': 1}}} Type: DotsiDict
dictlib {'a': {'b': {'c': 1}}} Type: Dict
diot {'a': Diot({'b': Diot({'c': 1})})} Type: Diot

Creating a dict with preserved keys

How the packages create a dict with preserved keys (e.g. keys, values, items, etc)

Literally, {"keys": 1}

Created or error
addict {'keys': 1}
python-box {'keys': 1}
dotmap DotMap(keys=1)
dotwiz ✫(keys=1)
easydict {'keys': 1}
dotsi {'keys': 1}
dictlib Key 'keys' conflicts with reserved word
diot {'keys': 1}

Creating a dict with magic keys

How the packages create a dict with magic keys (e.g. __name__, __class__, etc)

Literally, {"__name__": 1}

Created or error
addict {'__name__': 1}
python-box {'__name__': 1}
dotmap DotMap(__name__=1)
dotwiz ✫(__name__=1)
easydict {'__name__': 1}
dotsi {'__name__': 1}
dictlib {'__name__': 1}
diot {'__name__': 1}

Accessing values

How the packages to access values

Literally 1 from {"a": {"b": {"c": 1}}}

Way to access value
addict <dict>.a.b.c or <dict>['a']['b']['c']
python-box <dict>.a.b.c or <dict>['a']['b']['c']
dotmap <dict>.a.b.c or <dict>['a']['b']['c']
dotwiz <dict>.a.b.c or <dict>['a']['b']['c']
easydict <dict>.a.b.c or <dict>['a']['b']['c']
dotsi <dict>.a.b.c or <dict>['a']['b']['c']
dictlib dictlib.dig(<dict>, 'a.b.c') or dictlib.Dict(<dict>).a.b.c
diot <dict>.a.b.c or <dict>['a']['b']['c']

Recursive Dot Access

Whether recursive dot access is supported when there are lists in the dict

Literally <dict>.a.b[0].c from {"a": {"b": [{"c": 1}, {"d": 2}]}}

Value or error
addict 1
python-box 1
dotmap 1
dotwiz 1
easydict 1
dotsi 1
dictlib AttributeError: 'dict' object has no attribute 'c'
diot 1

Automatic Hierarchy

Whether a hierarchical structure is created by dot notation

Literally <dict>.a.b.c = 1 creates {"a": {"b": {"c": 1}}}

Created or error
addict {'a': {'b': {'c': 1}}}
python-box KeyError: "'Box' object has no attribute 'a'"
dotmap DotMap(a=DotMap(b=DotMap(c=1)))
dotwiz AttributeError: 'DotWiz' object has no attribute 'a'
easydict AttributeError: 'EasyDict' object has no attribute 'a'
dotsi KeyError: 'a'
dictlib KeyError: 'a'
diot AttributeError: a

Accessing values with preserved keys

How to access values with conflict keys

Literally, accessing values from {"keys": 1, "__name__": 2}

Package obj.keys obj['keys'] obj.__name__ obj['__name__']
addict <built-in method keys of Dict object at 0x7f4455a49c70> 1 2 2
python-box <bound method Box.keys of Box({'keys': 1, '__name__': 2})> 1 2 2
dotmap <bound method DotMap.keys of DotMap(keys=1, __name__=2)> 1 AttributeError: __name__ 2
dotwiz 1 1 2 2
easydict 1 1 2 2
dotsi <built-in method keys of DotsiDict object at 0x7f4455a49c70> 1 2 2
dictlib Can't create Can't create Can't create Can't create
diot <built-in method keys of Diot object at 0x7f4455a49c70> 1 2 2

Accessing dashed keys

How the values with keys with dash are accessed

Literally <dict>.a_b for {"a-b": 1}

Package obj.a_b obj['a_b'] obj['a-b']
addict {} {} 1
python-box 1 KeyError: "'a_b'" 1
dotmap DotMap() DotMap() 1
dotwiz AttributeError: 'DotWiz' object has no attribute 'a_b' KeyError: 'a_b' 1
easydict AttributeError: 'EasyDict' object has no attribute 'a_b' KeyError: 'a_b' 1
dotsi KeyError: 'a_b' KeyError: 'a_b' 1
dictlib 1 1 1
diot 1 1 1

Frozen Dict Support

Whether the packages support frozen dicts

Support? and how?
addict <dict>.freeze()/.unfreeze()
python-box Box(<dict>, frozen_box=True)
dotmap Not supported
dotwiz Not supported
easydict Not supported
dotsi Not supported
dictlib Not supported
diot FrozenDiot(<dict>) or Diot(<dict>, diot_frozen=True)

Key transformation support

Whether the packages support key transformation for dot access

For example: making <dict>.a_b to access value from {"a.b": 1}

Support? and how?
addict Not supported
python-box Using Conversion Box or Camel Killer Box
dotmap Not supported
dotwiz DotWizPlus turns special-cased keys, such as names with spaces, into valid snake_case words
easydict Not supported
dotsi Not supported
dictlib Not supported
diot Support custom transform function: Diot(..., diot_transform =...)

Metadata

Release files for dotdict-bench 0.0.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 dotdict-bench 0.0.0
File Size Uploaded
dotdict-bench-0.0.0.tar.gz 8.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dotdict-bench 0.0.0
File Interpreter ABI Platform
dotdict_bench-0.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.3 kB

Release files / dotdict-bench-0.0.0.tar.gz

Download URL dotdict-bench-0.0.0.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
53410ce5ed4dd6f70e71816877952f48455b6db7952843ee1185d88d3e24e546
BLAKE2b-256 checksum
How to use checksums
9419d886f6b847ad5ff03217df6d4888417259e0e9ba5d30413af51d7d8fe152
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.1 CPython/3.10.6 Linux/5.15.0-1019-azure

Release files / dotdict_bench-0.0.0-py3-none-any.whl

Download URL dotdict_bench-0.0.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2723328ca9a3cb4e460f92df7af8a0c20d97b4dac5e2791a0af5013c8afc6b89
BLAKE2b-256 checksum
How to use checksums
77506152a102d7d89fb7ba45dba9710087cc400e400903e3a9dc194640514c60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.1 CPython/3.10.6 Linux/5.15.0-1019-azure

Release history Release notifications | RSS feed

This release

0.0.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