{"id":13520252,"url":"https://github.com/rnag/dotwiz","last_synced_at":"2025-04-05T06:07:45.948Z","repository":{"id":37057610,"uuid":"498938486","full_name":"rnag/dotwiz","owner":"rnag","description":"A blazing fast dict subclass that supports dot access notation.","archived":false,"fork":false,"pushed_at":"2025-03-01T18:10:15.000Z","size":190,"stargazers_count":53,"open_issues_count":12,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T05:08:53.593Z","etag":null,"topics":["attributes","dictionaries","dot","dot-access","dotdict","maps","notation","python","python3"],"latest_commit_sha":null,"homepage":"https://dotwiz.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rnag.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-02T00:23:57.000Z","updated_at":"2024-12-25T15:03:36.000Z","dependencies_parsed_at":"2024-06-01T20:37:59.227Z","dependency_job_id":"98d2d244-b814-44c0-901d-11bd198d07b8","html_url":"https://github.com/rnag/dotwiz","commit_stats":{"total_commits":90,"total_committers":3,"mean_commits":30.0,"dds":0.4,"last_synced_commit":"6b5528d3b86aff48bbd1372f902926987124acd5"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnag%2Fdotwiz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnag%2Fdotwiz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnag%2Fdotwiz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnag%2Fdotwiz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rnag","download_url":"https://codeload.github.com/rnag/dotwiz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294539,"owners_count":20915340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["attributes","dictionaries","dot","dot-access","dotdict","maps","notation","python","python3"],"created_at":"2024-08-01T05:02:15.691Z","updated_at":"2025-04-05T06:07:45.931Z","avatar_url":"https://github.com/rnag.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"=======\nDot Wiz\n=======\n\n.. image:: https://img.shields.io/pypi/v/dotwiz.svg\n        :target: https://pypi.org/project/dotwiz\n\n.. image:: https://img.shields.io/pypi/pyversions/dotwiz.svg\n        :target: https://pypi.org/project/dotwiz\n\n.. image:: https://codecov.io/gh/rnag/dotwiz/branch/main/graph/badge.svg?token=J3YW230U8Z\n        :target: https://codecov.io/gh/rnag/dotwiz\n\n.. image:: https://github.com/rnag/dotwiz/actions/workflows/dev.yml/badge.svg\n        :target: https://github.com/rnag/dotwiz/actions/workflows/dev.yml\n\n.. image:: https://pyup.io/repos/github/rnag/dotwiz/shield.svg\n        :target: https://pyup.io/repos/github/rnag/dotwiz/\n        :alt: Updates\n\n\nA `blazing fast`_ ``dict`` subclass that enables *dot access* notation via Python\nattribute style. Nested ``dict`` and ``list`` values are automatically\ntransformed as well.\n\n* Documentation: https://dotwiz.readthedocs.io.\n\n-------------------\n\nAssume you have a simple ``dict`` object, with dynamic keys::\n\n    \u003e\u003e\u003e my_dict = {'this': {'dict': {'has': [{'nested': {'data': True}}]}}}\n\nIf the goal is to access a nested value, you could do it like this::\n\n    \u003e\u003e\u003e my_dict['this']['dict']['has'][0]['nested']['data']\n    True\n\nOr, using ``DotWiz``::\n\n    \u003e\u003e\u003e from dotwiz import DotWiz\n    \u003e\u003e\u003e dw = DotWiz(my_dict)\n    \u003e\u003e\u003e dw.this.dict.has[0].nested.data\n    True\n\n**Note**: This library can also make inaccessible keys safe -- check out `an example`_ with ``DotWizPlus``.\n\n.. _an example: https://dotwiz.readthedocs.io/en/latest/usage.html#dotwizplus\n\nInstall\n-------\n\n.. code-block:: console\n\n    $ pip install dotwiz\n\nUsage\n-----\n\n``DotWiz``\n~~~~~~~~~~\n\nHere is an example of how to create and use a ``DotWiz`` object:\n\n.. code:: python3\n\n    from dotwiz import DotWiz\n\n    dw = DotWiz({'this': {'works': {'for': [{'nested': {'values': True}}]}}},\n                the_answer_to_life=42)\n\n    print(dw)\n    # \u003e  ✫(this=✫(works=✫(for=[✫(nested=✫(values=True))])),\n    #      the_answer_to_life=42)\n\n    assert dw.this.works['for'][0].nested.values  # True\n    assert dw.the_answer_to_life == 42\n\n    print(dw.to_dict())\n    # \u003e  {'this': {'works': {'for': [{'nested': {'values': True}}]}},\n    #     'the_answer_to_life': 42}\n\nUsing ``make_dot_wiz`` allows you to pass in an iterable object when\ncreating a ``DotWiz`` object:\n\n.. code:: python3\n\n    from dotwiz import make_dot_wiz\n\n    dw = make_dot_wiz([('hello, world!', 123), ('easy: as~ pie?', True)],\n                      AnyKey='value')\n\n    print(dw)\n    #\u003e ✫(AnyKey='value', hello, world!=123, easy: as~ pie?=True)\n\n    assert dw['hello, world!'] == 123\n    assert dw['easy: as~ pie?']\n    assert dw.AnyKey == 'value'\n\n``DotWizPlus``\n~~~~~~~~~~~~~~\n\n``DotWiz+`` enables you to turn special-cased keys, such as names with spaces,\ninto valid *snake_case* words in Python, as shown below. Also see the note\non `Issues with Invalid Characters`_ below.\n\n.. code:: python3\n\n    from dotwiz import DotWizPlus\n\n    my_dict = {'THIS': {'1': {'is': [{'For': {'AllOf': {'My !@ Fans!': True}}}]}}}\n    dw = DotWizPlus(my_dict)\n\n    print(dw)\n    #\u003e ✪(this=✪(_1=✪(is_=[✪(for_=✪(all_of=✪(my_fans=True)))])))\n\n    # True\n    assert dw.this._1.is_[0].for_.all_of.my_fans\n\n    # alternatively, you can access it like a dict with the original keys:\n    assert dw['THIS']['1']['is'][0]['For']['AllOf']['My !@ Fans!']\n\n    print(dw.to_dict())\n    # {'THIS': {'1': {'is': [{'For': {'AllOf': {'My !@ Fans!': True}}}]}}}\n\n    print(dw.to_attr_dict())\n    # {'this': {'_1': {'is_': [{'for_': {'all_of': {'my_fans': True}}}]}}}\n\nIssues with Invalid Characters\n******************************\n\nA key name in the scope of the ``DotWizPlus`` implementation must be:\n\n* a valid, *lower-* and *snake-* cased `identifier`_ in python.\n* not a reserved *keyword*, such as ``for`` or ``class``.\n* not override ``dict`` method declarations, such as ``items``, ``get``, or ``values``.\n\nIn the case where your key name does not conform, the library will mutate\nyour key to a safe, snake-cased format.\n\nSpaces and invalid characters are replaced with ``_``. In the case\nof a key beginning with an *int*, a leading ``_`` is added.\nIn the case of a *keyword* or a ``dict`` method name, a trailing\n``_`` is added. Keys that appear in different cases, such\nas ``myKey`` or ``My-Key``, will all be converted to\na *snake case* variant, ``my_key`` in this example.\n\nFinally, check out `this example`_ which brings home all\nthat was discussed above.\n\nFeatures\n--------\n\n* TODO\n\nBenchmarks\n----------\n\n    Check out the `Benchmarks`_ section in the docs for more info.\n\nUsing a *dot-access* approach such as ``DotWiz`` can be up\nto **100x** faster than with `make_dataclass`_ from the ``dataclasses`` module.\n\nIt's also about *5x* faster to create a ``DotWiz`` from a ``dict`` object\nas compared to other libraries such as ``prodict`` -- or close to **15x** faster\nthan creating a `Box`_ -- and up to *10x* faster in general to access keys\nby *dot* notation -- or almost **30x** faster than accessing keys from a `DotMap`_.\n\nContributing\n------------\n\nContributions are welcome! Open a pull request to fix a bug, or `open an issue`_\nto discuss a new feature or change.\n\nCheck out the `Contributing`_ section in the docs for more info.\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `rnag/cookiecutter-pypackage`_ project template.\n\n.. _blazing fast: https://dotwiz.readthedocs.io/en/latest/benchmarks.html#results\n.. _Read The Docs: https://dotwiz.readthedocs.io\n.. _Installation: https://dotwiz.readthedocs.io/en/latest/installation.html\n.. _on PyPI: https://pypi.org/project/dotwiz/\n.. _Issues with Invalid Characters: https://dotwiz.readthedocs.io/en/latest/#issues-with-invalid-characters\n.. _identifier: https://www.askpython.com/python/python-identifiers-rules-best-practices\n.. _this example: https://dotwiz.readthedocs.io/en/latest/usage.html#complete-example\n.. _make_dataclass: https://docs.python.org/3/library/dataclasses.html#dataclasses.make_dataclass\n.. _Benchmarks: https://dotwiz.readthedocs.io/en/latest/benchmarks.html\n.. _Box: https://github.com/cdgriffith/Box/wiki/Quick-Start\n.. _DotMap: https://pypi.org/project/dotmap\n.. _`Contributing`: https://dotwiz.readthedocs.io/en/latest/contributing.html\n.. _`open an issue`: https://github.com/rnag/dotwiz/issues\n.. _Cookiecutter: https://github.com/cookiecutter/cookiecutter\n.. _`rnag/cookiecutter-pypackage`: https://github.com/rnag/cookiecutter-pypackage\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnag%2Fdotwiz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frnag%2Fdotwiz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnag%2Fdotwiz/lists"}