see README.md
Project description
lush-pydanticx
Pydantic v2 的一些小扩展. 这里不做“框架”,只收一些重复出现、但又不值得单独开一个包的函数/类型.
例子
把 Json[T] 字段在序列化时转成 bytes:
from typing import Any
from pydantic import BaseModel, Json, field_serializer
from lush_pydanticx import json_to_bytes_serializer
class Payload(BaseModel):
data: Json[dict[str, Any]]
@field_serializer("data")
def _ser(self, value: Any) -> bytes:
return json_to_bytes_serializer(value)
开发
uv sync -p 3.10 --frozen
uv run -p 3.10 pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lush_pydanticx-0.1.1.tar.gz
(4.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lush_pydanticx-0.1.1.tar.gz.
File metadata
- Download URL: lush_pydanticx-0.1.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9339f14a970af2d0284470fe9f3fa4688da53d024ed3ce7a1950b0b8b3aa61b0
|
|
| MD5 |
87f3e957fad4e71ac45387f777a2416e
|
|
| BLAKE2b-256 |
5840d16929648c88dd4e11dab4a65c2b040b583369014649b93ee86e9b3d372a
|
File details
Details for the file lush_pydanticx-0.1.1-py3-none-any.whl.
File metadata
- Download URL: lush_pydanticx-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7fe46206f0ba2cb1eb6f38b73d218928412fe763d078fcdb51538e6ea52217c
|
|
| MD5 |
e6b007141b262b804bcbbe683f3ee268
|
|
| BLAKE2b-256 |
e273df014eef58c990938f9b3a2a3490e7af441ad16d268eecdc1715672f4914
|