community.general.pipx module – Manages applications installed with pipx
Note
This module is part of the community.general collection (version 11.4.0).
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.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.pipx.
New in community.general 3.8.0
Synopsis
Manage Python applications installed in isolated virtualenvs using pipx.
Requirements
The below requirements are needed on the host that executes this module.
If the package
packagingis at a version lesser than22.0.0, it fails silently when processing invalid specifiers, liketox<<<<4.0.Please note that
pipx1.7.0 requires Python 3.8 or above.Please note that
pipx1.8.0 requires Python 3.9 or above.This module requires
pipxversion 1.7.0 or above.When using
namewith version specifiers, the Python packagepackagingis required.
Parameters
Parameter |
Comments |
|---|---|
Install the project in editable mode. Choices:
|
|
Path to the If not specified, the module uses |
|
Force modification of the application’s virtual environment. See Only used when The module is not idempotent when Choices:
|
|
The module passes the Choices:
|
|
Upgrade the injected packages along with the application. Only used when This is used with Choices:
|
|
Base URL of Python Package Index. Only used when |
|
Packages to be injected into an existing virtual environment. Only used when |
|
Include applications of dependent packages. Only used when Choices:
|
|
The name of the application and also the name of the Python package being installed. In If Starting in community.general 10.7.0, you can use package specifiers when Please note that when you use Use |
|
Arbitrary arguments to pass directly to |
|
Python version to be used when creating the application virtual environment. Must be 3.6+. Only used when |
|
Source for the package. This option is used when Use The value of this option is passed as-is to
The module is not idempotent when using |
|
Spec metadata file for This content of the file is usually generated with |
|
Desired state for the application. The states The state The states Choices:
|
|
Optional suffix for virtual environment and executable names. Warning: |
|
Give application virtual environment access to the system site-packages directory. Only used when Choices:
|
Attributes
Attribute |
Support |
Description |
|---|---|---|
Support: full |
Can run in |
|
Support: full |
Returns details on what has changed (or possibly needs changing in |
Notes
Note
This module does not install the
pipxpython package, however that can be easily done with the module ansible.builtin.pip.This module does not require
pipxto be in the shellPATH, but it must be loadable by Python as a module, meaning thatpython -m pipxmust work.This module honors
pipxenvironment variables such as but not limited toPIPX_HOMEandPIPX_BIN_DIRpassed using the environment Ansible keyword.This module disabled emojis in the output of
pipxcommands to reduce clutter. Inpipx1.8.0, the environment variableUSE_EMOJIwas renamed toPIPX_USE_EMOJIand for compatibility with both versions, starting in community.general 11.4.0, this module sets them both to0to disable emojis.
See Also
See also
- C(pipx) command manual page
Manual page for the command.
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: Install or upgrade tox with extra 'docs'
community.general.pipx:
name: tox
source: tox[docs]
state: latest
- 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
- name: Install multiple packages from list
vars:
pipx_packages:
- pycowsay
- black
- tox
community.general.pipx:
name: "{{ item }}"
state: latest
with_items: "{{ pipx_packages }}"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
Version of pipx. Returned: always Sample: |