All this package does is create a dataclass so you can straight up use it as if it was a dictionary. Here's a basic example:
>>> from dataclass_dict import create_dataclass_dict
>>> # Generate a instance from a dict
>>> instance = create_dataclass_dict({"name": "Test", "value": 10})
>>> instance.name
'Test'
>>> instance["name"]
'Test'
>>> instance.pop("name") # deletes the field "name"
'Test'Further examples and api can be found in the documentation: https://dataclass-dict.readthedocs.io/
This package only works with python 3.6 or above because it uses dataclasses. In python 3.6 it will use the dataclass package from pypi.
To use this package you may run the following command:
pip install dataclass-dictIf you want to help with the development of this library, I would say that I love you but my fiancee would get jealous, so I will just say thank you :D
- Tidelif: We are on Tidelift! So you can get some technical support from them, and they help us. It's a win win! If you are interested, click here (we get some help if you use this referal link too~)
- Patreon: If you want to help us every month, you can help us by checking our patreon page here
- Ko-fi: Do you like Coffee, I love coffee, if you want to send a tip for a coffee, you can do that here
First, make sure you have at least Python 3.6, git and pip up and running:
python -V
pip -V
git --versionDownload this repository with the following command using git:
git clone https://github.com/Cerberus1746/dataclass_dict.gitAnd then cd into the directory with:
cd dataclass_dictNow, if you want to run the tests, you can run:
pip install tox
toxIf you want to generate docs, you can install all dependencies with:
pip install sphinx_rtd_theme sphinx_autodoc_typehintsAnd then generate the docs with the command:
python -m sphinx docs docs/buildThe docs then can be found in docs/build