pipx icon indicating copy to clipboard operation
pipx copied to clipboard

Preinjection feature

Open jJit0 opened this issue 4 years ago • 3 comments

How would this feature be useful? This feature would add python modules to a virtualenv before installing the wanted tool

Describe the solution you'd like for ex: pipx install gnomecast would return an error, because it requires first to have those 2 modules dbus-python PyGObject

Describe alternatives you've considered In my case I do this:

  • virtualenv $PIPX_HOME/venvs/gnomecast
  • source $PIPX_HOME/venvs/gnomecast/bin/activate
  • pip install -U dbus-python PyGObject
  • pip install -U gnomecast && deactivate
  • pipx install -f gnomecast

I have other tools which have the same issue like netzob, imagepy, polymorph, securetea, buster and others.

It would be nice to have an option like pipx install --preinject "MODULE1 MODULE2" APPNAME like: pipx install --preinject "dbus-python PyGObject" gnomecast

jJit0 avatar Jun 06 '21 08:06 jJit0

Python provides a native way to do this with PEP 517. It sound slike gnomecast should be repackaged to take advantage of this feature instead of bolting unnecessary features onto pipx.

uranusjr avatar Jun 06 '21 17:06 uranusjr

You mean I need to open an issue in Gnomecast and other tools that have similar issue, ask them to use PEP 517.

What is this feature anyway and how can I use it ?

ghost avatar Jun 06 '21 18:06 ghost

Yes, Gnomecast will need to fix it on their side, so you’d need to talk to its maintainers.

A project can specify its build-time dependencies in pyproject.toml, and an installer will install them before attempting to build the project (from setup.py in this case). Brett Cannon wrote a good rundown of the feature and its implications to project maintainers: https://snarky.ca/what-the-heck-is-pyproject-toml/

For Gnomecast, they can add those two packages to the requires list:

[build-system]
requires = ["setuptools >= 40.6.0", "wheel", "dbus-python", "PyGObject"]
build-backend = "setuptools.build_meta"

uranusjr avatar Jun 06 '21 22:06 uranusjr

This feature is added in #900.

dukecat0 avatar Aug 25 '23 16:08 dukecat0