community.general.pipx_info module – Rretrieves information about applications installed with pipx

Note

This module is part of the community.general collection (version 9.5.1).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.pipx_info.

New in community.general 5.6.0

Synopsis

  • Retrieve details about Python applications installed in isolated virtualenvs using pipx.

Parameters

Parameter

Comments

executable

path

Path to the pipx installed in the system.

If not specified, the module will use python -m pipx to run the tool, using the same Python interpreter as ansible itself.

global

boolean

added in community.general 9.3.0

The module will pass the --global argument to pipx, to execute actions in global scope.

The --global is only available in pipx>=1.6.0, so make sure to have a compatible version when using this option. Moreover, a nasty bug with --global was fixed in pipx==1.7.0, so it is strongly recommended you used that version or newer.

Choices:

  • false ← (default)

  • true

include_deps

boolean

Include dependent packages in the output.

Choices:

  • false ← (default)

  • true

include_injected

boolean

Include injected packages in the output.

Choices:

  • false ← (default)

  • true

include_raw

boolean

Returns the raw output of pipx list --json.

The raw output is not affected by include_deps or include_injected.

Choices:

  • false ← (default)

  • true

name

string

Name of an application installed with pipx.

Attributes

Attribute

Support

Description

check_mode

Support: full

This action does not modify state.

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: N/A

This action does not modify state.

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode.

Notes

Note

  • This module requires pipx version 0.16.2.1 or above. From community.general 11.0.0 onwards, the module will require pipx>=1.7.0.

  • Please note that pipx requires Python 3.6 or above.

  • This module does not install the pipx python package, however that can be easily done with the module ansible.builtin.pip.

  • This module does not require pipx to be in the shell PATH, but it must be loadable by Python as a module.

  • This module will honor pipx environment variables such as but not limited to PIPX_HOME and PIPX_BIN_DIR passed using the environment Ansible keyword.

See Also

See also

C(pipx) command manual page

Manual page for the command.

Examples

---
- name: retrieve all installed applications
  community.general.pipx_info: {}

- name: retrieve all installed applications, include dependencies and injected packages
  community.general.pipx_info:
    include_deps: true
    include_injected: true

- name: retrieve application tox
  community.general.pipx_info:
    name: tox
    include_deps: true

- name: retrieve application ansible-lint, include dependencies
  community.general.pipx_info:
    name: ansible-lint
    include_deps: true

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

application

list / elements=dictionary

The list of installed applications

Returned: success

dependencies

list / elements=string

The dependencies of the installed application, when include_deps=true.

Returned: success

Sample: ["virtualenv"]

injected

dictionary

The injected packages for the installed application, when include_injected=true.

Returned: success

Sample: {"licenses": "0.6.1"}

name

string

The name of the installed application.

Returned: success

Sample: "tox"

version

string

The version of the installed application.

Returned: success

Sample: "3.24.0"

cmd

list / elements=string

Command executed to obtain the list of installed applications.

Returned: success

Sample: ["/usr/bin/python3.10", "-m", "pipx", "list", "--include-injected", "--json"]

raw_output

dictionary

The raw output of the pipx list command, when include_raw=true. Used for debugging.

Returned: success

Authors

  • Alexei Znamensky (@russoz)