mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Update DiscoveryResult to use Mashumaro instead of pydantic (#1231)
Mashumaro is faster and doesn't come with all versioning problems that pydantic does. A basic perf test deserializing all of our discovery results fixtures shows mashumaro as being about 6 times faster deserializing dicts than pydantic. It's much faster parsing from a json string but that's likely because it uses orjson under the hood although that's not really our use case at the moment. ``` PYDANTIC - ms ================= json dict ----------------- 4.7665 1.3268 3.1548 1.5922 3.1130 1.8039 4.2834 2.7606 2.0669 1.3757 2.0163 1.6377 3.1667 1.3561 4.1296 2.7297 2.0132 1.3471 4.0648 1.4105 MASHUMARO - ms ================= json dict ----------------- 0.5977 0.5543 0.5336 0.2983 0.3955 0.2549 0.6516 0.2742 0.5386 0.2706 0.6678 0.2580 0.4120 0.2511 0.3836 0.2472 0.4020 0.2465 0.4268 0.2487 ```
This commit is contained in:
14
uv.lock
generated
14
uv.lock
generated
@@ -831,6 +831,18 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/b3/73/085399401383ce949f727afec55ec3abd76648d04b9f22e1c0e99cb4bec3/MarkupSafe-3.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:6e296a513ca3d94054c2c881cc913116e90fd030ad1c656b3869762b754f5f8a", size = 15506 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mashumaro"
|
||||
version = "3.14"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/eb/47/0a450b281bef2d7e97ec02c8e1168d821e283f58e02e6c403b2bb4d73c1c/mashumaro-3.14.tar.gz", hash = "sha256:5ef6f2b963892cbe9a4ceb3441dfbea37f8c3412523f25d42e9b3a7186555f1d", size = 166160 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/1b/35/8d63733a2c12149d0c7663c29bf626bdbeea5f0ff963afe58a42b4810981/mashumaro-3.14-py3-none-any.whl", hash = "sha256:c12a649599a8f7b1a0b35d18f12e678423c3066189f7bc7bd8dd431c5c8132c3", size = 92183 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mdit-py-plugins"
|
||||
version = "0.3.5"
|
||||
@@ -1494,6 +1506,7 @@ dependencies = [
|
||||
{ name = "async-timeout" },
|
||||
{ name = "asyncclick" },
|
||||
{ name = "cryptography" },
|
||||
{ name = "mashumaro" },
|
||||
{ name = "pydantic" },
|
||||
{ name = "typing-extensions" },
|
||||
{ name = "tzdata", marker = "platform_system == 'Windows'" },
|
||||
@@ -1544,6 +1557,7 @@ requires-dist = [
|
||||
{ name = "cryptography", specifier = ">=1.9" },
|
||||
{ name = "docutils", marker = "extra == 'docs'", specifier = ">=0.17" },
|
||||
{ name = "kasa-crypt", marker = "extra == 'speedups'", specifier = ">=0.2.0" },
|
||||
{ name = "mashumaro", specifier = ">=3.14" },
|
||||
{ name = "myst-parser", marker = "extra == 'docs'" },
|
||||
{ name = "orjson", marker = "extra == 'speedups'", specifier = ">=3.9.1" },
|
||||
{ name = "ptpython", marker = "extra == 'shell'" },
|
||||
|
Reference in New Issue
Block a user