[pyserde](https://github.com/yukinarit/pyserde) extension for `datetime.timedelta`.
```python
import serde_timedelta
from serde import serde
from serde.json import to_json, from_json
from datetime import timedelta
# Initialize serde_timedelta extension.
serde_timedelta.init()
@serde
class Foo:
a: timedelta
f = Foo(timedelta(hours=10))
json = to_json(f)
print(json) # Prints {"a":"PT10H"}
print(from_json(Foo, json)) # Prints Foo(a=datetime.timedelta(seconds=36000))
```
Raw data
{
"_id": null,
"home_page": "https://github.com/yukinarit/pyserde-timedelta",
"name": "pyserde-timedelta",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "yukinarit",
"author_email": "yukinarit84@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/84/d4/68ed006ea06e13795bb94b82def3f55f1c490d123f73117b1f0c99ed674f/pyserde_timedelta-0.1.1.tar.gz",
"platform": null,
"description": "[pyserde](https://github.com/yukinarit/pyserde) extension for `datetime.timedelta`.\n\n```python\nimport serde_timedelta\nfrom serde import serde\nfrom serde.json import to_json, from_json\nfrom datetime import timedelta\n\n# Initialize serde_timedelta extension.\nserde_timedelta.init()\n\n\n@serde\nclass Foo:\n a: timedelta\n\n\nf = Foo(timedelta(hours=10))\njson = to_json(f)\nprint(json) # Prints {\"a\":\"PT10H\"}\nprint(from_json(Foo, json)) # Prints Foo(a=datetime.timedelta(seconds=36000))\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "pyserde extension for (de)serializing timedelta",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/yukinarit/pyserde-timedelta",
"Repository": "https://github.com/yukinarit/pyserde-timedelta"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5abc58f0a454089e8505d817a4c562c8c1daa8f83705d041d720a48c7417fd66",
"md5": "599a22cbb968173a4821f2b66a7ef885",
"sha256": "2668a0b6bfcf33acaa52de199b4472eb8919034b3495c311a95678d7d42e5306"
},
"downloads": -1,
"filename": "pyserde_timedelta-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "599a22cbb968173a4821f2b66a7ef885",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 2837,
"upload_time": "2024-01-08T08:41:50",
"upload_time_iso_8601": "2024-01-08T08:41:50.846938Z",
"url": "https://files.pythonhosted.org/packages/5a/bc/58f0a454089e8505d817a4c562c8c1daa8f83705d041d720a48c7417fd66/pyserde_timedelta-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "84d468ed006ea06e13795bb94b82def3f55f1c490d123f73117b1f0c99ed674f",
"md5": "71ee465cd48eceb06bb0992cdcd5fdf9",
"sha256": "3977bf49656b5a3a0d8cb4d97c36e2b837844b6bcea4c5cc8dbace6f402025c0"
},
"downloads": -1,
"filename": "pyserde_timedelta-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "71ee465cd48eceb06bb0992cdcd5fdf9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 2247,
"upload_time": "2024-01-08T08:41:52",
"upload_time_iso_8601": "2024-01-08T08:41:52.453569Z",
"url": "https://files.pythonhosted.org/packages/84/d4/68ed006ea06e13795bb94b82def3f55f1c490d123f73117b1f0c99ed674f/pyserde_timedelta-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-08 08:41:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yukinarit",
"github_project": "pyserde-timedelta",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pyserde-timedelta"
}