Pydantic (V2) - In-depth Starter Guide

Sdílet
Vložit
  • čas přidán 5. 08. 2024
  • In this video I show you how to use Pydantic V2, including topics such as default factories, custom serializers and custom validators. There is a whole lot more to Pydantic than what I can cover in a video such as this.
    If you are interested in a deeper dive into Pydantic V2, please check out my Udemy course on the subject. Here is a discount coupon link (if it has expired, just let me know in the comments and I'll update it):
    www.udemy.com/course/pydantic...
    #pydantic #python
    Content
    =======
    00:00 - Introduction
    01:25 - Basic Models
    07:28 - Validation Exceptions
    09:56 - Deserializing Data
    11:40 - Required vs Optional Fields
    15:06 - Nullable Fields
    22:20 - Aliases and the Field Class
    25:42 - Serialization
    27:21 - Field and Defaults
    30:49 - Model Configuration - Populate by Name
    33:11 - Mutable Defaults
    35:01 - Default Factories
    38:42 - Custom Serializers
    48:56 - Custom Validators
    1:02:32 - Nested Models
    1:08:44 - Conclusion
    Code for this Video
    ===================
    Available in GitHub blog repo: github.com/fbaptiste/python-blog
    Direct link: tinyurl.com/aantjwm5
    My Python Courses
    =================
    - Python 3 Fundamentals (introduction to Python)
    www.udemy.com/course/python3-...
    - Pydantic V2: Essentials
    www.udemy.com/course/pydantic...
    - Python 3 Deep Dive (Part 1 - Functional)
    www.udemy.com/course/python-3...
    - Python 3 Deep Dive (Part 2 - Iteration, Generators)
    www.udemy.com/course/python-3...
    - Python 3 Deep Dive (Part 3 - Hash Maps)
    www.udemy.com/course/python-3...
    - Python 3 Deep Dive (Part 4 - OOP)
    www.udemy.com/course/python-3...

Komentáře • 54

  • @shittydoctor2705
    @shittydoctor2705 Před 2 měsíci +2

    More people should see your videos, you are great!

  • @ketanpurohit9086
    @ketanpurohit9086 Před 8 měsíci +8

    i did your udemy course on Python and hands down it is the best for intermediate to advanced

  • @即将退休的王八精
    @即将退休的王八精 Před 5 měsíci +3

    You are the KING of PYTHON, and I have bought all your courses! Can't wait to learn more from you!!! 👍

  • @user-cs5fs3mu5o
    @user-cs5fs3mu5o Před 8 měsíci +1

    Great, thanks you!
    Your courses and videos are the best, I like this "deep dive" approach

  • @tannguyen_91
    @tannguyen_91 Před 5 měsíci +1

    Very thanks to you, Fred, you save me a month for this video!

  • @Adrian_Galilea
    @Adrian_Galilea Před 8 měsíci +1

    Very informative, thanks!

  • @FirasShamasnehM
    @FirasShamasnehM Před 3 měsíci

    As usual, you are the best!

  • @kenchang3456
    @kenchang3456 Před 7 měsíci

    Way excellent video, thank you very much.

  • @ipelezikis
    @ipelezikis Před 3 měsíci

    Awesome content!

  • @ourgourmetkitchen1774
    @ourgourmetkitchen1774 Před 4 měsíci +1

    I absolutely love your videos and your way of teaching.
    Is there a video on 'Great Expectations' library on your list in the upcoming future? I would love to hear your take on that.

    • @mathbyteacademy
      @mathbyteacademy  Před 4 měsíci

      Thanks, glad you like the channel! No, no Great Expectations - in fact, I'd never heard of it until I read your comment :-)

  • @m.nasirnaseh9481
    @m.nasirnaseh9481 Před 3 měsíci

    ❤❤❤❤❤❤❤ u r the best sir

  • @_ProveIt
    @_ProveIt Před 6 měsíci

    Great video! I've almost finished your Fundamentals course, and you might be the best lecturer I've ever had.
    Are there any C++ courses you recommend?

    • @mathbyteacademy
      @mathbyteacademy  Před 6 měsíci +1

      Thanks! I do not know about C++ courses - I learned C++ many years ago (and forgot most of it!), before online video courses were a thing, so not sure - hopefully someone on this channel has some recommendations?

  • @abhi.isnt.awesome
    @abhi.isnt.awesome Před 7 měsíci +3

    Hi Fred, I have covered all of your courses and they were awesome. Do you by chance plan to make courses on data science and machine learning as well

    • @mathbyteacademy
      @mathbyteacademy  Před 7 měsíci +2

      Thanks, glad you liked them!
      I do not plan on courses on those topics - not my area of expertise.

  • @priteshugrankar6815
    @priteshugrankar6815 Před 6 měsíci

    Hi Fred, your Python Fundamentals course is pure gold!! Ive also purchased the deep dive courses. Is it best to go through the deep dive courses in the same order you've created meaning 1st through 4th? Also, can you please create a video on regular expressions for python?

    • @mathbyteacademy
      @mathbyteacademy  Před 6 měsíci +1

      Thanks, glad you like the courses. No RegEx - I barely get by myself with regex :-)

  • @DucLe-kg5hx
    @DucLe-kg5hx Před 4 měsíci

    This is the best introduction to Pydantic. It seems like the discount coupon link has expired. Can you please update it?

    • @mathbyteacademy
      @mathbyteacademy  Před 4 měsíci +1

      Thanks! Glad you liked the video. Coupon code link has been updated.

  • @neatcheese7283
    @neatcheese7283 Před 8 měsíci

    Already bought your course and have started watching it. Thank you so much fred! Are you working on other udemy courses as well, say, on asyncio, unit testing, fastAPI etc?

    • @mathbyteacademy
      @mathbyteacademy  Před 8 měsíci +4

      Thank you! Yes, that's the plan - pydantic -> asyncio -> FastAPI. Although, now that you mention it, unit testing might be a good one to put in that sequence as well.

    • @neatcheese7283
      @neatcheese7283 Před 8 měsíci

      @@mathbyteacademy thanks again! Do you have any timeline for releasing the course on Asyncio on udemy? It would be really super helpful because the material on internet on asyncio is not that good honestly. Also, I think if you could a youtube series on Cpython internals would be awesome addition to your youtube channel!

    • @mathbyteacademy
      @mathbyteacademy  Před 8 měsíci +2

      ​@@neatcheese7283 no timeline, no - just finished pydantic course, and I do have a day job too! 🙂 I did start creating materials for an async course a while back, but put it aside at the time for lack of time. Explaining async in a clear non-confusing manner is not easy. Thanks for the suggestion on internals.

    • @pocsgeza1711
      @pocsgeza1711 Před 7 měsíci

      upvote for unit testing and any other course on testing@@mathbyteacademy

  • @Omer698
    @Omer698 Před 6 měsíci

    Currently doing your Python Fundamentals python course, really enjoying it. Will you ever do a SQL/data engineering course?

    • @mathbyteacademy
      @mathbyteacademy  Před 6 měsíci +1

      Thanks, glad you like it!
      I have thought about SQL and data engineering - but not sure how much interest there is in SQL anymore - everyone seems to want to use ORMs (I don't, I happen to like SQL, and find it much easier to write complex queries than an ORM)

  • @visheshpanchal306
    @visheshpanchal306 Před 6 měsíci

    Can you create course on multi-threading, async-await, multiprocessing

  • @NoName-tj8dm
    @NoName-tj8dm Před 7 měsíci

    I have taken 2 deep dive courses on python by you. I am really enjoying it. Do you have any plans for creating course on data structures and algorithms?

    • @mathbyteacademy
      @mathbyteacademy  Před 7 měsíci +1

      I don't have any plans for a course on those topics at the moment. Glad you are enjoying the courses!

    • @NoName-tj8dm
      @NoName-tj8dm Před 7 měsíci

      @@mathbyteacademy If you can suggest any good resources for data structure and algorithm that will be great help. Thanks in advance

    • @mathbyteacademy
      @mathbyteacademy  Před 7 měsíci +1

      @@NoName-tj8dmMy goto reference is "Introduction to Algorithms" by Cormen, Leiserson, Rivest and Stein. I ran across another book recently that is Python specific: "Data Structures & Algorithms in Python" by Canning, Broder and Lafore - I have not had a chance to read it much, but maybe worth a try?

    • @NoName-tj8dm
      @NoName-tj8dm Před 7 měsíci

      @@mathbyteacademy Thanks Fred for your help as always.

  • @maganzo
    @maganzo Před 6 měsíci

    Fred, when will you release asynchronous Python deep dive?

    • @mathbyteacademy
      @mathbyteacademy  Před 6 měsíci

      Sorry, I don't have a timeline for it yet.

    • @maganzo
      @maganzo Před 6 měsíci

      Your series made me the developer I am today, you had a great impact on my professional life and I also learned from your linkedin that we attended the same university Strathclyde!

    • @mathbyteacademy
      @mathbyteacademy  Před 6 měsíci +1

      Glad to hear the courses were useful! I have some very fond memories of my time in Glasgow and Strathclyde :-)

    • @maganzo
      @maganzo Před 6 měsíci

      Do you use comprehensions in your code? They are supposedly pythonic and great, but I think they are hard to read, especially when you are trying to make your code language-agnostic. What do you think? Do you loop or comprehend?

    • @mathbyteacademy
      @mathbyteacademy  Před 6 měsíci

      ​@@maganzo Comprehensions. They are pythonic, and not difficult to understand as long as they are not nested (I think twice about nested comprehensions, and usually split them up if that's the case) - how you format the comprehension code also makes it much simpler to read them (over multiple lines)

  • @paolo-e-basta
    @paolo-e-basta Před 8 měsíci

    19:17

  • @carlosalexanderabantodiaz5465

    When again actívate cupón😅