Skip to main content

todo

Project description

pydantic-basedtyping

support for basedtyping features with pydantic:

from __future__ import annotations

from pydantic import BaseModel

class A(BaseModel):
    a: 1 | 2
A(a=1)  # A(a=1)
A(a=2)  # A(a=2)
A(a=3)  # ValidationError

[!NOTE] the types need to be written as a string, or __future__.annotations needs to be enabled

installation

  1. add pydantic-basedtyping as a dependency
  2. install the plugin with:
    python -m pydantic_basedtyping install
    

if you are using pyprojectx, this can be configured:

[tool.pyprojectx]
install = ["uv sync", "uv run python -m pydantic_basedtyping install"]

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

pydantic_basedtyping-0.1.0.tar.gz (26.3 kB view details)

Uploaded Source

Built Distribution

pydantic_basedtyping-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file pydantic_basedtyping-0.1.0.tar.gz.

File metadata

File hashes

Hashes for pydantic_basedtyping-0.1.0.tar.gz
Algorithm Hash digest
SHA256 73bf29f6f566bb51966a3da48a95b7f435d090ad3e0cb6997afe3cb3ba356663
MD5 8202ffd892d36f411d406b3eff419920
BLAKE2b-256 7367f49f6f9d27e5bd5cfe22a28f6f4eab6dd6035ce598eb255969aeca0a6b54

See more details on using hashes here.

File details

Details for the file pydantic_basedtyping-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pydantic_basedtyping-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5117fda05606d36aca135dd4eb0dafaee971778e1d03652dfbfb189d55602cc0
MD5 7b1fcb4e4d0cc8c778f010be544ba966
BLAKE2b-256 d4168fe3af10ebf003dbe834755ebbec19ee801225eb9bf2de6e4384de04b147

See more details on using hashes here.

Supported by

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