Skip to main content

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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lush_pydanticx-0.1.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

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

Hashes for lush_pydanticx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 30037a2f55e32d03e60c806e5811a6616c817565e8a13f817303c41eb993a041
MD5 78cdca4ee267406ed964f8d083426004
BLAKE2b-256 6aaf9c7cebbe43f9033ecee82d6a61948a327431d39ebdeb65d2d821d4587141

See more details on using hashes here.

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

Hashes for lush_pydanticx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 437d7986fe1ab1f900b5a95a8e82faa18fc7fe39641aff8e5ede836e4656afca
MD5 b0a518e32434a51d27d973ddca09e276
BLAKE2b-256 4b24d6856de050b748fdc73b02ddfb449836c449ff15dae5bed98639c9a80282

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page