dataclass_io
Read and write dataclasses.
dataclass_io provides similar functionality to the standard library's csv.DictReader and csv.DictWriter, and adds type safety.
Installation
dataclass_io may be installed via pip:
pip install dataclass_io
Quickstart
Reading
from dataclasses import dataclass
from dataclass_io import DataclassReader
@dataclass
class MyData:
foo: int
bar: str
with open("test.tsv", "w") as testfile:
testfile.write("foo\tbar\n")
testfile.write("1\tabc\n")
testfile.write("2\tdef\n")
with DataclassReader.open("test.tsv", MyData) as reader:
for record in reader:
print(record.foo)
Writing
from dataclasses import dataclass
from dataclass_io import DataclassWriter
@dataclass
class MyData:
foo: int
bar: str
with DataclassWriter.open("test.tsv", MyData) as writer:
for i in range(3):
record = MyData(foo=i, bar="something")
writer.write(record)
Metadata
Release files for dataclass_io 0.2.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 |
|---|---|---|---|---|
| dataclass_io-0.2.0.tar.gz | 8.7 kB | Without provenance | Details for dataclass_io-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dataclass_io-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for dataclass_io-0.2.0-py3-none-any.whl |
Total release size: 19.1 kB
Release files / dataclass_io-0.2.0.tar.gz
| Download URL | dataclass_io-0.2.0.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b5430cca5fb087920e66fd27fcf0027a65260046e0208ba92fb631917ac288a6
|
|
BLAKE2b-256 checksum How to use checksums |
4286cc3823eb06c110dd68d56b9e10300a922ec850bfdfb881a9c18b67724e70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.11.8 Darwin/21.6.0
|
Release files / dataclass_io-0.2.0-py3-none-any.whl
| Download URL | dataclass_io-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
19e0778d12b41ccd7996c3e5dc054895824a1cdcbf30e23aefb32e6c8068682d
|
|
BLAKE2b-256 checksum How to use checksums |
151bd7494c4a8bb1a75ac7ceecaea544488b64dc503fdbb30d5869fefcd184bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.11.8 Darwin/21.6.0
|
Security for dataclass_io 0.2.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.