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

Upgrade specific package to a specific version fails to pick up the version constraint #649

Closed
slykar opened this issue Apr 10, 2018 · 7 comments
Labels
PR wanted Feature is discussed or bug is confirmed, PR needed

Comments

@slykar
Copy link
Contributor

slykar commented Apr 10, 2018

It seems like the version constraint for a package when using the -P option is ignored.
I ran the pip-compile -v -P pytest==3.0.5 and on the first run it says:

found candidate pytest==3.5.0 (constraint was <any>)

Environment Versions
  1. Ubuntu 16.04
  2. Python version: Python 3.6.4
  3. pip version: pip 9.0.1
  4. pip-tools version: pip-compile, version 1.11.0
Steps to replicate
  1. create requirements.in file with pytest
  2. create requirements.txt file with pytest==3.0.4
  3. run pip-compile -P pytest==3.0.5
Expected result
[...]
pytest==3.0.5
[...]
Actual result
[...]
pytest==3.5.0
[...]
@slykar slykar changed the title Upgrade specific package to a specific version fails to pick up the version constrain Upgrade specific package to a specific version fails to pick up the version constraint Apr 10, 2018
@vphilippon
Copy link
Member

Hi @slykar, that's true, -P only specifies which packages should be upgraded even if valid existing pins are found in the requirements.txt. pytest==3.0.5 would actually be an invalid input right now, but the way pip-compile parses it, it accepts it and only keeps the name of the package. If you want to upgrade to a specific version, you can pin it in the requirements.in.

If you'd like to see -P/--upgrade-package take the version into account, I'm open to see a PR for that!

@slykar
Copy link
Contributor Author

slykar commented Apr 10, 2018

@vphilippon if that's true, then I might have misunderstood the README file?

$ pip-compile -P flask -P requests==2.0.0  # update the flask package to the latest, and requests to v2.0.0

Note the requests package example.

@vphilippon
Copy link
Member

Uh! That example is not going to work indeed, that slipped through, sorry about that. I'm pretty sure pip-compile never had this behavior either.

So we should either fix the README, or make this work, because that actually seem like a neat feature.

@vphilippon vphilippon added the PR wanted Feature is discussed or bug is confirmed, PR needed label Apr 10, 2018
@slykar
Copy link
Contributor Author

slykar commented Apr 10, 2018

For now I can only update the README file. If I find the time I would be happy to implement this.

Edit:

If you want to upgrade to a specific version, you can pin it in the requirements.in.

I think I had the same issue with this approach, but can't recall it right now.
I'll probably try again tomorrow, as I'm in a process of updating some project dependencies step by step.

@cdosborn
Copy link

If you don't specifically want the pin, you can temporarily pin the requirements.in, generate the requirements.txt, and then remove the pin.

@richafrank
Copy link
Contributor

@vphilippon Closable from #694 ?

@atugushev
Copy link
Member

Fixed in #694.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR wanted Feature is discussed or bug is confirmed, PR needed
Projects
None yet
Development

No branches or pull requests

5 participants