馃殌 feature request
Relevant Rules
compile_pip_requirements's _update target works great with custom PyPI indices that require authentication via a ~/.netrc file:
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
compile_pip_requirements(
name = "requirements",
extra_args = [
"--pip-args",
"--index-url=https://pypi.company.com/simple",
],
)
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 caching
I don't really know what a solution could be, so I'm hoping some smart minds here have suggestions on how to achieve this :)
馃殌 feature request
Relevant Rules
compile_pip_requirements's_updatetarget works great with custom PyPI indices that require authentication via a~/.netrcfile:This is likely because pip supports finding and using
~/.netrcout 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_testrule 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
$NETRCvariable pypa/pip#11023, which is probably better than providing$HOMEto 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/.netrcis 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 :)