Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pwwang/dotdict-bench
Benchmarking for dot-accessible dict packages in python
https://github.com/pwwang/dotdict-bench
dictionaries dictionaries-in-python dictionary dot-access dot-notation
Last synced: 14 days ago
JSON representation
Benchmarking for dot-accessible dict packages in python
- Host: GitHub
- URL: https://github.com/pwwang/dotdict-bench
- Owner: pwwang
- Created: 2022-09-22T04:00:47.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-09-22T06:16:41.000Z (over 2 years ago)
- Last Synced: 2024-12-13T03:51:30.542Z (21 days ago)
- Topics: dictionaries, dictionaries-in-python, dictionary, dot-access, dot-notation
- Language: Python
- Homepage:
- Size: 27.3 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# dotdict-bench
Benchmarking for dot-accessible dict packages in python
[![deps](https://img.shields.io/librariesio/release/pypi/dotdict-bench?style=flat-square)](https://libraries.io/github/pwwang/dotdict-bench#repository_dependencies)
More test ideas? [Submit an issue](https://github.com/pwwang/dotdict-bench/issues)!
## 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)](# "The Python Dict that's better than heroin.")|
|python-box|6.0.2|Sat, 02 Apr 2022 02:24:21 GMT|2062|89|[(i)](# "Python dictionaries with advanced dot notation access")|
|dotmap|1.3.30|Wed, 06 Apr 2022 16:26:33 GMT|366|43|[(i)](# "Dot access dictionary with dynamic hierarchy creation and ordered iteration")|
|dotwiz|0.4.0|Wed, 21 Sep 2022 22:23:19 GMT|20|1|[(i)](# "A blazing fast dict subclass that supports dot access notation.")|
|easydict|1.9|Sun, 28 Feb 2021 10:26:53 GMT|207|39|[(i)](# "Access dict values as attributes (works recursively)")|
|dotsi|0.0.3|Sun, 22 Nov 2020 16:48:22 GMT|18|1|[(i)](# "Dot-accessible, update-aware Python dicts (& lists). Works recursively, like a charm.")|
|dictlib|1.1.5|Thu, 15 Aug 2019 23:10:47 GMT|14|3|[(i)](# "python: a lightweight add-on for dictionaries, featuring deep dictionary union, dictionary keys as object attributes (in code dict.key.sub.value notation) as well as a separate string dig/dug for using strings with dot notation on native dictionaries")|
|diot|0.1.6|Thu, 12 May 2022 20:37:59 GMT|7|2|[(i)](# "Python dictionary with dot notation")|## 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|`.a.b.c` or `['a']['b']['c']`|
|python-box|`.a.b.c` or `['a']['b']['c']`|
|dotmap|`.a.b.c` or `['a']['b']['c']`|
|dotwiz|`.a.b.c` or `['a']['b']['c']`|
|easydict|`.a.b.c` or `['a']['b']['c']`|
|dotsi|`.a.b.c` or `['a']['b']['c']`|
|dictlib|`dictlib.dig(, 'a.b.c')` or `dictlib.Dict().a.b.c`|
|diot|`.a.b.c` or `['a']['b']['c']`|## Recursive Dot Access
Whether recursive dot access is supported when there are lists
in the dictLiterally `.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 `.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|``|`1`|`2`|`2`|
|python-box|``|`1`|`2`|`2`|
|dotmap|``|`1`|`AttributeError: __name__`|`2`|
|dotwiz|`1`|`1`|`2`|`2`|
|easydict|`1`|`1`|`2`|`2`|
|dotsi|``|`1`|`2`|`2`|
|dictlib|`Can't create`|`Can't create`|`Can't create`|`Can't create`|
|diot|``|`1`|`2`|`2`|## Accessing dashed keys
How the values with keys with dash are accessed
Literally `.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|`.freeze()/.unfreeze()`|
|python-box|`Box(, frozen_box=True)`|
|dotmap|Not supported|
|dotwiz|Not supported|
|easydict|Not supported|
|dotsi|Not supported|
|dictlib|Not supported|
|diot|`FrozenDiot()` or `Diot(, diot_frozen=True)`|## Key transformation support
Whether the packages support key transformation for dot access
For example: making `.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 =...)`|