Ask us about modern Python projects and tools
After the AMA was over, I realized it would also make a great podcast too. So here go you! This is our AMA with Sebastian around all the ideas of modern Python workflows. I hope you enjoy it!
Episode Deep Dive
Guest introduction and background
Sebastian Witowski is a Python developer and instructor who has worked extensively on modern tooling and best practices for Python. He is highly active in the Python community, having presented workshops at PyCon and other events on effective development workflows. Sebastian also authored the "Modern Python Projects" course, showing Python developers how to streamline their toolchains and adopt a more productive, maintainable approach to building projects.
What to Know If You’re New to Python
If you’re just getting started, it helps to understand the idea of virtual environments and how Python often works better when your project dependencies are isolated from your system’s defaults. You might also hear about package managers like pip
, pipenv
, or even Docker-based workflows (don’t worry, these can come later!). Finally, know that there are multiple ways to create a new project structure, and tools like Cookiecutter can help reduce setup time and mistakes.
Key points and takeaways
- Key Point 1: The “Modern Python Projects” Approach
Sebastian emphasized how important it is to choose the right combination of tools and workflows to build maintainable, scalable Python projects. From virtual environments and package managers to linters and testing frameworks, adopting a modern toolchain can streamline collaboration and deployment. By focusing on proven best practices (like standardized formatting, automated testing, and pinned dependencies), developers can save time and reduce errors. Building on a consistent environment also makes onboarding for new team members faster and more reliable.
- Links and Tools:
- Modern Python Projects course by Sebastian
- Cookiecutter
- Links and Tools:
- Key Point 2: Virtual Environments vs. Docker
The guests compared using Docker containers to isolate and replicate Python projects with relying solely on
pyenv
orvenv
for local virtual environments. Docker can be indispensable for complex, production-like setups (e.g., ensuring consistent OS-level environments or multiple dependencies like Redis and Celery). However, for straightforward projects, simply using virtual environments is often less overhead and entirely sufficient. The right balance depends on project complexity, team size, and deployment requirements.- Links and Tools:
- Key Point 3: Poetry, pipenv, and setup.py
They discussed how tools like Poetry and pipenv can greatly simplify project setup, dependency management, and publication to PyPI. Poetry can replace
setup.py
for packaging and distribution, while pipenv is more focused on environment and dependency locking. For many, classicalsetup.py
plus requirements files still work, but Poetry and pipenv offer a modern twist with features such as automated version resolution, publishing, and environment activation. - Key Point 4: Conda vs. pip
On Windows in particular,
conda
can be more user-friendly when installing libraries that rely on compiled C/C++ extensions, as it provides binary packages for many popular data science libraries. By contrast,pip
often installs from source and can fail if you lack the correct system compilers. However,conda
lags slightly in releasing the very latest versions of some packages, and not all PyPI packages are readily available in the conda repos. The best approach depends on your ecosystem (scientific computing vs. web development, for example).- Links and Tools:
- Key Point 5: Handling Secrets & Environment Variables
Storing passwords, API keys, and other secrets directly in source code can lead to major security incidents. Using environment variables is the first step—developers often keep a sample
.env.example
file in version control (without real secrets). External secrets managers or vaults are also recommended for larger enterprises or more sensitive data. The main takeaway is to never push real credentials into public repositories, and always plan for the possibility of key exposure.- Links and Tools:
- dotenv (pypi.org)
- HashiCorp Vault (hashicorp.com/products/vault)
- Links and Tools:
- Key Point 6: Code Formatting and Linting
Tools like Black (automatic code formatter) and Flake8 (linter) remove style debates and catch potential errors before runtime. By enforcing consistent formatting, teams can focus on logic and reviews rather than style details. Adding them to pre-commit hooks or using editor integrations further streamlines the developer workflow.
- Links and Tools:
- Key Point 7: Type Hints and Mypy
Python’s type hinting system makes your code more robust and easier to maintain, especially in larger projects or collaborative teams. While you can add hints at your public API boundaries only, entire codebases can be enforced with external tools like mypy. This allows editors and CI tools to spot type-related errors early, rather than waiting for runtime failures. Type hints also help with auto-complete and readability in many IDEs.
- Links and Tools:
- Key Point 8: Supply Chain Vulnerabilities and Pinning Dependencies
Malicious or hijacked packages can slip into public repositories, especially if installed via typos or unverified sources. The hosts recommend pinning specific versions in requirements files (or Poetry lock files) to ensure you only update dependencies when you explicitly choose to. Scanning tools such as Snyk or internal private PyPI proxies can help mitigate unexpected breakages or vulnerabilities.
- Links and Tools:
- Key Point 9: GUI with Python While Python doesn’t have a single go-to solution for “drag-and-drop” style GUI building, there are options like Tkinter, PyQt, or frameworks like Anvil (for web-based GUIs with pure Python). The panelists noted that there is a lack of powerful “Visual Basic-like” design tools in Python, but you can still create decent desktop or hybrid GUIs if you research the ecosystem.
- Key Point 10: Docker-Based Development Environments
Modern IDEs like PyCharm and VS Code can directly integrate Docker as a remote interpreter. This setup ensures your entire project runs in an environment identical to production, catching library or OS discrepancies early. Debugging can still happen right from your favorite editor with breakpoints, watchers, and more, making Docker-based dev surprisingly straightforward.
- Links and Tools:
- Key Point 11: Distributing Python Apps to Non-Developers
For packaging up desktop or command-line Python apps so they “just run,” solutions like PyInstaller and py2exe bundle Python with your code into an executable. These tools eliminate the need for end users to install Python themselves or manage dependencies. They do, however, require building on each target operating system (Windows, macOS, etc.) for best results.
- Links and Tools:
Interesting quotes and stories
“Tools are there to help you, not to hinder you. If some tool doesn’t work well for you, you should configure it or replace it.” — Sebastian Witowski, on code formatting and linting workflows
“If I just want to run a simple script, Docker is more overhead. But if I want to fully replicate my production environment or run multiple services, Docker makes it so much easier.” — Conversation about choosing Docker vs. local virtual environments
Key definitions and terms
- Virtual Environment: A self-contained Python environment where you can install dependencies without affecting your system-wide Python installation.
- Docker: A containerization platform that packages up code and dependencies into standardized units for software development.
- Poetry: A Python tool for dependency management and packaging, aiming to simplify both development and distribution.
- Conda: A cross-platform package manager often used in data science to install pre-compiled binaries on Windows, macOS, and Linux.
- Environment Variables: Key-value pairs injected into an application’s runtime environment, commonly used for storing sensitive info like secrets.
- Linting: The process of analyzing code to detect potential errors, code quality issues, or style inconsistencies.
- Type Hints: Annotations in Python code that specify the expected types of parameters and return values, enabling better tooling and fewer runtime errors.
Learning resources
Here are a few courses and links that can help you dive deeper into the topics covered in this episode:
- Modern Python Projects: Go step-by-step with Sebastian Witowski and learn how to structure Python projects using cutting-edge tools.
- Python for Absolute Beginners: Ideal if you’re new to programming or Python and want a clear, thorough introduction.
Overall takeaway
Adopting a “modern Python” workflow can elevate your productivity and collaboration. By choosing the right combination of packaging tools, virtual environments or containers, coding standards, and security practices, developers can focus on solving real problems rather than wrestling with repetitive setup tasks. Balancing simplicity and reliability will depend on your team, your application scale, and your deployment environment. Ultimately, mastering the ecosystem of Python tools—from Docker and Poetry to linters and type hints—enables you to build, share, and maintain better software faster.
Links from the show
Modern Python Projects Course: talkpython.fm/modern-python-projects
YouTube Live Stream edition: youtube.com
Episode transcripts: talkpython.fm
--- Stay in touch with us ---
Subscribe to Talk Python on YouTube: youtube.com
Talk Python on Bluesky: @talkpython.fm at bsky.app
Talk Python on Mastodon: talkpython
Michael on Bluesky: @mkennedy.codes at bsky.app
Michael on Mastodon: mkennedy