meta_package_manager.managers.pipx module¶
- class meta_package_manager.managers.pipx.Pipx[source]¶
Bases:
PackageManagerpipx installs Python CLI applications, each in its own isolated venv.
Installed applications come from
pipx list --json; only each venv’s main package is tracked, never the packages injected beside it. There is nosearchoperation: the request was closed as not planned, since PyPI exposes no search API and custom search is out of pipx’s scope (see pypa/pipx#777).Note
The outdated query prefers pipx
1.16.0’s nativepipx list --outdated, which checks every venv in one call, each against its own backend (pip or uv). An older pipx falls back to probing each venv with its embedded pip, one call per application. The version floor stays at1.0.0so an older pipx remains fully usable: only the outdated path degrades.Note
The supply-chain cooldown rides on the underlying pip and needs that pip to be at least
26.1, the first release to honor--uploaded-prior-to; older pip silently ignores the release-age gate.Initialize
cli_errorslist.- name: str = 'Python pipx'¶
Return package manager’s common name.
Default value is based on class name.
- homepage_url: str | None = 'https://pipx.pypa.io'¶
Home page of the project, only used in documentation for reference.
- logo: str | None = 'pypi'¶
Slug of the brand mark standing for this manager in the documentation.
Names an SVG vendored under
docs/assets/managers/, whose provenance and license are recorded indocs/assets/managers/logos.yaml. Inlined at the top of the manager’s page bymeta_package_manager._docs; a manager leaving it unset keeps the page’s default package glyph.Several managers legitimately share one slug, either because they wrap the same upstream (
brewandcask) or because the tool has no mark of its own and its ecosystem’s stands in (aptunder Debian’s swirl,cargounder Rust’s gear). Documentation-only, likehomepage_url: no CLI output reads it.
- platforms: frozenset[Platform] | Group | Platform | Iterable[Platform | Group] = frozenset({Platform(id='aix', name='IBM AIX'), Platform(id='almalinux', name='AlmaLinux'), Platform(id='alpine', name='Alpine Linux'), Platform(id='altlinux', name='ALT Linux'), Platform(id='amzn', name='Amazon Linux'), Platform(id='android', name='Android'), Platform(id='arch', name='Arch Linux'), Platform(id='buildroot', name='Buildroot'), Platform(id='cachyos', name='CachyOS'), Platform(id='centos', name='CentOS'), Platform(id='chromeos', name='ChromeOS'), Platform(id='clearlinux', name='Clear Linux OS'), Platform(id='cloudlinux', name='CloudLinux OS'), Platform(id='cygwin', name='Cygwin'), Platform(id='debian', name='Debian'), Platform(id='dragonfly_bsd', name='DragonFly BSD'), Platform(id='endeavouros', name='EndeavourOS'), Platform(id='exherbo', name='Exherbo Linux'), Platform(id='fedora', name='Fedora'), Platform(id='freebsd', name='FreeBSD'), Platform(id='generic_linux', name='Generic Linux'), Platform(id='gentoo', name='Gentoo Linux'), Platform(id='guix', name='Guix System'), Platform(id='haiku', name='Haiku'), Platform(id='hurd', name='GNU/Hurd'), Platform(id='ibm_powerkvm', name='IBM PowerKVM'), Platform(id='illumos', name='illumos'), Platform(id='kali', name='Kali Linux'), Platform(id='kvmibm', name='KVM for IBM z Systems'), Platform(id='linuxmint', name='Linux Mint'), Platform(id='macos', name='macOS'), Platform(id='mageia', name='Mageia'), Platform(id='mandriva', name='Mandriva Linux'), Platform(id='manjaro', name='Manjaro Linux'), Platform(id='midnightbsd', name='MidnightBSD'), Platform(id='netbsd', name='NetBSD'), Platform(id='nixos', name='NixOS'), Platform(id='nobara', name='Nobara'), Platform(id='openbsd', name='OpenBSD'), Platform(id='opensuse', name='openSUSE'), Platform(id='openwrt', name='OpenWrt'), Platform(id='oracle', name='Oracle Linux'), Platform(id='os400', name='IBM i'), Platform(id='parallels', name='Parallels'), Platform(id='pidora', name='Pidora'), Platform(id='pikaos', name='PikaOS'), Platform(id='raspbian', name='Raspbian'), Platform(id='rhel', name='RedHat Enterprise Linux'), Platform(id='rocky', name='Rocky Linux'), Platform(id='scientific', name='Scientific Linux'), Platform(id='slackware', name='Slackware'), Platform(id='sles', name='SUSE Linux Enterprise Server'), Platform(id='slitaz', name='SliTaz GNU/Linux'), Platform(id='solaris', name='Solaris'), Platform(id='sourcemage', name='Source Mage GNU/Linux'), Platform(id='sunos', name='SunOS'), Platform(id='tuxedo', name='Tuxedo OS'), Platform(id='ubuntu', name='Ubuntu'), Platform(id='ultramarine', name='Ultramarine'), Platform(id='void', name='Void Linux'), Platform(id='windows', name='Windows'), Platform(id='wsl1', name='Windows Subsystem for Linux v1'), Platform(id='wsl2', name='Windows Subsystem for Linux v2'), Platform(id='xenserver', name='XenServer')})¶
List of platforms supported by the manager.
Allows for a mishmash of platforms and groups of platforms. Will be normalized into a
frozensetofPlatforminstances at instantiation.
- cooldown_env_var: ClassVar[str | None] = 'PIP_UPLOADED_PRIOR_TO'¶
pipx defers resolution to pip, so it honors pip’s
--uploaded-prior-togate through the same environment variable.Setting
PIP_UPLOADED_PRIOR_TOon a pipx invocation propagates to the pip subprocess pipx spawns to install the application and its dependencies, so the cutoff applies to the whole resolution. mpm injects the RFC 3339 timestamp from the defaultmeta_package_manager.execution.CLIExecutor.cooldown_env_value().Caution
Same caveat as
meta_package_manager.managers.pip.Pip: the underlying pip must be at least26.1for the gate to take effect. Older pip releases silently ignore the env var.See pypa/pipx#1811.
- outdated_requirement = '>=1.16.0'¶
Minimum pipx version providing the native outdated query.
1.16.0 introduced
pipx list --outdated(see pypa/pipx#149). Kept apart fromrequirement(>=1.0.0) so an older pipx stays fully usable,outdatedfalling back to one pip probe per venv.
- property installed: Iterator[Package]¶
Fetch installed packages.
$ pipx list --json { "pipx_spec_version": "0.1", "venvs": { "pycowsay": { "metadata": { "injected_packages": {}, "main_package": { "app_paths": [ { "__Path__": "~/.local/pipx/venvs/pycowsay/bin/pycowsay", "__type__": "Path" } ], "app_paths_of_dependencies": {}, "apps": [ "pycowsay" ], "apps_of_dependencies": [], "include_apps": true, "include_dependencies": false, "package": "pycowsay", "package_or_url": "pycowsay", "package_version": "0.0.0.1", "pip_args": [], "suffix": "" }, "pipx_metadata_version": "0.2", "python_version": "Python 3.10.4", "venv_args": [] } } } }
- property outdated: Iterator[Package]¶
Fetch outdated packages.
pipx
1.16.0introduced a native outdated query, which checks all venvs in a single call, each against its own backend (pip or uv). Injected packages are excluded by default, so only each venv’s main package is reported. Pinned packages are kept: a newer release exists, even ifpipx upgradeskips them.$ pipx list --outdated --output=json { "command": ["list"], "data": { "packages_checked": 1, "packages": [ { "environment": "pycowsay", "package": "pycowsay", "version": "0.0.0.1", "latest_version": "0.0.0.2", "injected": false, "pinned": false } ], "skipped": [] }, "errors": [], "exit_code": 0, "pipx_result_version": "1", "status": "success" }
A pipx older than
outdated_requirementfalls back to probing each venv with its embedded pip, one call per package. Only the venv’s main package is reported; its dependencies also show up inpip list --outdatedbut are silenced:$ pipx runpip pycowsay list --no-color --format=json --outdated > --verbose --quiet [ { "name": "pycowsay", "version": "0.0.0.1", "location": "~/.local/pipx/venvs/pycowsay/lib/python3.10/site-packages", "installer": "pip", "latest_version": "0.0.0.2", "latest_filetype": "wheel" } ]
Todo
Drop the fallback, which mimics
Pip.outdated(), once pipx1.16.0is old enough to be required outright.
- install(package_id, version=None)[source]¶
Install one package.
$ pipx install pycowsay installed package pycowsay 0.0.0.1, installed using Python 3.10.4 These apps are now globally available - pycowsay done! ✨ 🌟 ✨
- Return type:
- cli_names: tuple[str, ...] = ('pipx',)¶
List of CLI names the package manager is known as.
This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.
- ..hint::
This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named
pythonorpython3.
By default, this property’s value is derived from the manager’s ID (see the
MetaPackageManager.__init__method above).
- id: str = 'pipx'¶
Package manager’s ID.
Derived by defaults from the lower-cased class name in which underscores
_are replaced by dashes-.This ID must be unique among all package manager definitions and lower-case, as they’re used as feature flags for the mpm CLI.
- virtual: bool = False¶
Should we expose the package manager to the user?
Virtual package manager are just skeleton classes used to factorize code among managers of the same family.