DataDict
Treat dataclasses like dictionaries
Installing DataDict
DataDict is available at PyPI. You can install it using Pip:
$ python -m pip install datadict
Using DataDict
You can use a DataDict dataclass as a drop-in replacement for dataclasses.dataclass in the standard library:
from datadict import dataclass
@dataclass(order=True)
class Point:
x: int
y: int
For instances of the new data class, you can access attributes using square brackets, similar to dictionary access:
>>> point = Point(1, 2)
>>> point
Point(x=1, y=2)
>>> point.x
1
>>> point["x"]
1
>>> point["y"] = 3
>>> point
Point(x=1, y=3)
You can also convert the dataclass instance to a proper dictionary:
>>> point.asdict()
{'x': 1, 'y': 3}
Installing From Source
You can always download the latest version of DataDict from GitHub. DataDict uses Flit as a build tool.
To install DataDict from the downloaded source, run Flit through pip:
$ python -m pip install .
If you want to change and play with the DataDict source code, you should install it in editable mode:
$ python -m pip install -w .[dev,test]
Metadata
Release files for datadict 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| datadict-1.0.0.tar.gz | 6.8 kB | Without provenance | Details for datadict-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datadict-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for datadict-1.0.0-py3-none-any.whl |
Total release size: 10.7 kB
Release files / datadict-1.0.0.tar.gz
| Download URL | datadict-1.0.0.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6fd5452bf48cabfa68ab5a7d865f2d1dec48c1e8f5d74b061a9ca9fc8e7ae46e
|
|
BLAKE2b-256 checksum How to use checksums |
f06dd4bc6fbc81a5d484eb4d907bca36897ab06ae5b1010ca46d920f49ad4c9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Release files / datadict-1.0.0-py3-none-any.whl
| Download URL | datadict-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8609e990bdfd1efa2cbbaf3e545bd0b0f8528518b30bcbdfc39d07993834c72
|
|
BLAKE2b-256 checksum How to use checksums |
234e4b3109635074e24f50c3e5e281b11ec4d3c447c48fc36302a908cbfa52b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Security for datadict 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.