Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: pipx-package should allow to install multiple packages #89

Open
torsknod2 opened this issue Jan 6, 2025 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@torsknod2
Copy link

Requested Feature

pipx-package should allow to install multiple packages.
In addition to the package property, I suggest a property packages, which would be a dictionary/ map, which has the package name as keys and the version (or by default latest) as the values.

@torsknod2 torsknod2 added the enhancement New feature or request label Jan 6, 2025
@koralowiec
Copy link
Member

In general, pipx-package should be used for installing a specific standalone app (Python package). When it requires some additional packages to work (or some "plugins"), then it's possible to pass them via injection.

For example, ansible feature to work properly requires ansible-core, and additionally ansible package (it's passed as injection).

ansible's feature installation script:

$nanolayer_location \
    install \
    devcontainer-feature \
    "ghcr.io/devcontainers-extra/features/pipx-package:1.1.9" \
    --option package='ansible-core' --option injections='ansible' --option version="$VERSION"

So if you need a dependency for your utility, then you can use injections parameter exposed in pipx-package feature.

For example, ansible may be installed like this:

{
	"name": "Ubuntu",
	"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
	"features": {
		"ghcr.io/devcontainers-extra/features/pipx-package:1": {
			"package": "ansible-core",
			"injections": "ansible"
		}
	}
}

If you need to manage a set of packages for your project/app, then maybe a better approach is to use poetry (can be installed with poetry feature) or even virtual environment via venv module?

I'd like to learn more about your use case for this. There might be something I'm missing.

@torsknod2
Copy link
Author

Theoretically I could also do this with venv and some scripting around, pipx just makes it a lot easier.
I didn't know poetry so far, but it looks like something different, but perhaps I just do not get it.

The use-case for me is simple.
I wanted to install gcovr to use this in my workflow.
Unfortunately then I will, at least to my understanding, have the problem, that I cannot install any more packages with pipx, so I came to this idea.

The whole feature I only discovered by chance.
Before I was using directly pip and sometimes had the issue that the programs I wanted to install had conflicting package versions as requirements.
With pipx I do not have this problem and when there is even a feature for it, it makes it even more simple.

@koralowiec
Copy link
Member

koralowiec commented Jan 16, 2025

Ah, okay, I see, thanks for explaining. It would be useful to install multiple packages indeed.

This will require a bigger change though - The feature should still allow us to install injections, and install them for a specific package. For example, I should be able to install two packages: ansible-core and gcovr, and ansible as injection for ansible-core. I think about the implementation

In meantime, I can package a new feature for gcovr (I created #95 for this)

@koralowiec
Copy link
Member

@torsknod2 gcovr feature is available (https://github.com/devcontainers-extra/features/pkgs/container/features%2Fgcovr)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants