Dataclass Map And Log

Map dictionaries to pydantic dataclasses, log any extra attributes.
Example
from dataclass_map_and_log.mapper import DataclassMapper
@dataclass
class Child:
name: str
surname: str
@dataclass
class SingleChild:
name: str
@dataclass
class Parent:
name: str
surname: str
children: List[Child]
single_child: SingleChild
data = {
"name": "parent_name",
"surname": "parent_surname",
"extra": "parent_extra_data",
"children": [
{
"name": "child1_name",
"surname": "child1_surname",
"extra": "child_extra_data",
},
{
"name": "child2_name",
"surname": "child2_surname",
},
],
"single_child": {"name": "test"},
}
definition = DataclassMapper.map(Parent, data)
You can then access the dataclass instance like:
definition.single_child.name
And you would have gotten the following warning log messages:
"Unexpected attribute extra on class <class 'tests.test_dataclass_map_and_log.Parent'> with value parent_extra_data",
"Unexpected attribute extra on class <class 'tests.test_dataclass_map_and_log.Child'> with value child_extra_data",
Metadata
Release files for dataclass_map_and_log 0.1.6
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 |
|---|---|---|---|---|
| dataclass_map_and_log-0.1.6.tar.gz | 14.2 kB | Without provenance | Details for dataclass_map_and_log-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dataclass_map_and_log-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for dataclass_map_and_log-0.1.6-py3-none-any.whl |
Total release size: 29.2 kB
Release files / dataclass_map_and_log-0.1.6.tar.gz
| Download URL | dataclass_map_and_log-0.1.6.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3c005b1d27093d24a65d9bf01b28b1dc4f7c968b90b2391027f388020687dff
|
|
BLAKE2b-256 checksum How to use checksums |
07382d2a09a77afffb3b165dd7a74ed918785d4557f7cfb4d0d717325788f26e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / dataclass_map_and_log-0.1.6-py3-none-any.whl
| Download URL | dataclass_map_and_log-0.1.6-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0c913ffee578333524dc3c819166a5283166413d9543c774bb71a87d288c44a3
|
|
BLAKE2b-256 checksum How to use checksums |
3b4147d4ee8551fc4c5d905226d3bac0bde515228d15e4459b4565cb6a2f16d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for dataclass_map_and_log 0.1.6
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.