Pydantic Tutorial β€’ Solving Python's Biggest Problem

246,511
0
Published 2023-09-18
Learn how to use Pydantic in this short tutorial!

Pydantic is the most widely used data validation library for Python. It lets you structure your data, gives you type-hints and auto-complete in your IDE, and helps to serialize to and from JSON. Learn how to use it in just 10 minutes!

πŸ‘‰ Links
πŸ”— Pydantic Docs: docs.pydantic.dev/
πŸ”— Pydantic GitHub: github.com/samuelcolvin/pydantic

πŸ“š Chapters
00:00 Python's Dynamic Typing Problem
02:11 How To Use Pydantic
05:04 Validating Data with Pydantic
06:36 Custom Field Validation
07:58 JSON Serialization
08:49 Pydantic vs Dataclasses

#pixegami #python

All Comments (21)
  • @pythonantole9892
    The explanation on the why and what problems Pydantic solves is one of the best that i have seen. I just had to subscribe!
  • @ChelseaSaint
    You have a gift to explain complex things in a very simple to understand way.... great video Keep up the awesome work πŸ’ͺ
  • @user-mf1xr5ki9j
    Nice video,Β  -not too big, not to short -presents the most popular points without sticking to details -compares to alternatives Thank you!
  • @jabuci
    Best intro to pydantic I've seen so far. Thanks!
  • @NikolajLepka
    it's hilarious how many decades it took for python users to understand the benefit of strict typing
  • @chakib2378
    Excellent video. Thank you for getting straight to the point with clarity.
  • @theintjengineer
    Coming from C++ and Rust, it's not that I want to work with Types, I kinda cannot work without them haha. So, that's the first topic I looked for when I had to do some stuff in Python. Well-made video, Mate. Thanks.
  • @UTJK.
    Best moments of the video: 7:22 the whole example of Pydantic with data and custom fields validation 9:12 the alternative built-in Python datclasses 9:33 discussing differences between Pydantic and built-in dataclasses
  • @002_aarishalam8
    The pydantic model still does not do strict typechecking , for eg you can pass int to a class of pydantic model which accepts str , it'll typecast the int to str and pass the check. Although there is a solution which you can use , you can import StrictStr from pydantic for such cases
  • @jimg8296
    Crap! First 4 videos of yours I watch and they all solve real world problems I have been facing. Freak'n AWESOME! Thank you. FYI I'm coming from the Typescript world. Saves a lot of custom decorators we create.
  • Thanks for the hint and this will less stress me finding solutions to what you have explained. Keep it up you have a natural gift to explain in a way that anyone can understand
  • @DaniEIdiomas
    Very nice. Had been working with some parts of dataclasses in the past and used guard clauses instead of validators. Will try to use it in the future. Thank you
  • @gatorpika
    Wow, never understood that stuff until I watched this and it's pretty simple the way you explain it. Thanks...subbed!
  • @darrenlefcoe
    A really nice explanation of the difference and use cases between the two modules, pydanic vs dataclasses. Well done.
  • @kentuckeytom
    very clear and concise, well organized, thanks.
  • @Nardiso
    Man, awesome content like I never saw before! Really, really good! Thank you!
  • @luftstolle
    Just wanted to say I love your video! Learned something new!
  • @jason6569
    This is being improved upon in 3.12. I did not use it but I saw something about it in patch notes. I could be wrong but it is nice of Python to actually fix things if this is the case!