Skip to main content

TypeScript-like utilities for Pydantic models: Partial, Pick, Omit, Required

Project description

Pydantic Tooltypes

TypeScript-like utilities for Pydantic models: Partial, Pick, Omit, and Required.

Features

  • Partial: Makes all fields in a Pydantic model optional.
  • Pick: Selects a subset of fields from a model.
  • Omit: Removes a subset of fields from a model.
  • Required: Makes selected fields required, others optional.

Installation

pip install pydantic-tooltypes

Usage

from pydantic import BaseModel
from pydantic_tooltypes import Partial, Pick, Omit, Required

class User(BaseModel):
    id: int
    email: str

PartialUser = Partial(User)
PickUser = Pick(User, keys=['email'])
OmitUser = Omit(User, keys=['id'])
RequiredUser = Required(PartialUser, keys=['email'])

License

MIT

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_tooltypes-0.1.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

pydantic_tooltypes-0.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file pydantic_tooltypes-0.1.1.tar.gz.

File metadata

  • Download URL: pydantic_tooltypes-0.1.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.2 Linux/6.8.0-58-generic

File hashes

Hashes for pydantic_tooltypes-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b7ae2c5eb9f3ff756d5c6eaae4772d57146628c6f1346866bb1aba45f3b839d9
MD5 cbeca73bf123c7fdd6460d55a7934e17
BLAKE2b-256 7e3e0d4d36f5cae7760eac82edd4d7b92bef00c4a61e5faca0eab52426b80880

See more details on using hashes here.

File details

Details for the file pydantic_tooltypes-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pydantic_tooltypes-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.2 Linux/6.8.0-58-generic

File hashes

Hashes for pydantic_tooltypes-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d93fbb24245d23f285fb07abf3f679ed8ba901997e9ad894c7b1efb9d970a98
MD5 c9b9d1180a7590c5c1797c735794b185
BLAKE2b-256 8e5e80673db839d738ee7797ab869a27177ea6586915fe956dc0410b51d667db

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