# dataclass-deser ![PyPI - Version](https://img.shields.io/pypi/v/dataclass-deser)
A simple deserialization library for python based on dataclasses and type hints.
I've written this code repeatedly across several of my scripts,
so I've decided to publish it to PyPi for reuse.
## Basic Example
```python
@dataclass
class Nested:
foo: int
@dataclass
class Foo:
bar: int
baz: list[int]
nested: Nested
raw_json = """{
"bar": 3,
"baz": [1, 2, 8],
"nested": {"foo": 42}
}"""
expected = Foo(
bar=3,
baz=[1, 2, 8],
nested=Nested(foo=42)
)
ctx = dataclass_deser.DeserContext()
assert expected == ctx.deser(Foo, json.loads(raw_json))
```
## Status
**WARNING**: This library is **ALPHA qUaLitY**
- [x] Basic primitive deserialization
- [ ] Support lossless numeric conversions (int -> float)
- [ ] Support lossy numeric conversion
- [ ] Support for optional types
- [ ] Support for union types (int | str | bytes)
- [ ] Configuration options
- [x] Allow unused keys
- [ ] Extensibility
- [ ] Field options via dataclass field.metadata
- [ ] Newtype wrappers
- [ ] Support more collections
- [ ] Dictionaries
- [ ] Tuples
- [ ] Sets
- [ ] Support enumerations
Raw data
{
"_id": null,
"home_page": "",
"name": "dataclass-deser",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "dataclasses,config,serialize,json,toml",
"author": "Techcable",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/91/ac/31ec9fbffa45371358aac4a3dd04428743b7677e0973d331c6d7505056c7/dataclass-deser-0.1.0a1.tar.gz",
"platform": null,
"description": "# dataclass-deser ![PyPI - Version](https://img.shields.io/pypi/v/dataclass-deser)\nA simple deserialization library for python based on dataclasses and type hints.\n\nI've written this code repeatedly across several of my scripts,\nso I've decided to publish it to PyPi for reuse.\n\n## Basic Example\n```python\n@dataclass\nclass Nested:\n foo: int\n\n@dataclass\nclass Foo:\n bar: int\n baz: list[int]\n nested: Nested\n\nraw_json = \"\"\"{\n \"bar\": 3,\n \"baz\": [1, 2, 8],\n \"nested\": {\"foo\": 42}\n}\"\"\"\nexpected = Foo(\n bar=3,\n baz=[1, 2, 8],\n nested=Nested(foo=42)\n)\n\nctx = dataclass_deser.DeserContext()\nassert expected == ctx.deser(Foo, json.loads(raw_json))\n```\n\n## Status\n**WARNING**: This library is **ALPHA qUaLitY**\n\n- [x] Basic primitive deserialization\n - [ ] Support lossless numeric conversions (int -> float)\n - [ ] Support lossy numeric conversion\n- [ ] Support for optional types\n- [ ] Support for union types (int | str | bytes)\n- [ ] Configuration options\n - [x] Allow unused keys\n- [ ] Extensibility\n - [ ] Field options via dataclass field.metadata\n - [ ] Newtype wrappers\n- [ ] Support more collections\n - [ ] Dictionaries\n - [ ] Tuples\n - [ ] Sets\n- [ ] Support enumerations\n\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "A simple deserialization library, based on dataclasses and type-hints",
"version": "0.1.0a1",
"project_urls": {
"Bug Tracker": "https://github.com/Techcable/dataclass-deser/issues",
"Source Code": "https://github.com/Techcable/dataclass-deser"
},
"split_keywords": [
"dataclasses",
"config",
"serialize",
"json",
"toml"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ff2079b8dea4e04faa88260282044f15700b215ceeee599690fda1fdb2e415f4",
"md5": "5e3ec4d6f3b97f19b5181e9e1e895bf1",
"sha256": "f1379dd6438bc19f7a3472316477139d4194fc176e035ecf905881ceb17bb2e0"
},
"downloads": -1,
"filename": "dataclass_deser-0.1.0a1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5e3ec4d6f3b97f19b5181e9e1e895bf1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 4477,
"upload_time": "2024-02-14T05:20:22",
"upload_time_iso_8601": "2024-02-14T05:20:22.862312Z",
"url": "https://files.pythonhosted.org/packages/ff/20/79b8dea4e04faa88260282044f15700b215ceeee599690fda1fdb2e415f4/dataclass_deser-0.1.0a1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "91ac31ec9fbffa45371358aac4a3dd04428743b7677e0973d331c6d7505056c7",
"md5": "7a771cba49a863ed5d6db4068147294f",
"sha256": "09a3cb3ac050ab511d58f7fa74c7a67897e934913d08fc28dd98ac1ef69007a2"
},
"downloads": -1,
"filename": "dataclass-deser-0.1.0a1.tar.gz",
"has_sig": false,
"md5_digest": "7a771cba49a863ed5d6db4068147294f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 5660,
"upload_time": "2024-02-14T05:20:24",
"upload_time_iso_8601": "2024-02-14T05:20:24.530544Z",
"url": "https://files.pythonhosted.org/packages/91/ac/31ec9fbffa45371358aac4a3dd04428743b7677e0973d331c6d7505056c7/dataclass-deser-0.1.0a1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-14 05:20:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Techcable",
"github_project": "dataclass-deser",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "dataclass-deser"
}