GithubHelp home page GithubHelp logo

sumonst21 / pydantic Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pydantic/pydantic

0.0 1.0 0.0 5.74 MB

Data parsing and validation using Python type hints

Home Page: https://docs.pydantic.dev

License: MIT License

Shell 0.02% Python 99.73% Makefile 0.25%

pydantic's Introduction

pydantic

CI Coverage pypi CondaForge downloads versions license

Data validation using Python type hints.


Notice

This branch relates to development of pydantic V2 which is not yet ready for release.

If you're a user of pydantic, you probably want either pydantic V1.10 Documentation or, 1.10.X-fixes git branch.


Fast and extensible, pydantic plays nicely with your linters/IDE/brain. Define how data should be in pure, canonical Python 3.7+; validate it with pydantic.

Help

See documentation for more details.

Installation

Install using pip install -U pydantic or conda install pydantic -c conda-forge. For more installation options to make pydantic even faster, see the Install section in the documentation.

A Simple Example

from datetime import datetime
from typing import List, Optional
from pydantic import BaseModel

class User(BaseModel):
    id: int
    name = 'John Doe'
    signup_ts: Optional[datetime] = None
    friends: List[int] = []

external_data = {'id': '123', 'signup_ts': '2017-06-01 12:22', 'friends': [1, '2', b'3']}
user = User(**external_data)
print(user)
#> User id=123 name='John Doe' signup_ts=datetime.datetime(2017, 6, 1, 12, 22) friends=[1, 2, 3]
print(user.id)
#> 123

Contributing

For guidance on setting up a development environment and how to make a contribution to pydantic, see Contributing to Pydantic.

Reporting a Security Vulnerability

See our security policy.

pydantic's People

Contributors

samuelcolvin avatar prettywood avatar dependabot[bot] avatar dependabot-preview[bot] avatar pyup-bot avatar dmontagu avatar bobronium avatar tiangolo avatar hramezani avatar gr1n avatar koxudaxi avatar uriyyo avatar pilosus avatar stephenbrown2 avatar layday avatar kludex avatar daviskirk avatar aminalaee avatar adriangb avatar nuno-andre avatar dgasmith avatar hmvp avatar therefromhere avatar retnikt avatar dchhh avatar yurikhan avatar selimb avatar skewty avatar paxcodes avatar ofek avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.