Understanding the Magic of Python Modules and Packages
summary
Builds modules and packages from scratch and demonstrates a working bookstore app split into modules for books authors users plus routes services and tests, shows how imports resolve via sys.path and PYTHONPATH, explains temporary vs permanent env changes (zshrc example), highlights need for an __init__.py to mark packages, measures benefits by independent testability and reduced blast radius when one module fails, and shows imports and selective from-import usage with concrete file examples.
AI-written summary · about
chapters (11)
- 0:00Introduction to speaker
- 1:31Problems with large code files
- 3:16Solving issues with modules
- 5:46Understanding packages
- 7:12Bookstore app example
- 9:39Importing modules in Python
- 11:45Module search path
- 13:53Setting Python path
- 15:39Modules vs libraries vs frameworks
- 17:24Benefits of modular code
- 19:13Q&A session
related talks
26mModules 101: how to avoid spaghetti, big balls of mud and houses of straw!
02h 36mPython Packaging Demystified
21mHacking the Python Import System
23mEverything is a Python module
26mWhat happens behind execution of an `import` statement?
29m"from where?!? import what?!?"
45mWhat happens when you import a module?
24mInside the Cheeseshop:How Python Packaging Works
