Skip to content

pkgin Operations

Manage pkgin packages.

Facts used in these operations: pkgin.PkginPackages.

pkgin.packages

Add/remove/update pkgin packages.

pkgin.packages(
         packages: 'str | list[str] | None' = None,
         present=True,
         latest=False,
         update=False,
         upgrade=False,
         **kwargs,
    )
  • packages: list of packages to ensure
  • present: whether the packages should be installed
  • latest: whether to upgrade packages without a specified version
  • update: run pkgin update before installing packages
  • upgrade: run pkgin upgrade before installing packages

Examples:

from pyinfra.operations import pkgin
# Update package list and install packages
pkgin.packages(
    name="Install tmux and Vim",
    packages=["tmux", "vim"],
    update=True,
)

# Install the latest versions of packages (always check)
pkgin.packages(
    name="Install latest Vim",
    packages=["vim"],
    latest=True,
)

Global arguments

This operation also inherits all global arguments.

pkgin.update

Stateless operation

This operation will always execute commands and is not idempotent.

Updates pkgin repositories.

pkgin.update**kwargs,    )

Global arguments

This operation also inherits all global arguments.

pkgin.upgrade

Stateless operation

This operation will always execute commands and is not idempotent.

Upgrades all pkgin packages.

pkgin.upgrade**kwargs,    )

Global arguments

This operation also inherits all global arguments.