Skip to main content

An enhanced version of Pydantic's BaseModel, allowing for advanced model manipulations. (Inspired in TypeScript)

Project description

CD

Pydantic-Set-Operations

Pydantic-Set-Operations provides an enhanced version of Pydantic's BaseModel, allowing for advanced model manipulations, such as field unions, exclusions, and intersections. ExtendedBaseModel introduces bitwise operations (like |, &, and -) for combining, intersecting, and excluding fields between models.

This package is ideal for projects that require dynamic model restructuring or filtering based on specific fields.

Key Model Features

  1. Field Union (union method): Combines fields from two models, prioritizing fields from the initiating model if overlaps exist.
  2. Field Exclusion (omit method): Creates a new model excluding specified fields or fields present in another model.
  3. Field Intersection (pick method): Creates a model containing only fields shared between two models.

Key Instance Features

  1. Field Union (| operator): Returns an instance combining fields from both instances.
  2. Field Exclusion (- operator): Returns an instance excluding fields present in another instance.
  3. Field Intersection (& operator): Returns an instance containing only fields shared between two instances.

Installation

Install using pip install -U pydantic-set-operations.

Usage

For more info about how to use this package, please visit the Wiki.

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_set_operations-1.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

pydantic_set_operations-1.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file pydantic_set_operations-1.1.0.tar.gz.

File metadata

  • Download URL: pydantic_set_operations-1.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pydantic_set_operations-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6f5cc93d0154f6950b69e028d67b95f3db2920ff7580e44e76cd8784b55f6c34
MD5 a11ccfad089983422d83b7641481b79d
BLAKE2b-256 6950819da5c1aedd39ced4189d5d6f6031243d33d7290bce094fe7c2e25b36b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydantic_set_operations-1.1.0.tar.gz:

Publisher: publish.yml on P1etrodev/pydantic-set-operations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydantic_set_operations-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pydantic_set_operations-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36230898df924aa9ffd92431c6ea60a5ff9d8625a07dc8230f87685a2f01d2e2
MD5 0698a8faa2b9dfc188b4354e2954dd06
BLAKE2b-256 547404155c7c3af513ec9a26867126977337b4d6b664cdff10257d64bf3555bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydantic_set_operations-1.1.0-py3-none-any.whl:

Publisher: publish.yml on P1etrodev/pydantic-set-operations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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