Skip to content

Commit c915101

Browse files
committed
Read pip index URL from PIP_CONFIG_FILE in dependency-graph tests
UV_INDEX_URL is set in CI without credentials (uv stores them in its keyring), so handing that URL to pip --index-url returns 401 and the test fails. The authenticated URL lives in PIP_CONFIG_FILE's [global] index-url, which the jfrog-auth action writes for pip. Read that file first; fall back to PIP_INDEX_URL and the dev proxy. Co-authored-by: Isaac
1 parent ccc0624 commit c915101

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

tests/integration/source_code/test_libraries.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
because it uses the context and the time it takes to run the test.
44
"""
55

6+
import configparser
67
import logging
78
import os
89
import re
@@ -16,15 +17,22 @@
1617

1718

1819
def _resolved_index_url() -> str:
19-
"""Return the pip index URL configured for the current environment.
20+
"""Return a pip-usable index URL for the current environment.
2021
21-
Local dev points at the Databricks pypi proxy; CI configures JFrog via PIP_INDEX_URL/UV_INDEX_URL.
22+
The notebook fixture invokes a real `pip install --index-url <url>`. CI's jfrog-auth action
23+
writes a pip.conf at ``$PIP_CONFIG_FILE`` whose ``[global] index-url`` carries the
24+
JFrog token; ``UV_INDEX_URL`` exists too but lacks credentials (uv stores auth in its keyring),
25+
so passing it to pip would 401. Prefer ``PIP_CONFIG_FILE`` so pip can authenticate; fall back
26+
to ``PIP_INDEX_URL`` and finally to the dev proxy used in local development.
2227
"""
23-
return (
24-
os.environ.get("PIP_INDEX_URL")
25-
or os.environ.get("UV_INDEX_URL")
26-
or "https://pypi-proxy.dev.databricks.com/simple/"
27-
)
28+
pip_config_file = os.environ.get("PIP_CONFIG_FILE")
29+
if pip_config_file and Path(pip_config_file).is_file():
30+
parser = configparser.ConfigParser()
31+
parser.read(pip_config_file)
32+
url = parser.get("global", "index-url", fallback=None)
33+
if url:
34+
return url
35+
return os.environ.get("PIP_INDEX_URL") or "https://pypi-proxy.dev.databricks.com/simple/"
2836

2937

3038
def _write_pytest_with_index_url_notebook(directory: Path) -> str:

0 commit comments

Comments
 (0)