pipx - Installable, Isolated Python Applications
Episode Deep Dive
Guests Background
Chad Smith is the creator of pipx, a Python tool for installing and running CLI applications in isolated virtual environments. He has worked in aerospace engineering at Boeing and on projects such as the space shuttle. Later, Chad moved into Python-based tools at a startup funded by Larry Page and currently works at Meta’s Reality Labs, focusing on developer infrastructure and tooling (e.g., debuggers, extensions, and language services). His experience spans scientific computing with MATLAB, building internal tooling at startups, and contributing to Python’s packaging ecosystem.
What to Know If You’re New to Python
If you are just starting out with Python, here are a few essential points to help you get the most from the conversation about pipx and managing Python CLI tools:
- Use Virtual Environments: Tools like [venv] or [virtualenv] isolate dependencies per project. Pipx internally handles this for single-application installs.
- Package Installation: Basic
pip install
might overwrite system-level files or lead to version conflicts. Tools like pipx help avoid that. - CLI Entry Points: Python packages offering console commands often rely on “console script entry points.” That’s how something like
glances
orhttp
(from HTTPie) appears on your terminal. - Understand “pipx run”: Beyond installing an app with
pipx install
, you can do an ephemeral run (pipx run
) for a one-off command.
Key Points and Takeaways
Pipx: The Core Idea and Why It Matters
Pipx makes it easy to install and run Python CLI apps in clean, isolated environments. This ensures that every CLI tool’s dependencies (and versions) are kept separate. For users who just want a tool to “work,” pipx simplifies installation steps that would otherwise involve creating and activating multiple virtual environments. It’s analogous to system-level package managers like Homebrew, apt, or Chocolatey but tailored to Python applications.- Links and Tools:
Origins of Pipx and the Pipsy Connection
Chad initially tried Pipsy, a similar tool for installing Python applications in isolated environments, but it was in maintenance mode. This led him to create pipx, adding features likepipx run
and an active development community. The transition away from Pipsy highlights the importance of maintainers and contributor engagement in open source.- Links and Tools:
CLI Entry Points: How Python Tools Become Commands
Many Python tools define console scripts in their setup orpyproject.toml
so that you can type a command likeglances
orhttp
right on your shell. Pipx looks for these entry points and sym-links them into a location on your PATH. This means once you install, you can run those commands without worrying about Python’s environment details.- Links and Tools:
pipx run
for Ephemeral Usage
In addition to permanently installing packages, pipx supports arun
command that fetches the newest version of a given tool and executes it once—without fully installing it. This is perfect for commands that you only need occasionally, like scaffolding a new project with Cookiecutter.- Links and Tools:
- Cookiecutter
- Example usage:
pipx run cookiecutter <template-repo-url>
- Links and Tools:
Distribution Made Simple: Building Tools for Non-Python Users
If you develop a Python CLI application and want people outside the Python ecosystem to use it, you can simply instruct them to install pipx. They won’t need to know about venv or python versions. This helps teams or open source projects avoid complex installation instructions (e.g.,python -m venv
or--user
flags with pip).- Links and Tools:
Handling System Interactions and Virtual Environments
Chad emphasized that installing tools viasudo pip install
or system-level pip can break your OS or other dependencies. By using pipx, each application gets its own virtual environment. This isolation approach also meanspipx uninstall <tool>
doesn’t affect any other packages or your system-level Python.- Links and Tools:
Glances and Other Cool Tools
A good example of pipx’s power is installing Glances, a system monitoring tool written in Python that acts like a more detailed version oftop
. Rather than installing it globally, pipx can isolate its dependencies and let you runglances
command system-wide.- Links and Tools:
ArgComplete for Shell Completion
Pipx uses ArgComplete to provide tab completion. It helps generate completions for commands likepipx uninstall <tab>
to see a list of installed packages. It also integrates seamlessly with argparse-based CLI tools across shells like Bash and Fish.- Links and Tools:
PEP 582 “PyPackages” Discussion
In the episode, Chad mentioned the draft PEP 582, which proposes a__pypackages__
folder for auto-activated virtual environments. While not currently accepted into Python, tools like PDM and PyFlow experiment with this. This underscores ongoing attempts in the Python community to simplify environment management further.- Links and Tools:
Cross-platform Support and Community Growth
Pipx aims to work consistently on macOS, Linux, and Windows. Chad notes that Windows support has improved thanks to contributors who tested and validated the workflow. The project’s traction (with 5K+ stars on GitHub) stems from its helpful approach to a long-standing Python packaging challenge.
- Links and Tools:
- Utilities You Can Install with Pipx
- GDB GUI: Chad’s project for debugging with a browser-based interface.
- PLS: Enhanced
ls
replacement with color and Git awareness. - Cookiecutter: Project scaffolding.
- HTOP / Glances: System monitoring.
Interesting Quotes and Stories
- On Pipsy’s Stall: “We were stuck because the maintainer had unsubscribed. We could either fork it or make a new tool.”
- Regarding Building Tools at a Startup: “I took on the challenge to learn Python, wrote a bunch of tools to automate code generation, and discovered a lot of packaging frustrations.”
Key Definitions and Terms
- CLI (Command-Line Interface): A program that you run in a terminal or shell via textual commands.
- Console Script Entry Point: A Python packaging mechanism that automatically creates an executable script for your package when installed.
- Virtual Environment: An isolated Python environment that keeps dependencies from interfering with each other or the system Python.
pipx run
: A pipx subcommand to temporarily download and run a Python CLI tool without permanently installing it.
Learning Resources
Here are some excellent resources if you want to deepen your Python skills or better understand packaging and environments:
- Python for Absolute Beginners: Perfect for those brand new to the language, covering core concepts that will help you get comfortable with Python fundamentals.
- Using and Mastering Cookiecutter: Learn to generate new project structures consistently and rapidly.
- Getting started with pytest: Once you’re installing CLI tools, you may also explore testing them with pytest.
- Write Pythonic Code Like a Seasoned Developer: Improve your code quality, readability, and idiomatic usage of Python.
Overall Takeaway
Pipx addresses a key Python packaging pain point: installing and managing command-line tools in a safe, isolated way. It is both friendly for developers who want to distribute Python CLIs and for users who just want a single terminal command to “make it work.” By bridging the gap between package managers (like pip or conda) and user-level tooling, pipx helps Python developers confidently share their applications with a broader audience, all while keeping dependencies neatly siloed.
Links from the show
Pipx: github.com
Entry Points: dev.to
Python Packaging Dashboard: chadsmith.dev
MKDocStrings: mkdocstrings.github.io
gdbgui: github.com
termpair: github.com
httpie: httpie.io
pls (ls-replacement): dhruvkb.github.io
Glances: nicolargo.github.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