Skip to main content

A collection of helper functions/classes for Pydantic.

Project description

Phana's Pydantic Helpers

pypi pypi-python license

A collection of helper functions/classes for Pydantic.

Table of Contents

Install

Prerequisites

  • Poetry – dependency manager

Install Phana's Pydantic Helpers

To get started, install the package with Poetry.

poetry add phanas-pydantic-helpers

Usage

from pydantic import BaseModel

from phanas_pydantic_helpers import update_forward_refs_recursive, Factory

@update_forward_refs_recursive
class MyModel(BaseModel):
  hi: str = "there"
  
  class _Friend(BaseModel):
    whats: str = "up?"
    
  friend: _Friend = Factory(_Friend)

model = MyModel()
assert model.friend.whats == "up?"

Developers

Installation

Follow the installation steps in install and use Poetry to install the development dependencies:

poetry install

License

MIT © Phanabani.

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

phanas_pydantic_helpers-2.0.0.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

phanas_pydantic_helpers-2.0.0-py3-none-any.whl (8.5 kB view hashes)

Uploaded Python 3

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