2025-08-29 –, Innovathens - Main stage
Have you ever wondered what happens behind the scenes when you use import in Python? In this talk, we will demystify Python's import system and explore best practices for managing imports. Moreover, we will discuss how your importing strategy impacts project architecture, influencing modularity and maintainability. For developers working on large Python projects, consistent importing is crucial. It helps maintain codebases by reducing complexity and avoiding technical debt.
The session will begin with an introduction to Python's modular structure: what modules and packages are, how sys.path influences imports, and what happens during the import process. We will also cover the importance of naming conventions and the difference between executing scripts and modules. Some of the things explained in this part may surprise you.
Next, we'll dive into various importing strategies and their implications. From absolute versus relative imports to lazy imports, wildcard imports, and typing-specific imports, we’ll clarify how to choose the right approach for maintainable and readable code.
The session will then explore how your importing structure affects the overall architecture of your project. We’ll address challenges like circular dependencies, separation of concerns, and the role of a layered architecture in maintaining flexibility and scalability.
Finally, we'll look at tools and techniques to enforce consistent importing practices. Learn how to integrate tools like Import Linter and Ruff into your CI pipeline to ensure adherence to your chosen strategy and avoid common pitfalls.
Whether you are a beginner or an experienced Python developer, this talk will help you streamline imports. You will learn practical strategies and tools to enforce consistency, making your projects easier to scale and manage.
Senior Full Stack Developer at Ørsted with 6 years of professional experience in software development. Interested in science, software engineering, power engineering, sports, music and black comedy.