-
Notifications
You must be signed in to change notification settings - Fork 124
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
Isolated venv does not inherit PIP index #270
Comments
Thanks for reporting. It should not be the case that env vars are not inherited. Can you put together a minimal reproducible example for us to try? |
How is this configuration set? |
It is in the venv's
Does it make sense to inherit it? |
No, the parent venv is not visible to the isolated venv. That would defeat the purpose of isolation. |
If it would, it would be a venv feature. You can make this happen though by using virtualenv extra, and implementing a virtualenv plugin https://virtualenv.pypa.io/en/latest/user_guide.html#seeders |
Ok, thanks for the info - maybe pypa/pip#9752 will solve it |
IMO for use cases beyond "get dependencies from PyPI", you should use the Python API provided, and implement something with the specific behaviours that you want. I quite like how much power is easily accessible from the API of this tool. :) |
First of all, wow folks, picking up this so quickly! @pradyunsg To clarify the description, exporting the variables works and does not try to reach the internet:
To be frank, for me this seems a much simpler workaround than direct API usage (less code ;- )). However, in the CI/CD workflow I need to re-define these variables only when using Thus, I opened this issue. I could imagine that a new flag like
Or pypa/pip#9752 might also work - but I can imagine other solutions too. However, as far as I remember, the usage of Approching from another way:
For me, isolated environment means that isolated from the original venv and packages installed into that - maybe I am wrong. All in all, a feature toggle would be great and would not break backward compat -- yet I understand if it is an undesired complexity. I am also curious how other companies tackle this problem (export again like the workaround above? always have internet connection?) |
I'd expect you to not have venv specific pip.conf but a global (per machine) pip.conf for such use cases. |
I´d like to note that pypa/build using pip is merely a implementation detail, it should not be relied on, and so this workaround can not be relied on either (though it will still probably work in the near-mid future). This issue needs to be fixed, IIRC there was other issue discussing it but I am too tired to find it right now. My suggestion if you want to make sure everything absolutely works, and will continue to work, is to build without isolation - you will be required to provide the dependencies yourself. |
Thanks for the replies. @gaborbernat my colleague explained here per machine pip.conf is not suitable: pypa/pip#9752 (comment) |
In conclusion, I think the issue here isn't related to this tool. Is a limitation of virtualenv/venv/pip. And likely the fix would be either to allow pip to be smarter from where it pulls its configuration or extending virtualenv/venv to generate the appropriate configuration on virtual environment creation. Neither offers actionable items for this project, so I'll close this for now. |
I am working in an development & build environment without internet (PyPI) access. I call
python -m build --sdist .
from avenv
already configured withPIP_INDEX_URL
andPIP_TRUSTED_HOST
. However, these are not inherited by the isolatedvenv
and I have toexport
them again.To setup the venv, we use an enterprise wrapper for Python, and as general guideline, we should not specify manually the
PIP_*
parameters (but for now it is fine).Tagging @pelson , dev of our wrapper.
(Suspected) related code: https://github.com/pypa/build/blob/main/src/build/__main__.py#L49-L59
The text was updated successfully, but these errors were encountered: