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.0.tar.gz
(4.0 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.0.tar.gz.
File metadata
- Download URL: lush_pydanticx-0.1.0.tar.gz
- Upload date:
- Size: 4.0 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 |
30037a2f55e32d03e60c806e5811a6616c817565e8a13f817303c41eb993a041
|
|
| MD5 |
78cdca4ee267406ed964f8d083426004
|
|
| BLAKE2b-256 |
6aaf9c7cebbe43f9033ecee82d6a61948a327431d39ebdeb65d2d821d4587141
|
File details
Details for the file lush_pydanticx-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lush_pydanticx-0.1.0-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 |
437d7986fe1ab1f900b5a95a8e82faa18fc7fe39641aff8e5ede836e4656afca
|
|
| MD5 |
b0a518e32434a51d27d973ddca09e276
|
|
| BLAKE2b-256 |
4b24d6856de050b748fdc73b02ddfb449836c449ff15dae5bed98639c9a80282
|