ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
810 stars 1.49k forks source link

pipx: Need a way to specify pipx parameters #8656

Closed sieberst closed 4 weeks ago

sieberst commented 1 month ago

Summary

I want to install two different versions of conan (conan 1.x and conan 2.x) in parallel via pipx by renaming the binary of the conan 2 installation as "conan2". This can be done with the pipx parameter "--suffix 2", but there is currently no way to supply such pipx parameters in the Ansible task. So we need 'pipx_args' similar to the existing 'pip_args'.

Issue Type

Feature Idea

Component Name

pipx

Additional Information

    - name: Install conan 2 as conan2 with pipx
      community.general.pipx:
        name: conan
        pipx_args: "--suffix 2"

Code of Conduct

ansibullbot commented 1 month ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 1 month ago

cc @russoz click here for bot help

felixfontein commented 1 month ago

Generic module options like pipx_args are generally a Very Bad Idea. Having a specific module option for some unsupported parameter is a far better choice.

sieberst commented 1 month ago

I'm also fine with a specific parameter like "suffix":

      community.general.pipx:
        name: conan
        suffix: "2"
russoz commented 1 month ago

Hi @sieberst Thanks for raising this issue! :-) Adding parameters should be very straightforward. This --suffix parameter has been marked as experimental since ever, so I did not bother to implement it before. Now that someone is asking for it seems like a good time to do it. The PR should be coming out along this week (hopefully).

russoz commented 1 month ago

As a matter of fact, the pipx integration tests are currently disabled in the CI - long story - and running locally here I see that something got broken during this time. I should be fixing that first, then adding this feature.

gaby commented 1 month ago

@felixfontein @russoz The PR doesn't solve this ticket, which is the lack of pipx_args.

In pipx v1.6.0 support for --global was added to all the cmds, this creates a venvs for all users. There's other options completly un-accesible via ansible.

Is the plan to add each single option in pipx to ansible? There's already a pip_args, why not just add pipx_args and let the user make that decision.

felixfontein commented 1 month ago

The PR doesn't solve this ticket, which is the lack of pipx_args.

In that case this ticket has to be closed since that won't get implemented anyway. Options such as pipx_args are dangerous and prevent correct implementation of most other features.

sieberst commented 1 month ago

As I already commented in the past, I'm fine with the solution of the PR, the reason I asked for a more generic pipx_args solution was that I thought it would be more useful to have a generic solution and I didn't expect it to be a problem given the existing pip_args parameter.

russoz commented 1 month ago

@felixfontein @russoz The PR doesn't solve this ticket, which is the lack of pipx_args.

In pipx v1.6.0 support for --global was added to all the cmds, this creates a venvs for all users. There's other options completly un-accesible via ansible.

Is the plan to add each single option in pipx to ansible? There's already a pip_args, why not just add pipx_args and let the user make that decision.

As Felix explained, yes, that would be the right way to go. I am happy to implement --global or any other parameter you'd like, it is not a complicated feat. I just have not had the time to keep track of all changes in commands. Could you please help point them out - in a new issue? That would be much appreciated.

gaby commented 1 month ago

@russoz Sounds reasonable, I will create a separate issue for --global. Newer Ubuntu distributions fail if you try to install global pip packages and this pipx flag fixes that. Thanks!

Issue has been created https://github.com/ansible-collections/community.general/issues/8705