An Unbiased Evaluation of Environment and Packaging Tools
Episode Deep Dive
Guests Introduction and Background
Anna-Lena Popkes is a seasoned machine learning engineer at a German company (InnoVex) and currently working on speech recognition projects at Babbel. She’s been a frequent guest on Talk Python To Me, discussing topics like testing and Harry Potter-themed learning projects. She recently returned to share her deep dive into Python packaging, having created both a popular talk at PyCon (DE and EuroPython) and a comprehensive blog post that offers an unbiased overview of Python environment and packaging tools.
What to Know If You're New to Python
Here are a few essential ideas to help newer Python developers get more out of this episode:
- Be aware that Python has built-in tools like
pip
andvenv
for managing packages and environments. - Familiarize yourself with the concept of virtual environments—these keep projects isolated so that dependencies don’t clash.
- Understand that
pyproject.toml
can hold metadata and dependencies for modern Python packages. - Python packaging has multiple tools that aim to solve overlapping or similar problems (e.g., environment creation, dependency resolution, version control, publishing).
Key Points and Takeaways
- Consolidating an Unbiased View of Packaging Tools
Anna-Lena embarked on creating a single reference to compare the many Python tools for environment, dependency, and packaging. By examining them in detail, she shows how certain tools excel at complete workflows (like Poetry), while others handle just one piece (like
pipx
for isolated CLI apps). This unbiased perspective highlights usage scenarios rather than just personal preference.- Tools/Links Mentioned:
- Dependency Resolution and Lock Files
One of the key reasons to adopt packaging tools beyond
pip
alone is to handle lock files. Lock files ensure identical installations across machines, preventing future conflicts caused by shifting library versions. This came up in the show in the context of tools like Poetry, Hatch, PDM, and pip-tools.- Tools/Links Mentioned:
- Creating and Managing Virtual Environments
The need for isolated environments is universal among Python developers. You can manually handle them via
venv
orvirtualenv
, or have your packaging tool (like Poetry or Hatch) create and activate them. Anna-Lena points out that a well-managed environment eliminates dependency conflicts and messy configurations.- Tools/Links Mentioned:
- Python Version Management
Often overlooked, choosing which Python version to install and run is critical. Some tools like Conda or pyenv (github.com/pyenv/pyenv) let you switch among versions seamlessly. Anna-Lena highlighted scenarios where multiple versions are needed (e.g., to test 3.10 vs. 3.11).
- Tools/Links Mentioned:
- Building vs. Publishing
Building a Python package involves bundling code into distributable artifacts (e.g., wheels), while publishing means uploading these artifacts to PyPI or other indexes. Some tools (like Flit) excel at building minimal packages, while Poetry includes both build and publishing steps in one tool.
- Tools/Links Mentioned:
- Rye: A New All-in-One Approach
Inspired by Rust tooling, Rye is a newer addition that can manage Python versions, create environments, and handle dependencies all in one place—without relying on an existing Python install. Its rapid development is partially driven by big-name maintainers, and it aims to streamline everything from environment creation to publishing.
- Tools/Links Mentioned:
- Working as a Team and Avoiding Conflicts
Anna-Lena mentioned how team preferences (and biases) affect tool choice. With many packaging tools, choosing one that everyone is comfortable using—and that meets the team's workflow—can avert frustration. Lock files, consistent environment creation, and project-level config are especially helpful.
- Tools/Links Mentioned:
- Managing Large Repos and Monorepos Large Python codebases often have conflicting dependencies if everything is lumped into a single environment. Tools like Hatch support multiple environment definitions for testing, docs, and more. This separation ensures you only install what you need for each part of your codebase.
Interesting Quotes and Stories
- “One of my colleagues very strongly dislikes Poetry because of a breaking change they introduced without warning—so sometimes personal experience can influence tool choice.”
- “I realized how complicated packaging is when someone asked me which tool to use, and I didn’t even have a short answer. I just knew there were way too many options.”
Key Definitions and Terms
pyproject.toml
: A central config file for Python projects, specifying metadata, dependencies, and build backends.- Editable Installs: Installing a project in a way that code changes are immediately reflected without reinstalling (
pip install -e
). - Lock File: A file listing the exact versions (plus hashes) of all installed dependencies, guaranteeing reproducible environments.
- Build Backend: The underlying tool that handles creating distributable package files (e.g., Poetry, Hatchling, Flit, or setuptools).
Learning Resources
Here are some deeper-dive resources to build on the topics from this episode:
- Managing Python Dependencies: Provides hands-on guidance for pip, venv, lock files, and more.
- Modern Python Projects: Explores workflows, tooling, project structures, and best practices for modern packages and applications.
Overall Takeaway
Python packaging and environment management can feel overwhelming given the huge array of available tools. Anna-Lena’s unbiased exploration shows that each utility—from pip and Poetry to Rye—provides its own distinctive path to the same broad goals: isolation, reproducibility, and efficient distribution. With the right combination of knowledge (like the difference between building and publishing) and modern tools that streamline the process, developers can overcome packaging headaches and enjoy a more seamless Python experience.
Links from the show
Anna-Lena on GitHub: github.com
Accompanying Blog Post: alpopkes.com
Talk from PyCon DE: youtube.com
Talk from EuroPython: youtube.com
Talk Python's Data Science Jumpstart with 10 Projects course: talkpython.fm
Rye: github.com
Poetry: python-poetry.org
Material for MkDocs: squidfunk.github.io
100 Days of Python in a Magical Universe Episode: talkpython.fm
pip-tools: pip-tools.readthedocs.io
Hatch: hatch.pypa.io
PDM: pdm.fming.dev
Flit: flit.pypa.io
Conda: docs.conda.io
Pipenv: pipenv.pypa.io
Watch this episode on YouTube: 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