W3cubDocs

/Ansible

community.general.pipx – Manages applications installed with pipx

Note

This plugin is part of the community.general collection (version 3.8.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.

New in version 3.8.0: of community.general

Synopsis

  • Manage Python applications installed in isolated virtualenvs using pipx.

Parameters

Parameter Choices/Defaults 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.
force
boolean
    Choices:
  • no
  • yes
Force modification of the application's virtual environment. See pipx for details.
Only used when state=install, state=upgrade, state=upgrade_all, or state=inject.
include_injected
boolean
    Choices:
  • no
  • yes
Upgrade the injected packages along with the application.
Only used when state=upgrade or state=upgrade_all.
index_url
string
Base URL of Python Package Index.
Only used when state=install, state=upgrade, or state=inject.
inject_packages
list / elements=string
Packages to be injected into an existing virtual environment.
Only used when state=inject.
install_deps
boolean
    Choices:
  • no
  • yes
Include applications of dependent packages.
Only used when state=install or state=upgrade.
name
string
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 source option.
python
string
Python version to be used when creating the application virtual environment. Must be 3.6+.
Only used when state=install, state=reinstall, or state=reinstall_all.
source
string
If the application source, such as a package with version specifier, or an URL, directory or any other accepted specification. See pipx documentation for more details.
When specified, the pipx command will use source instead of name.
state
string
    Choices:
  • present
  • absent
  • install
  • uninstall
  • uninstall_all
  • inject
  • upgrade
  • upgrade_all
  • reinstall
  • reinstall_all
Desired state for the application.
The states present and absent are aliases to install and uninstall, respectively.

Notes

Note

  • 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.
  • Please note that pipx requires Python 3.6 or above.
  • This first implementation does not verify whether a specified version constraint has been installed or not. Hence, when using version operators, pipx module will always try to execute the operation, even when the application was previously installed. This feature will be added in the future.
  • See also the pipx documentation at https://pypa.github.io/pipx/.

Examples

- name: Install tox
  community.general.pipx:
    name: tox

- name: Install tox from git repository
  community.general.pipx:
    name: tox
    source: git+https://github.com/tox-dev/tox.git

- name: Upgrade tox
  community.general.pipx:
    name: tox
    state: upgrade

- name: Reinstall black with specific Python version
  community.general.pipx:
    name: black
    state: reinstall
    python: 3.7

- name: Uninstall pycowsay
  community.general.pipx:
    name: pycowsay
    state: absent

Authors

  • Alexei Znamensky (@russoz)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/pipx_module.html