Consistent importing
summary
Explains why a re-exporting pattern was removed because it hides imports while preventing package-level cycles, and describes a small toolchain: Ruff for grouping, one-per-line and absolute-import rules, lazy loading for heavy libs like PyTorch, and using typing.TYPE_CHECKING to avoid runtime imports. Describes building a forked ImportLint to detect package-cycle contracts and running it on Django, producing 167 cyclic dependencies with 88 package-level cycles, arguing that enforcing a no-cycle rule improves modularity and maintainability.
AI-written summary · about
chapters (7)
- 0:00Introduction and speaker
- 1:15Why consistent importing
- 4:15How Python imports work
- 8:43Importing recommendations
- 15:51Imports impact code design
- 20:18Tools to enforce rules
- 23:44Summary and conclusion
related talks
30mLazy imports and the art of interpreter procrastination
30mImporting Without "import": Behind the Scenes of importlib
28mImport Deep Dive
27mNo time to idle about: Profiling import time in Python
29m"from where?!? import what?!?"
51mTaking Python beyond scripting
58mDependency Management at the End of the Rainbow
53mRethinking How We're Linking: What to do when speeding...
