GithubHelp home page GithubHelp logo

doytsujin / pydantic Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pydantic/pydantic

0.0 1.0 0.0 4.29 MB

Data parsing and validation using Python type hints

Home Page: https://pydantic-docs.helpmanual.io/

License: MIT License

Makefile 0.27% Python 99.71% Shell 0.02%

pydantic's Introduction

pydantic

CI Coverage pypi CondaForge downloads versions license

Data validation and settings management using Python type hints.

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-preview[bot] avatar dependabot[bot] avatar pyup-bot avatar dmontagu avatar bobronium avatar tiangolo avatar gr1n avatar koxudaxi avatar pilosus avatar uriyyo avatar stephenbrown2 avatar daviskirk avatar layday avatar dgasmith avatar retnikt avatar nuno-andre avatar therefromhere avatar hmvp avatar oldpadavan avatar paxcodes avatar skewty avatar selimb avatar yurikhan avatar dchhh avatar alexecx avatar matin avatar mdavis-xyz avatar masalim2 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.