Skip to content

pipx Operations

Manage pipx (python) applications.

Facts used in these operations: server.Path, pipx.PipxEnvironment, pipx.PipxPackages.

pipx.ensure_path

Ensure pipx bin dir is in the PATH.

pipx.ensure_path**kwargs,    )

Global arguments

This operation also inherits all global arguments.

pipx.packages

Install/remove/update pipx packages.

pipx.packages(
         packages: str | list[str] | None = None,
         present=True,
         latest=False,
         extra_args: str | None = None,
         **kwargs,
    )
  • packages: list of packages (PEP-508 format) to ensure
  • present: whether the packages should be installed
  • latest: whether to upgrade packages without a specified version
  • extra_args: additional arguments to the pipx command

Versions: Package versions can be pinned like pip: <pkg>==<version>.

Example:

from pyinfra.operations import pipx
pipx.packages(
    name="Install ",
    packages=["pyinfra"],
)

Global arguments

This operation also inherits all global arguments.

pipx.upgrade_all

Upgrade all pipx packages.

pipx.upgrade_all**kwargs,    )

Global arguments

This operation also inherits all global arguments.