.netrc authentication support for private index-url in requirements_test
#1087
Labels
Can Close?
Will close in 30 days if there is no new activity
requirements_test
#1087
🚀 feature request
Relevant Rules
compile_pip_requirements
's_update
target works great with custom PyPI indices that require authentication via a~/.netrc
file:This is likely because pip supports finding and using
~/.netrc
out of the box. See https://pip.pypa.io/en/stable/topics/authentication/See also #503 (comment)
Description
compile_pip_requirements
(https://github.com/bazelbuild/rules_python/blob/main/python/pip_install/requirements.bzl#L20) automatically adds a_test
rule that checks whether the requirements.in to requirements.txt conversion works.This fails with authentication issues in
pip-compile
. My guess is that the Bazel test environment does not propagate the $HOME env var, so pip-compile can not see the .netrc file.There is also (undocumented) support for a
$NETRC
variable pypa/pip#11023, which is probably better than providing$HOME
to tests.Describe the solution you'd like
What's not so straightforward is finding out where that netrc is if it's not checked in into the repo.
Setting
--test_env=NETRC=$HOME/.netrc
is another idea, but that will completely void all benefits of remote cachingI don't really know what a solution could be, so I'm hoping some smart minds here have suggestions on how to achieve this :)
The text was updated successfully, but these errors were encountered: