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

URL based dependencies don't generate a hash #146

Open
3 tasks done
lucaskjaero opened this issue Feb 19, 2020 · 10 comments
Open
3 tasks done

URL based dependencies don't generate a hash #146

lucaskjaero opened this issue Feb 19, 2020 · 10 comments

Comments

@lucaskjaero
Copy link

lucaskjaero commented Feb 19, 2020

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

When adding a normal python dependency, poetry will generate hashes of the downloaded files to put in the lockfile. These can then be given to pip to create reproducible builds. When adding a url dependency, these hashes are not created, and pip cannot successfully install dependencies.

Steps to reproduce

  1. poetry add https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz
  2. poetry export -f requirements.txt | /venv/bin/pip install -r /dev/stdin
@novemberkilo
Copy link

novemberkilo commented Mar 2, 2020

@lucaskjaero is this related to python-poetry/poetry#1631? In essence I don't think poetry generates hashes. It receives them from pypi but not necessarily from private repositories.

Depending on your situation, if you can get away with a requirements file that only contains version numbers and not hashes, you can try:

poetry export --without-hashes -f requirements.txt | /venv/bin/pip install -r /dev/stdin

@lucaskjaero
Copy link
Author

@novemberkilo Yes, I think they might have the same root cause. That workaround definitely helps, thanks!
It would be nice to get official support for making hashes though, since they are useful.

@mfrlin
Copy link

mfrlin commented Mar 16, 2020

Is there a workaround for this? Can we calculate hash manually and somehow include it in pyproject.toml file?

@polyatail
Copy link

@mfrlin You can use pip-compile --generate-hashes from pip_tools on the requirements.txt output from poetry. IIRC, this will fallback to generating hashes when not provided by the source.

@fredrikaverpil
Copy link

I believe this problem is also hit if you are using your own private pypi repos. All my regular dependencies have hashes, but for all packages installed from our private pypi repo, the hashes are missing when performing a poetry export.

@AndreyMZ
Copy link

I believe this issue should not have low priority because it is a security concern. People use these hashes to mitigate a certain security risk.

The pip install command requires hashes either for all dependencies or for none of them. If a project has at least one URL dependency, then poetry does not produce the hash for it, and we have to ignore hashes for all dependencies, including ones from PyPi (using poetry export --without-hashes). The risk remains not mitigated.

@dimbleby
Copy link
Contributor

dimbleby commented Oct 11, 2022

this issue belonged in poetry all along: if poetry were to store hashes for url dependencies then the export plugin would write them out

@neersighted
Copy link
Member

I'm not sure -- the original ask is for poetry export, even if the code that drives this mostly lives in Poetry. I could go either way, but given all the discussion was around export I put it here. I wouldn't mind opening an issue in Poetry itself that tracks this more directly and references this issue.

@dimbleby
Copy link
Contributor

if there isn't an issue somewhere complaining that poetry fails to store hashes for url dependencies there probably ought to be; and then this would be entirely secondary to that

@dunkmann00
Copy link

This should be resolved with python-poetry/poetry#7121

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

No branches or pull requests

9 participants