Jake Callahan
Jake Callahan
  • Видео 58
  • Просмотров 75 375
Understanding Python: Debugging
#python #pythontutorial #pythontutorialforbeginners
Python errors, strange behaviors, cryptic messages; all too common roadblocks on the way to your perfect code. Well, what if I told you there are ways that you can reach into your code and unravel its runtime mysteries? It's time to take the next step on your way to becoming a Python expert with debugging!
As always, please comment below if you have any questions or suggestions for future videos.
Chapters
1:00 - help and printing
4:10 - next and continue
6:15 - post-mortems
7:06 - next vs step
9:17 - ipdb
10:37 - IPython
12:08 - Navigating the stack
13:44 - IPython.embed()
Follow me on X: x.com/JakeJCallahan
Source: github.com/JacobCallahan/Understa...
Просмотров: 378

Видео

PIP vs UV: The Future of Python Package Management?
Просмотров 3 тыс.4 месяца назад
In this video, we take an early look at the UV project by Astral, the team that brought us Ruff! astral.sh/blog/uv github.com/astral-sh/uv/
Understanding Python: Logging Basics
Просмотров 5614 месяца назад
#python #pythontutorial #pythontutorialforbeginners So you wrote a great program that runs silently until all of a sudden {crash!} it drops an exception. You want to know what led up to this error, but scattering print statements isn't going to cut it. That's when you need to turn to logging, stick with me and you'll learn everything you need to reveal your program's runtime mysteries. As alway...
Python Standard Library: JSON
Просмотров 3005 месяцев назад
This video covers the tools you need to know from the json module. There are a number of subjects covered in this video, so here are some timestamps for each major section. 00:28 - intro 02:58 - dumping 06:09 - loading 08:05 - encoding 11:09 - decoding 13:41 - self serializing 15:18 - json tool cli Follow me on X: x.com/JakeJCallahan Source: github.com/JacobCallahan/PythonStdlibTour/ Intro musi...
Understanding Python: namedtuples
Просмотров 3976 месяцев назад
In this video, we do a deep dive into named tuples. The lesson includes the basics of named tuples, then covers unique methods, some comparisons to alternatives, touches on inheritance and then wraps up with a practical example. As always, please comment below if you have any questions or suggestions for future videos. Chapters 00:28 - Basics 05:00 - Methods 09:00 - Comparison 12:33 - Inheritan...
Python Standard Library: Collections
Просмотров 7037 месяцев назад
This video covers the tools you need to know from the collections module. There are a number of subjects covered in this video, so here are some timestamps for each major section. 00:31 - namedtuple 02:58 - deque 05:58 - Counter 08:58 - defaultdict 12:32 - OrderedDict 14:28 - ChainMap 19:08 - User* base classes Follow me on X: x.com/JakeJCallahan Source: github.com/JacobCallahan/PythonStdlibTou...
Let's Learn Rust: Fundamentals
Просмотров 1708 месяцев назад
We continue our Rust learning journey by visiting the fundamentals. This chapter goes over variables and mutability, data types, functions, comments, and control flow. This chapter really challenged some of my assumptions about Rust, reinforcing some and disproving others. 00:30 - Variables and Mutability 08:57 - Data Types 17:25 - Functions 24:55 - Comments 25:17 - Control Flow Follow along wi...
Python Standard Library: Functools
Просмотров 1,7 тыс.8 месяцев назад
This video covers the parts you should know from the functools module. This is a longer video, so here are some timestamps for the main sections. 00:31 - Caching 12:04 - Partials and Reduce 20:18 - Wrappers 25:48 - Dispatches and Ordering Remember that the source code for this series can be found on GitHub at: github.com/JacobCallahan/PythonStdlibTour
Let's Learn Rust: Programming A Guessing Game
Просмотров 3728 месяцев назад
We continue our Rust learning journey with a practical guessing game example. This introduced us to a lot of new syntax and terminology that we'll build upon later. This was a great episode and I really learned a lot! Follow along with us at: rust-book.cs.brown.edu/ch02-00-guessing-game-tutorial.html
Let's Learn Rust: Getting Started
Просмотров 5099 месяцев назад
This is the beginning of my Rust learning journey. Join me as we dive into this language and build ourselves up. Follow along with: rust-book.cs.brown.edu/ Apologies for the audio quality in this video, but it should be back to normal again in the next.
From Proof to Publish: Your First PyPI Package
Просмотров 2999 месяцев назад
This video is for the first 1,000 people who subscribed to my channel. Thank you all for your support. Nanoconf GitHub: github.com/JacobCallahan/nanoconf/ Nanoconf PyPI: pypi.org/project/nanoconf/
Python Standard Library: Pathlib
Просмотров 1 тыс.9 месяцев назад
In this, our first stop on the Python Standard Library Tour, we visited the pathlib module. This is one of my favorite and most commonly used modules and the best way to work with filesystem paths and files, in Python. Follow me on X: x.com/JakeJCallahan Source: github.com/JacobCallahan/PythonStdlibTour/ Intro music: Rich in the 80s - DivKid
Understanding Python: Concurrent Coroutines
Просмотров 1,4 тыс.10 месяцев назад
In this video, I teach you how to achieve concurrency with coroutines. The lesson includes a walk-through of generators, how they are naturally cooperative, and how to leverage that nature with an asynchronous scheduler. We also show how to handle a traditionally blocking task, sleeping, concurrently, and finally bring in more real-world functionality. As always, if you have any questions or su...
Pyscript: Python In The Browser!
Просмотров 1,7 тыс.11 месяцев назад
Try out my demo for yourself here: pyscript.com/@07924187-45b9-4482-97a0-94ee74d0ae48/your-info/latest Clone it and add things you think are interesting, then send it my way!
Understanding Python: Asyncio
Просмотров 2,8 тыс.11 месяцев назад
In this video, I give an introduction to asyncio and asynchronous concepts. Included in the lesson are conversions from threading, real-world HTTP requests, and even how to call synchronous code asynchronously. As always, if you have any questions or suggestions for future videos, please leave a comment down below. Follow me on Twitter: JakeJCallahan Source: github.com/JacobCallahan...
Understanding Python: Multiprocessing
Просмотров 3,5 тыс.Год назад
Understanding Python: Multiprocessing
Understanding Python: Threading
Просмотров 1,6 тыс.Год назад
Understanding Python: Threading
Understanding Python: Descriptors
Просмотров 6 тыс.Год назад
Understanding Python: Descriptors
Understanding Python: Abstract Base Classes
Просмотров 4,2 тыс.Год назад
Understanding Python: Abstract Base Classes
Understanding Python: Metaclasses
Просмотров 6 тыс.Год назад
Understanding Python: Metaclasses
My Review of GitHub.dev
Просмотров 4322 года назад
My Review of GitHub.dev
Understanding Python: Click-based CLI
Просмотров 4 тыс.2 года назад
Understanding Python: Click-based CLI
Python Halloween Special
Просмотров 3062 года назад
Python Halloween Special
How Satellite QE Does Dynamic Test Infrastructure!
Просмотров 1602 года назад
How Satellite QE Does Dynamic Test Infrastructure!
Understanding Python: Virtual Environments
Просмотров 7053 года назад
Understanding Python: Virtual Environments
Alternatives to Paramiko
Просмотров 1,3 тыс.3 года назад
Alternatives to Paramiko
Understanding Python: Argparse CLI
Просмотров 13 тыс.3 года назад
Understanding Python: Argparse CLI
Understanding Python: Manual CLI Processing
Просмотров 1,7 тыс.3 года назад
Understanding Python: Manual CLI Processing
Tips on Writing Flexible Libraries and CLIs in Python
Просмотров 2213 года назад
Tips on Writing Flexible Libraries and CLIs in Python
Understanding Python: Context Managers
Просмотров 1,2 тыс.3 года назад
Understanding Python: Context Managers

Комментарии

  • @ShuCarolina
    @ShuCarolina 2 дня назад

    Where does the plugin() in line 23 come from? I don't see it in this ServicePlugin class.

  • @canobenitez
    @canobenitez 14 дней назад

    this is some sweet content. I can't believe now I can create files from the command line of python lol I feel like a hacker.

  • @user-jl8wm8rq4e
    @user-jl8wm8rq4e 15 дней назад

    Cool, thanks

  • @ash1kh
    @ash1kh Месяц назад

    Thats why i use poetry if i do any python related stuff.

  • @austinlawan3289
    @austinlawan3289 Месяц назад

    Very comprehensive. Thank you Jake!

  • @abadulhassan4651
    @abadulhassan4651 Месяц назад

    very useful and nice content explained very simply.

  • @Stasrules1
    @Stasrules1 2 месяца назад

    Omg, finally I found video that explains descriptors clearly. Thank you so much!

  • @DiptonilRoy
    @DiptonilRoy 3 месяца назад

    I was wondering if there are any particular benefits to writing class-based loggers. Also, how to do them 'right'... Would love to see something on that subject.

  • @sergioernestotostadosanche2509
    @sergioernestotostadosanche2509 3 месяца назад

    A lot of thanks for sharing your knowledge, dude! In the 2nd example when you're getting prime numbers I didn't know that way to test if a number is prime or not (what's its name?), so I coded the classical and academic definition of primes, and when I ran it, what a surprise, 20 min., 25 min., not finished, and I question myself WTF I'm doing wrong: so when I was washing my clothes, I realized it, the classical definition is making an absurd and vast amount of divisions when testing a number prime. I reviewed the code and looked for the best optimized prime testing until a video that explains a RUclips channel called GeeksForGeeks, which is exactly like yours but coded differently (your code is also testing negative numbers which is good), and finally I kept following your explanation and I was much glad to remember that feeling of getting stuck by a task and resolving with my own effort plus your video and the other sources. ¡Saludos desde México, estimado!

    • @JakeCallahan
      @JakeCallahan 3 месяца назад

      That's my favorite part of programming, developing and testing possible solutions to interesting problems. Glad you enjoyed it!

  • @sergioernestotostadosanche2509
    @sergioernestotostadosanche2509 3 месяца назад

    Hi, dude. You got my subscription, thanks for sharing thoughtfully!

  • @DiptonilRoy
    @DiptonilRoy 3 месяца назад

    The best thing about your videos is the fact that you actually show some situational samples from your previous experiences in code. I have not noticed any teacher (except a few, perhaps) in RUclips do this. This REALLY sets your content apart. Appreciate it.

  • @igorcruz9764
    @igorcruz9764 3 месяца назад

    Great explanation!

  • @cook5992
    @cook5992 3 месяца назад

    "Promosm" 👏

  • @blanky_nap
    @blanky_nap 3 месяца назад

    That’s a very useful one! Great explanation!

  • @JakeCallahan
    @JakeCallahan 3 месяца назад

    What is your favorite debugger for Python? I personally use a mix of these and the debugger provided by VS Code.

  • @dragonkat13
    @dragonkat13 3 месяца назад

    Great video! Love the help / H command. ❤

  • @DiptonilRoy
    @DiptonilRoy 3 месяца назад

    By the way, I do not know if you have ever covered it or not, but I would love to see your technique of designing and implementing custom exceptions for a general application (that is fairly complex and huge). How do you handle their respective logs? How do you decide what information to expose to the clients using the application as logs (may be in the terminal or a separate log file) and what to send to a more dev-centric log file (if any)? How do you tackle exceptions arising due to another exception in logs? Also, (this is more opinionated, I suppose) do you find the use of things like Liskov's Substitutions within Exceptions reasonable (and why)?

    • @JakeCallahan
      @JakeCallahan 3 месяца назад

      These are all great questions, most of which are answered in one of my pet projects at work: github.com/SatelliteQE/broker. In that project, you can find the custom exceptions I use and how logging is handled when in different log levels. Another interesting thing I've introduced with this is an "Emitter" class that can be used for a more structured log-like file that can be more easily consumed in CI environments. github.com/SatelliteQE/broker/blob/master/broker/helpers.py#L269 Now regarding LSP, I'm not very strict when it comes to adhering to most paradigms, if the situation you're in requires some kind of deviation. With that said, my exception subclasses are typically very lightweight.

    • @DiptonilRoy
      @DiptonilRoy 3 месяца назад

      @@JakeCallahan Sounds interesting! Thanks for the recommendation!

  • @DiptonilRoy
    @DiptonilRoy 3 месяца назад

    The last technique is genius! No matter how easy or accessible the topic is, every time I watch your video - I always go out learning something new.

  • @neilmurphy7064
    @neilmurphy7064 4 месяца назад

    Great video.

  • @RichardJActon
    @RichardJActon 4 месяца назад

    Dependency resolution is NP hard I don't care how performant their resolver is they can't get around this. The future of all package management is nix-like where the dependency graph is explicit so there is no dependency resolution problem. Checkout the video: "Nix: What Even Is it Though?" from Burke Libbey for a good talk explaining how it works. People should stop wasting time implementing a bad architecture better, bite the bullet and invest their time in packing for Nix / GUIX.

  • @blanky_nap
    @blanky_nap 4 месяца назад

    Great tutorial! I must say after getting in touch with Go, TS/JS and now Rust I appreciate more and more the genius of Guido to develop really user friendly language.

    • @JakeCallahan
      @JakeCallahan 4 месяца назад

      Rust is very opinionated on how you should do things, but with that comes safety. However, I will always love the freedom that Python give us!

  • @blanky_nap
    @blanky_nap 4 месяца назад

    Great video! Espessially the inheritance part! One more way to construct named tuples is to inherit from typing,NamedTuple. Similar to dataclasses this method allows to add type hints to the attributes.

  • @blanky_nap
    @blanky_nap 4 месяца назад

    Since rust based products like warp terminal and zed editor, as well as uv and ruff are kinda hype right now, it is definitely worth it to take a look at the language. Looking forward to learn rust at this channel!

    • @JakeCallahan
      @JakeCallahan 4 месяца назад

      Definitely agree. I have a project I'd like to implement with PyO3 soonish so it's motivating me to get back on track.

    • @blanky_nap
      @blanky_nap Месяц назад

      @@JakeCallahan no new videos on Rust with PyO3? Would be great to see tutorial how to combine them!

    • @JakeCallahan
      @JakeCallahan Месяц назад

      Hey there. Yeah I've been crazy busy but am hoping to get back to making videos in June. As far as PyO3, I'll let you in on a spoiler for one of the things that kept me so busy... pip install hussh

  • @blanky_nap
    @blanky_nap 4 месяца назад

    Is it possible to run notebooks (I mean not .py)?

    • @JakeCallahan
      @JakeCallahan 4 месяца назад

      I don't believe Pyscript has plans to directly support notebooks. However, I do know that notebooks will have a completely in-browser version (if not already) that runs on Pyodide.

    • @blanky_nap
      @blanky_nap 4 месяца назад

      @@JakeCallahan roger that!

  • @blanky_nap
    @blanky_nap 4 месяца назад

    Why __new__ of metaclass is a staticmethod? Isn‘t it an implicit classmethod?

    • @JakeCallahan
      @JakeCallahan 4 месяца назад

      Great catch! The reason this still works, and wouldn't if the inverse were true, is that Python is passing the meta class as the first positional argument. So while this is decorated with staticmethod, there is no real effect on the behavior since Python itself is the consumer. We can verify this by looking at the output at 18:09

    • @blanky_nap
      @blanky_nap 4 месяца назад

      @@JakeCallahan yep, great channel!!

  • @duke007x3
    @duke007x3 4 месяца назад

    Hi, Jake and thanks as always. Have you tried loguru instead of builtin logging? if yes, what is your opinion on it? looks like it is much simpler for configuration.

    • @JakeCallahan
      @JakeCallahan 4 месяца назад

      For most of my work/personal projects, I use logzero. However, that project is no longer maintained, so will eventually die off. I have looked into loguru as an alternative and it does look promising. However, I'd really have to look into it's features before adopting over my own custom-built logging solution, since I tend to like to do things myself! If you do try it out, please follow up with your thoughts on it, I'd be very interested in what you think.

  • @duke007x3
    @duke007x3 4 месяца назад

    Hi, Jake. Can You please make a video about composition and compare it with inheritance? And thanks for your great job!

    • @JakeCallahan
      @JakeCallahan 4 месяца назад

      Thanks for the suggestion, I'll add it to my list.

  • @vortex2210
    @vortex2210 4 месяца назад

    Would definitely love to see a comparison between Poetry and uv since all of our projects have been moved to poetry some time back. But this is quite interesting!!

    • @JakeCallahan
      @JakeCallahan 4 месяца назад

      That would be a great follow-up once the project is more mature.

    • @vortex2210
      @vortex2210 4 месяца назад

      @@JakeCallahan yaa, currently I feel the lockfile system works quite well and the envs are easy to manage. I hope uv too gets there soon!

  • @waldirio
    @waldirio 4 месяца назад

    Amazing video, my dear friend! Congrats!! 😉👍

  • @duke007x3
    @duke007x3 4 месяца назад

    really great explanation! Thank You, Jake!

  • @magno5157
    @magno5157 4 месяца назад

    What's the difference between abstractmethod and abc.abstractclassmethod?

    • @JakeCallahan
      @JakeCallahan 4 месяца назад

      The second is used for methods decorated with @classmethod. If you're unsure what those are, check out my video in this playlist on Basic Classes.

    • @magno5157
      @magno5157 4 месяца назад

      @@JakeCallahan ah... so it's just @abstractmethod @classmethod in a single decorator

    • @JakeCallahan
      @JakeCallahan 4 месяца назад

      You're correct! However, abstractclassmethod was deprecated almost immediately after being introduced because they enabled the classmethod decorator to decorate an abstractmethod. So to do this, just stack a classmethod decorator on top of the abstractmethod decorator.

    • @magno5157
      @magno5157 4 месяца назад

      @@JakeCallahan I see but seeing that you use it, I guess people still widely use the decorator?

    • @JakeCallahan
      @JakeCallahan 4 месяца назад

      While you can use it for now, it will be removed in the future, so best to avoid it.

  • @dragonkat13
    @dragonkat13 4 месяца назад

    interesting! look forward to seeing how it unfolds! thank you for covering it! what is your favorite thing about PIP, favorite about UV?

    • @JakeCallahan
      @JakeCallahan 4 месяца назад

      pip's compatibility is hard to beat, so it's still the king of production environments. However, I think UV is well positioned to win out in the long term, if Astral can fulfill their vision.

  • @mews75
    @mews75 4 месяца назад

    I mean the speed is cool but not being able to install all pypi packages is enough for me to not use it

    • @JakeCallahan
      @JakeCallahan 4 месяца назад

      It's definitely not mature enough yet, but the team moves pretty fast and has an active community, so hopefully they can get most of the big issues I ran into fixed soon.

  • @JakeCallahan
    @JakeCallahan 4 месяца назад

    I have switched to using uv for virtual environment creation and installation of IPython. With the user-level caching, setup/install went from 5.674s down to 0.451s, and with a complete cache just 0.078s!

    • @rafiqrushdan
      @rafiqrushdan 4 месяца назад

      impressive

    • @0xZarathustra
      @0xZarathustra 4 месяца назад

      issue is tho that it's dependency resolver is not as good as poetry. I don't have a overly complicated setup, but need to downgrade pyyaml during the setup. Poetry does this without issue, `uv pip install pyyaml==5.4.1` just crashes. Well, not only that, the fact that the lock files are not system and platform independent... pretty terrible you gain seconds during the setup of the environment - if it can find the packages that is ... - only to lose all of those seconds and many more hours when you need to ensure compatibility with other systems and platforms 💀

    • @JakeCallahan
      @JakeCallahan 4 месяца назад

      The team certainly has areas to improve, and it will be interesting to see how they handle things like resolver optimization. As you saw in the video, it had trouble with one of my team's projects. Thanks for weighing in!

  • @dragonkat13
    @dragonkat13 4 месяца назад

    another great video! love your intro! smooth and well done!

  • @taft-rh
    @taft-rh 4 месяца назад

    GREAT VIDEO! I've put off diving into the specifics of logger for a while now as it wasn't really a priority. Looks like you did all the heavy lifting for me! Suggestion: It would have been cool to see an example of implementing a application argument via argeparse to set the default log level.

  • @JakeCallahan
    @JakeCallahan 4 месяца назад

    Logging is a large subject! Is there anything you'd specifically like to know, or something you find difficult?

  • @Diablo-qp3iz
    @Diablo-qp3iz 5 месяцев назад

    You are the best explainer among all the RUclipsrs I've seen. 👍🏻👍🏻👍🏻 But I often have a question. Assuming I am preparing to write a Third party API hub, which contains 10 independent external party APIs with no dependencies but finally we need to transform and append all their response in json.In this situation, would you choose to use asynchronous programming or multi-threading?

    • @JakeCallahan
      @JakeCallahan 5 месяцев назад

      If you're not heavily depending on synchronous libraries and are comfortable with asynchronous programming, then I'd recommend async over threading. For example, if you can use something like aiohttp to interact with those APIs, it's hard to beat async. The downside is that it does make your design a bit more complicated, but it's a good trade-off.

  • @Diablo-qp3iz
    @Diablo-qp3iz 5 месяцев назад

    Is it better if using orjson ?

    • @JakeCallahan
      @JakeCallahan 5 месяцев назад

      I've not had a need to use that library, but it does look interesting. If your environment allows third party libraries, that looks like a good alternative. I'll add it to my list for a future series on great packages from PyPi, thanks!

  • @dragonkat13
    @dragonkat13 5 месяцев назад

    What a great video! I don't know how you don't have more views. It's a crime!

  • @JakeCallahan
    @JakeCallahan 5 месяцев назад

    What are some ways that you've used JSON in Python? Have you used the CLI tool I showed in the last section of the video?

  • @relaxingmuzics
    @relaxingmuzics 5 месяцев назад

    hi, how to run jupyter notebook inside terminal?

    • @JakeCallahan
      @JakeCallahan 5 месяцев назад

      While not a full notebook, I Python is what Jupyter uses under the hood. You can do the same as you see me doing by installing IPython with pip, then running from your terminal. pip install IPython Then the command is just: ipython

    • @relaxingmuzics
      @relaxingmuzics 5 месяцев назад

      @@JakeCallahan thank you

  • @rafikyahia7100
    @rafikyahia7100 6 месяцев назад

    If you're reading this, i watched most argparse videos so you don't have to. THIS IS THE RIGHT ONE! Quick easy and straight to the point, thank you very much for your time sir!

  • @suaadali9055
    @suaadali9055 6 месяцев назад

    hellos . how can i calculate overhead cost of multiprocessing

    • @JakeCallahan
      @JakeCallahan 6 месяцев назад

      Interesting and tricky question! This is likely something you'll need external tooling for. The basic idea would be to snapshot your system's python processes before and after splitting off to multiprocessing. This is one way but, depending on what type of overhead you're wanting to measure, there would be other ways to measure.

  • @JakeCallahan
    @JakeCallahan 6 месяцев назад

    What are some cool uses of namedtuples that you've seen in your own, or someone else's codebase?

    • @dragonkat13
      @dragonkat13 6 месяцев назад

      I like the csv example you showed!

  • @user-cb7yl4nr6h
    @user-cb7yl4nr6h 7 месяцев назад

    Pyscripte support tkinter?

  • @user-cb7yl4nr6h
    @user-cb7yl4nr6h 7 месяцев назад

    Pyscripte support tkinter?

    • @JakeCallahan
      @JakeCallahan 7 месяцев назад

      It isn't, no. You can see a full list of modules removed mostly due to webassembly's restrictions (sandboxing). pyodide.org/en/stable/usage/wasm-constraints.html#removed-modules

  • @regmeonly6265
    @regmeonly6265 7 месяцев назад

    Thank you for the video! I just want to comment that often times books say that parameters and arguments are not the same. When declaring a function one declares parameters inside parentheses. When calling a function one specifies arguments. E.g. : # "Jake" is an argument. name is a parameter. def hi(name): print(f"Hi {name}") hi("Jake")

    • @JakeCallahan
      @JakeCallahan 7 месяцев назад

      You are definitely correct. However, I don't personally enforce the distinction between the terminology as it's often confusing for learners and rarely serves a purpose beyond "well actually.." situations. In real discussions, it's perfectly acceptable to use both terms interchangeably, since most people will understand what you're meaning.

  • @wanderingtravellerAB99
    @wanderingtravellerAB99 7 месяцев назад

    Dude singular of indices is index, otherwise, great vid.

    • @JakeCallahan
      @JakeCallahan 7 месяцев назад

      Ha I know! Heard that in editing but trying to re-record that line would have sounded off.

  • @TheMako101
    @TheMako101 7 месяцев назад

    Excellent tutorial, @JakeCallahan. You've covered the material beautifully, especially the "register" functionality. I've read the official docs and had no idea what it was talking about 😅. Now it's crystal clear! Thank you !!