pypa / pipx

Install and Run Python Applications in Isolated Environments
https://pipx.pypa.io
MIT License
10.23k stars 411 forks source link

Using pipx run and updating git versions #1463

Open aantn opened 3 months ago

aantn commented 3 months ago

When using pipx run git+... I seem to have two options:

  1. Pass --no-cache and install the entire virtualenv from scratch
  2. Don't pass --no-cache and use whatever git version was latest when I first ran pipx run (potentially several days ago)

Is there an alternative where I can reuse the virtualenv but for pipx/pip to always try to upgrade from the latest in git?

There might be a way I can do this with pipx install so I'd love to hear alternatives. But please note that I need to have multiple versions of the same repo installed side by side simultaneously (from different branches). (I'm using pipx inside a testing framework to test versions side by side.)

Thanks!

huxuan commented 3 months ago

It looks like pipx install with --suffix is what you need. I use that to install different versions of pipx for test when developing.

aantn commented 3 months ago

Nice, thank you. I can make it work with that. (Although it would be wonderful to have a solution with pipx run too! That lets me simplify the workflow a lot.)

huxuan commented 3 months ago

Will --pip-args='--upgrade' be helpful? Actually, I have not tried it yet.

aantn commented 3 months ago

No, it doesn't work when run twice in a row. (But if you run it once without --pip-args='--upgrade' and once with --pip-args='--upgrade' then it does work because that bypasses the cache.)

huxuan commented 3 months ago

No, it doesn't work when run twice in a row.

I am a little confused. Could you provide a minimal reproducible example (or a real one)?

aantn commented 3 months ago

Sure, I've recorded a 2 minute video showing this.

https://www.loom.com/share/691942f87f7e45d7a5ea84ec14492691