From f652fb5fc93d2cbe6d3adec212e1c211ebba04d5 Mon Sep 17 00:00:00 2001 From: Damien Dart Date: Mon, 26 Feb 2024 20:17:31 +0000 Subject: [PATCH] Add task to update pipx-installed Python packages. --- roles/python_package/tasks/main.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/roles/python_package/tasks/main.yml b/roles/python_package/tasks/main.yml index 5883f51..2711ffa 100644 --- a/roles/python_package/tasks/main.yml +++ b/roles/python_package/tasks/main.yml @@ -19,3 +19,11 @@ register: __pipx_install changed_when: __pipx_install.stdout is search('installed package') loop: '{{ python_package__pipx_packages }}' + +- name: 'Ensure user-wide Python packages installed with "pipx" are up-to-date' + ansible.builtin.command: "/home/{{ python_package__user }}/.local/bin/pipx upgrade {{ item | split('[') | first }}" + become: true + become_user: '{{ python_package__user }}' + register: __pipx_upgrade + changed_when: __pipx_upgrade.stdout is search('upgraded package') + loop: '{{ python_package__pipx_packages }}'