Under the Hood | Faker

This is a new series called “Under the Hood." In this live stream, I'll dive into the code and design of an open-source project together with you. This is going to be completely unscripted, so you'll see my real-time reactions to the code and how it’s been designed.
In this episode, I looked at the Faker package: github.com/joke2k/faker.

Пікірлер: 50

  • @ArjanCodes
    @ArjanCodes20 күн бұрын

    Ahhh sorry... I totally forgot to give the package a grade at the end! So: I'd give this a 6/10. There's a good attempt at trying to separate generating the various types of data. However, the design heavily relies on object-oriented programming, it does counterintuitive things with module imports, and the proxy class solution is messy in my opinion - that needs a redesign. What are your thoughts? Do you agree? Also: let me know in the comments if you'd like me to do another session like this or not!

  • @jeremy-mathieumartin3086

    @jeremy-mathieumartin3086

    20 күн бұрын

    An inituive comment for me to avoid coupling is to use a base class that accept some args (as locals and providers needed). Then you can use some factories and mapped functions to generate the random address, bank_account, etc. And if we want add some providers or functions to generate them, we modify the factory as well. What do you think ?

  • @fluffykitties9020

    @fluffykitties9020

    20 күн бұрын

    Could you give a few examples of VERY GOOD modules that you've come across, ones that you would give a grade of 10/10? That would make a great video, by the way, explaining like you did in the comment above why you like it. In a separate video you could do the opposite, "worst 5 Pyyhon libraries".

  • @franktewierikholscher

    @franktewierikholscher

    19 күн бұрын

    It was really interesting. I was not present during the live, so I had to look at it later. it was a little boring. I liked the way you picked a random envelope and that in one hour you detect a big problem. But as I said it was going to slow. I had a problem with staying with you.

  • @michakacprzak8984

    @michakacprzak8984

    19 күн бұрын

    Amazing video but it would be great to see examples of libraries with great desgin with higher score

  • @tannerbobanner9453
    @tannerbobanner945320 күн бұрын

    Great video! One thing that I'd mention is that many of us open-source library developers try to build our code to support all currently supported Python versions (I.e. those that haven't reached end-of-life). Currently, this is 3.8+, meaning we don't yet have access to the parameterized generics on builtins like list, which is why we import parameterized versions from the typing module. Once 3.8 reaches EOL, we won't need to import those anymore, and once 3.9 reaches EOL, we will be able to use the union shorthand (X | Y).

  • @ArjanCodes

    @ArjanCodes

    20 күн бұрын

    Very good points! That is definitely a good reason to stick with the older type annotation objects.

  • @AloisMahdal

    @AloisMahdal

    20 күн бұрын

    Good point. On the other hand, there can be cases when it's enough to run static analysis only using one of newer mypy+python, right? (This argument probably breaks down as the project has more dependencies, since with older Python versions come older versions of your project dependencies, which might not be 100% compatible so it might still be worth to run mypy with all supported environments as well.)

  • @tannerbobanner9453

    @tannerbobanner9453

    20 күн бұрын

    @@AloisMahdal Not really. The pre-3.9 builtins don't accept parameterization, so attempting to do so will cause runtime errors, as annotations exist at runtime. You could of course not include the type annotations at all, but then static type analysis would not be possible. Another option would be to maintain different versions (one with annotations, one without) for post-3.8 and pre-3.9 respectively, but we generally don't do that as it adds complexity, and having a version without strong typing is not ideal (strong type hinting is very useful for the end user, so we try to use type hints anywhere and everywhere). Realistically, the only option is to use the parameterized versions from the typing module if you want to support 3.8 with the parameterized builtins.

  • @cheweh842
    @cheweh84220 күн бұрын

    This was great. Hearing unedited code review feels more authentic and clicks more for me than hearing the same from a polished, edited video.

  • @ArjanCodes

    @ArjanCodes

    20 күн бұрын

    Glad you enjoyed it!

  • @Gigusx
    @Gigusx20 күн бұрын

    Haven't watched yet, but just based on the description - very cool idea! I always enjoy your content on this sort of thing. Looking forward to watching this one :)

  • @sassydesi7913
    @sassydesi791320 күн бұрын

    This is great, Arjan!! Awesome resource for beginners and experts alike. Please make more of these, and preferrably put them under the Playlist 'Under the hood'.

  • @ArjanCodes

    @ArjanCodes

    19 күн бұрын

    Great suggestion!

  • @cetilly
    @cetilly20 күн бұрын

    I love this idea. I would like to see you start with an example of using the library first to help provide context. But definitely want to see you dive into some complex libraries which make no sense to me.

  • @ArjanCodes

    @ArjanCodes

    19 күн бұрын

    Great suggestion!

  • @MailForEric
    @MailForEric20 күн бұрын

    Yes, do more of these. I liked hearing your unfiltered walkthrough of a Python library. I have 10+ years of experience in Python development and now run a dev team. It's always nice to hear other experienced coders review things. Note for improvement: Your microphone picked up bumps and noises when you hit the desk or your clothes moved.

  • @ArjanCodes

    @ArjanCodes

    19 күн бұрын

    Thanks for the feedback! :)

  • @jakubstepien5645
    @jakubstepien564520 күн бұрын

    That was very interesting to watch you in action and seeing whats your train of thought, I like the format!

  • @ArjanCodes

    @ArjanCodes

    20 күн бұрын

    Glad you enjoyed it, Jakub!

  • @emiliopiotto556
    @emiliopiotto55618 күн бұрын

    Thanks Arjan! one thing I struggle with is arriving at a new project and trying to understand it from scratch. This kind of videos are the only ones that help me practice that skill. Watching your thought process is really valuable. Please keep going with your videos, you are my #1 source of learning for programming, and I really enjoy them. Kudos

  • @ArjanCodes

    @ArjanCodes

    18 күн бұрын

    Thank you so much Emilio!

  • @havenisse2009
    @havenisse200920 күн бұрын

    Faker() works - but you are right, it's confusing. It would be interesting if you could rewrite a skeleton of Faker "done right", maybe with 1 or 2 providers each having a few functions.

  • @trueboubou5936
    @trueboubou593620 күн бұрын

    I like the format! Studying other peoples code is really a great way to learn :)

  • @ArjanCodes

    @ArjanCodes

    20 күн бұрын

    Glad you liked it!

  • @user-tl3xp8wb3u
    @user-tl3xp8wb3u20 күн бұрын

    Like this deep dive session, regred that haven't participated it. Awesome idea🎉

  • @DanielRodriguez-lu3uu
    @DanielRodriguez-lu3uu12 күн бұрын

    That was a brilliant idea to dive into one of those open source projects. It would be even nicer if you could create a simple package an publish it so we can learn how to start contributing to the open source community. Doesn't need to be anything fancy. Thanks again for your grate content.

  • @ramimashalfontenla1312
    @ramimashalfontenla131216 күн бұрын

    Library Roast!! Love this idea!

  • @VikiSil
    @VikiSil20 күн бұрын

    When I saw the video title I thought it will be about impostor syndrome, as in "everyone sometimes feels like under the hood they are a faker". So glad it was not that. And great tips, thank you, this lib will come in useful on my next project.

  • @lysacreationschavula8605
    @lysacreationschavula860520 күн бұрын

    Wow, do more of these please

  • @imaderraiss1609
    @imaderraiss160918 күн бұрын

    omg i was waiting for something like this

  • @ArjanCodes

    @ArjanCodes

    17 күн бұрын

    Glad you liked it!

  • @matteorenoldi1865
    @matteorenoldi186519 күн бұрын

    Very interesting! I would like to know more about the approach of using an external database like SQLite or DuckDB to store the info about the Dutch cities - for example - and how these can be later used in the code

  • @maleldil1
    @maleldil120 күн бұрын

    38:07 You absolutely _do not_ need to duplicate type annotations for package users to get them. Instead, you only have to create an empty py.typed file in the package root, and type checkers will pick that up. .pyi files are only to be used by packages that don't want to add type hints in the code itself.

  • @ArjanCodes

    @ArjanCodes

    20 күн бұрын

    Good to know, thanks!

  • @maleldil1

    @maleldil1

    20 күн бұрын

    For more information, see PEP 561.

  • @stanislavzamecnik3049
    @stanislavzamecnik304916 күн бұрын

    This was great!

  • @ArjanCodes

    @ArjanCodes

    16 күн бұрын

    Glad you liked it, Stanislav!

  • @RealEstate3D
    @RealEstate3D19 күн бұрын

    An important use case is to replace PII in documents before uploading to AI APIs.

  • @VolodymyrMoon
    @VolodymyrMoon20 күн бұрын

    Good one, thanks

  • @ArjanCodes

    @ArjanCodes

    19 күн бұрын

    Glad you liked it!

  • @franktewierikholscher
    @franktewierikholscher19 күн бұрын

    I think Typing and abc's aren't used because the oldest code is already very old and way back then they weren't so common jet.

  • @Slimshady68356
    @Slimshady6835620 күн бұрын

    In your next video ,can you do for langchain I hear people say it is complex source code ,I want to hear your views on it

  • @dietermenne

    @dietermenne

    20 күн бұрын

    Not open-source

  • @jlmaturanag
    @jlmaturanag6 күн бұрын

    -Every test function has to have only one assert. Why is hard to see which assert is failing?

  • @mmilerngruppe
    @mmilerngruppe20 күн бұрын

    42:30 what's the point for stub files? Is this yet another silly idea to put more C header files stuff into python?

  • @nathanielswanson5730
    @nathanielswanson573020 күн бұрын

    Sound in this video is not good. There is a deep sound that sounds like someone is hitting the mic.

  • @ArjanCodes

    @ArjanCodes

    20 күн бұрын

    I think I know what the problem with the sound was, I’ll fix that for next time.

  • @nathanielswanson5730

    @nathanielswanson5730

    18 күн бұрын

    @@ArjanCodes Thanks! And thanks for all the great training!