Skip to content

With this package you are able to create a dataclass that works exactly like a dictionary.

License

Notifications You must be signed in to change notification settings

leandro-benedet-garcia/dataclass_dict

Repository files navigation

dataclass_dict

Build Status Documentation Status Maintainability Test Coverage

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/

Install

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-dict

How to Collaborate

If 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

By throwing money at the screen

  • 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

By providing help with coding

First, make sure you have at least Python 3.6, git and pip up and running:

python -V
pip -V
git --version

Download this repository with the following command using git:

git clone https://github.com/Cerberus1746/dataclass_dict.git

And then cd into the directory with:

cd dataclass_dict

Now, if you want to run the tests, you can run:

pip install tox
tox

If you want to generate docs, you can install all dependencies with:

pip install sphinx_rtd_theme sphinx_autodoc_typehints

And then generate the docs with the command:

python -m sphinx docs docs/build

The docs then can be found in docs/build