Small Pydantic utilities and helpers.
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.2.tar.gz
(4.3 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.2.tar.gz.
File metadata
- Download URL: lush_pydanticx-0.1.2.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","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 |
f48c0b714285b768f1c8e696d41de4db749414e80749d936a0127853cbcc0e68
|
|
| MD5 |
a8b2530dbb0b5f00d46cd8a255e64142
|
|
| BLAKE2b-256 |
36b8e4604ab751c1fcf01e53c193d1c6a514b9465dda77708c4e25e2737ed79f
|
File details
Details for the file lush_pydanticx-0.1.2-py3-none-any.whl.
File metadata
- Download URL: lush_pydanticx-0.1.2-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","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 |
4cb5d0fb41b6e0f4c662dcf2fd7783987b00fc0ad914274b930159b3652571a7
|
|
| MD5 |
25249e2464bf3b599acb96d92bcdae92
|
|
| BLAKE2b-256 |
7760078d3dd860c1bda8c4a82b5508011ad1d9fa5fa6eb1ed0c6556233fb69d5
|