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

pipx upgrade with a specificier #356

Open
uranusjr opened this issue Feb 6, 2020 · 10 comments
Open

pipx upgrade with a specificier #356

uranusjr opened this issue Feb 6, 2020 · 10 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@uranusjr
Copy link
Member

uranusjr commented Feb 6, 2020

How would this feature be useful?

Since 0.15 pipx got rid of the --spec argument, but now I can’t upgrade a package to a difference spec. Previously I could

pipx install virtualenv

# Some time later…
pipx upgrade virtualenv --spec "virtualenv>=30.0b2"
pipx upgrade virtualenv --spec "git+https://github.com/pypa/virtualenv.git"

Describe the solution you'd like

Either add back the --spec argument for upgrade, or allow e.g.

# Current fails with "Package cannot be a url"
pipx upgrade "git+https://github.com/pypa/virtualenv.git"

# Current fails with "FileNotFoundError"
pipx upgrade "virtualenv>=30.0b2"
@itsayellow
Copy link
Contributor

Just to check, will the workaround work: pipx uninstall followed by pipx install ? Or is there a reason (besides extra typing) that that's worse?

@itsayellow
Copy link
Contributor

Another idea, #256 could replace this functionality.

@uranusjr
Copy link
Member Author

uranusjr commented Feb 7, 2020

I’d assume upgrade to keep injected packages. reinstall makes sense as well.

@itsayellow
Copy link
Contributor

Ah yes, preserving injected packages, that makes sense with upgrade.

In general I think we need to look at the options for upgrade (and reinstall if it is created separate from reinstall-all). It would be nice to have the options for these commands only supersede the existing metadata if they are present, and otherwise the existing metadata in the venv would be used. I don't think that's currently how they're set up.

@morrison12
Copy link

Just to check, will the workaround work: pipx uninstall followed by pipx install ? Or is there a reason (besides extra typing) that that's worse?

If one is trying to automate, i.e. have a script that ensures a specific rev of something is installed, then it is a bit of work to find the right pipx_metadata.json file and find the right field and see if the uninstall/install sequence is needed.

@itsayellow
Copy link
Contributor

I wonder if this would be worth a different pipx subcommand, like possibly modify.

@pohlt
Copy link

pohlt commented Jun 17, 2021

While uninstall and install in principle do the job, it might take quite some time if you have many large dependencies.
I would prefer to reuse as much as possible from the existing installation.

@dukecat0 dukecat0 added the enhancement New feature or request label Aug 5, 2022
@uranusjr uranusjr changed the title pipx upgrade with a URL pipx upgrade with a specificier Aug 14, 2022
@ngnpope
Copy link

ngnpope commented Jan 20, 2023

I use the following as a workaround to downgrade/upgrade as required, e.g.:

$ pipx inject poetry poetry==1.2.2

@sumkincpp
Copy link

sumkincpp commented Jul 7, 2023

I would be also expecting that the same spec as in pip is supported.

The fact that we use pip to install packages is an implementation detail, so I don't want --upgrade flag. But happy to fix original issue.

@gaborbernat gaborbernat added the help wanted Extra attention is needed label Dec 2, 2023
@gsemet
Copy link

gsemet commented Jan 10, 2025

pipx inject toolname 'toolname>=5.5.2'

does not force update if the version misalign.

Please allow to update to spec easily, for instance

pip upgrade 'toolname>5'

this should update if the version is <=5, and install if not installed.

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

No branches or pull requests

9 participants