community.general.pipx (8.5.0) — module

Manages applications installed with pipx

| "added in version" 3.8.0 of community.general"

Authors: Alexei Znamensky (@russoz)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Manage Python applications installed in isolated virtualenvs using pipx.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install tox
  community.general.pipx:
    name: tox
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install tox from git repository
  community.general.pipx:
    name: tox
    source: git+https://github.com/tox-dev/tox.git
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Upgrade tox
  community.general.pipx:
    name: tox
    state: upgrade
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Reinstall black with specific Python version
  community.general.pipx:
    name: black
    state: reinstall
    python: 3.7
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Uninstall pycowsay
  community.general.pipx:
    name: pycowsay
    state: absent

Inputs

    
name:
    description:
    - 'The name of the application to be installed. It must to be a simple package name.
      For passing package specifications or installing from URLs or directories, please
      use the O(source) option.

      '
    type: str

force:
    default: false
    description:
    - Force modification of the application's virtual environment. See C(pipx) for details.
    - Only used when O(state=install), O(state=upgrade), O(state=upgrade_all), O(state=latest),
      or O(state=inject).
    type: bool

state:
    choices:
    - present
    - absent
    - install
    - uninstall
    - uninstall_all
    - inject
    - upgrade
    - upgrade_all
    - reinstall
    - reinstall_all
    - latest
    default: install
    description:
    - Desired state for the application.
    - The states V(present) and V(absent) are aliases to V(install) and V(uninstall),
      respectively.
    - The state V(latest) is equivalent to executing the task twice, with state V(install)
      and then V(upgrade). It was added in community.general 5.5.0.
    type: str

python:
    description:
    - Python version to be used when creating the application virtual environment. Must
      be 3.6+.
    - Only used when O(state=install), O(state=latest), O(state=reinstall), or O(state=reinstall_all).
    type: str

source:
    description:
    - 'If the application source, such as a package with version specifier, or an URL,
      directory or any other accepted specification. See C(pipx) documentation for more
      details.

      '
    - When specified, the C(pipx) command will use O(source) instead of O(name).
    type: str

editable:
    default: false
    description:
    - Install the project in editable mode.
    type: bool
    version_added: 4.6.0
    version_added_collection: community.general

pip_args:
    description:
    - Arbitrary arguments to pass directly to C(pip).
    type: str
    version_added: 4.6.0
    version_added_collection: community.general

index_url:
    description:
    - Base URL of Python Package Index.
    - Only used when O(state=install), O(state=upgrade), O(state=latest), or O(state=inject).
    type: str

executable:
    description:
    - Path to the C(pipx) installed in the system.
    - 'If not specified, the module will use C(python -m pipx) to run the tool, using
      the same Python interpreter as ansible itself.

      '
    type: path

install_apps:
    default: false
    description:
    - Add apps from the injected packages.
    - Only used when O(state=inject).
    type: bool
    version_added: 6.5.0
    version_added_collection: community.general

install_deps:
    default: false
    description:
    - Include applications of dependent packages.
    - Only used when O(state=install), O(state=latest), or O(state=inject).
    type: bool

inject_packages:
    description:
    - Packages to be injected into an existing virtual environment.
    - Only used when O(state=inject).
    elements: str
    type: list

include_injected:
    default: false
    description:
    - Upgrade the injected packages along with the application.
    - Only used when O(state=upgrade), O(state=upgrade_all), or O(state=latest).
    - This is used with O(state=upgrade) and O(state=latest) since community.general 6.6.0.
    type: bool

system_site_packages:
    default: false
    description:
    - Give application virtual environment access to the system site-packages directory.
    - Only used when O(state=install) or O(state=latest).
    type: bool
    version_added: 6.6.0
    version_added_collection: community.general