Skip to content

Commit

Permalink
[PR #6212/33093e9f backport][stable-6] pipx: document parameters supp…
Browse files Browse the repository at this point in the history
…orted with state=latest, and fix include_injected parameter (#6266)

pipx: document parameters supported with state=latest, and fix include_injected parameter (#6212)

* pipx: Document parameters supported with state=latest

* pipx: Support "include_injected" with states "upgrade" and "latest"

- Contrary to documentation, "include_injected" doesn't appear to have
  worked with state=upgrade since it was introduced.
- Add support for include_injected with "latest", since "latest" is
  specified as being install+upgrade.

* Add changelog fragment

* Update plugins/modules/pipx.py

Co-authored-by: Felix Fontein <[email protected]>

* Update changelog fragment

Co-authored-by: Felix Fontein <[email protected]>

* pipx: Update to correct target release of community.general

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit 33093e9)

Co-authored-by: Paul Aurich <[email protected]>
  • Loading branch information
patchback[bot] and darkrain42 authored Mar 30, 2023
1 parent 81a95a3 commit 6b0cc3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/6212-pipx-include-injected.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- pipx - ensure ``include_injected`` parameter works with ``state=upgrade`` and ``state=latest`` (https://github.com/ansible-collections/community.general/pull/6212).
15 changes: 8 additions & 7 deletions plugins/modules/pipx.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
install_deps:
description:
- Include applications of dependent packages.
- Only used when I(state=install), I(state=upgrade), or I(state=inject).
- Only used when I(state=install), I(state=latest), I(state=upgrade), or I(state=inject).
type: bool
default: false
inject_packages:
Expand All @@ -69,24 +69,25 @@
force:
description:
- Force modification of the application's virtual environment. See C(pipx) for details.
- Only used when I(state=install), I(state=upgrade), I(state=upgrade_all), or I(state=inject).
- Only used when I(state=install), I(state=upgrade), I(state=upgrade_all), I(state=latest), or I(state=inject).
type: bool
default: false
include_injected:
description:
- Upgrade the injected packages along with the application.
- Only used when I(state=upgrade) or I(state=upgrade_all).
- Only used when I(state=upgrade), I(state=upgrade_all), or I(state=latest).
- This is used with I(state=upgrade) and I(state=latest) since community.general 6.6.0.
type: bool
default: false
index_url:
description:
- Base URL of Python Package Index.
- Only used when I(state=install), I(state=upgrade), or I(state=inject).
- Only used when I(state=install), I(state=upgrade), I(state=latest), or I(state=inject).
type: str
python:
description:
- Python version to be used when creating the application virtual environment. Must be 3.6+.
- Only used when I(state=install), I(state=reinstall), or I(state=reinstall_all).
- Only used when I(state=install), I(state=latest), I(state=reinstall), or I(state=reinstall_all).
type: str
executable:
description:
Expand Down Expand Up @@ -254,7 +255,7 @@ def state_upgrade(self):
if self.vars.force:
self.changed = True

with self.runner('state index_url install_deps force editable pip_args name', check_mode_skip=True) as ctx:
with self.runner('state include_injected index_url install_deps force editable pip_args name', check_mode_skip=True) as ctx:
ctx.run()
self._capture_results(ctx)

Expand Down Expand Up @@ -307,7 +308,7 @@ def state_latest(self):
ctx.run(state='install', name_source=[self.vars.name, self.vars.source])
self._capture_results(ctx)

with self.runner('state index_url install_deps force editable pip_args name', check_mode_skip=True) as ctx:
with self.runner('state include_injected index_url install_deps force editable pip_args name', check_mode_skip=True) as ctx:
ctx.run(state='upgrade')
self._capture_results(ctx)

Expand Down

0 comments on commit 6b0cc3c

Please sign in to comment.