Skip to content

Commit 7868cea

Browse files
authored
Convert all tests that use uv to use vendored packages (#4830)
## Changes - In acceptance tests and in libs/patchwheel unit tests configure UV_FIND_LINKS to point to a directory inside the repo containing all necessary wheels. Set UV_OFFLINE=true. - Add extra --no-index flag to uv commands where possible. This does not change the behaviour, but extra safety check in case UV_OFFLINE=true is lost or stopped working. - Remove --no-cache from all uv invocations. This also does not change the behaviour but can save a bit of time. ## Why Make it possible to run the test suite without access to PyPI. The only exception remaining is acceptance/cmd/workspace/apps/run-local-node which reads from NPM. ## Tests Existing tests pass despite PyPI being blocked. I checked that vendored packages hashes match the ones published on PyPI (and none of the packages are recent): ``` SHA256 (databricks_bundles-0.266.0-py3-none-any.whl) = 915fb0b44a64c46a979343ed31f54410410130e5cc4535989e68bfa168721668 SHA256 (flit_core-3.12.0-py3-none-any.whl) = e7a0304069ea895172e3c7bb703292e992c5d1555dd1233ab7b5621b5b69e62c SHA256 (hatchling-1.27.0-py3-none-any.whl) = d3a2f3567c4f926ea39849cdf924c7e99e6686c9c8e288ae1037c8fa2a5d937b SHA256 (packaging-25.0-py3-none-any.whl) = 29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484 SHA256 (pathspec-0.12.1-py3-none-any.whl) = a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08 SHA256 (pip-24.0-py3-none-any.whl) = ba0d021a166865d2265246961bec0152ff124de910c5cc39f1156ce3fa7c69dc SHA256 (pluggy-1.6.0-py3-none-any.whl) = e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746 SHA256 (setuptools-78.1.0-py3-none-any.whl) = 3e386e96793c8702ae83d17b853fb93d3e09ef82ec62722e61da5cd22376dcd8 SHA256 (tomli-2.2.1-py3-none-any.whl) = cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc SHA256 (trove_classifiers-2025.9.11.17-py3-none-any.whl) = 5d392f2d244deb1866556457d6f3516792124a23d1c3a463a2e8668a5d1c15dd SHA256 (wheel-0.45.1-py3-none-any.whl) = 708e7481cc80179af0e556bbf0cc00b8444c7321e2700b8d8580231d13017248 ```
1 parent 66abbca commit 7868cea

50 files changed

Lines changed: 77 additions & 61 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

acceptance/acceptance_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,15 @@ func testAccept(t *testing.T, inprocessMode bool, singleTest string) int {
198198
setupTerraform(t, cwd, buildDir, &repls)
199199
}
200200

201+
vendoredPyPackages, err := filepath.Abs("../libs/vendored_py_packages")
202+
require.NoError(t, err)
203+
t.Setenv("VENDORED_PY_PACKAGES", vendoredPyPackages)
204+
repls.SetPath(vendoredPyPackages, "[VENDORED_PY_PACKAGES]")
205+
206+
// Make all uv invocations use vendored packages instead of PyPI
207+
t.Setenv("UV_FIND_LINKS", vendoredPyPackages)
208+
t.Setenv("UV_OFFLINE", "true")
209+
201210
wheelPath := buildDatabricksBundlesWheel(t, buildDir)
202211
if wheelPath != "" {
203212
t.Setenv("DATABRICKS_BUNDLES_WHEEL", wheelPath)
@@ -1387,7 +1396,7 @@ func buildDatabricksBundlesWheel(t *testing.T, buildDir string) string {
13871396
// so we prepare here by keeping only one.
13881397
_ = prepareWheelBuildDirectory(t, buildDir)
13891398

1390-
RunCommand(t, []string{"uv", "build", "--no-cache", "-q", "--wheel", "--out-dir", buildDir}, "../python", []string{})
1399+
RunCommand(t, []string{"uv", "build", "-q", "--wheel", "--no-index", "--out-dir", buildDir}, "../python", []string{})
13911400

13921401
latestWheel := prepareWheelBuildDirectory(t, buildDir)
13931402
if latestWheel == "" {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
uv venv -q .venv
22
venv_activate
3-
uv pip install -q setuptools
3+
uv pip install -q --no-index setuptools

acceptance/bundle/integration_whl/script.prepare

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
uv venv -q .venv
22
venv_activate
3-
uv pip install -q setuptools
3+
uv pip install -q --no-index setuptools
44

55
# On Windows, create python3 alias since some build commands use python3
66
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" || "$OSTYPE" == "win32" ]]; then

acceptance/bundle/python/experimental-compatibility-both-equal/out.test.toml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

acceptance/bundle/python/experimental-compatibility-both-equal/script

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
echo "$DATABRICKS_BUNDLES_WHEEL" > "requirements-latest.txt"
21

32
# each job should record location where add_job function was called
43

acceptance/bundle/python/experimental-compatibility-both-error/out.test.toml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

acceptance/bundle/python/experimental-compatibility-both-error/script

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
echo "$DATABRICKS_BUNDLES_WHEEL" > "requirements-latest.txt"
21

32
# each job should record location where add_job function was called
43

acceptance/bundle/python/experimental-compatibility/out.test.toml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

acceptance/bundle/python/experimental-compatibility/script

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
echo "$DATABRICKS_BUNDLES_WHEEL" > "requirements-latest.txt"
21

32
# each job should record location where add_job function was called
43

acceptance/bundle/python/grants-aliases/out.test.toml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)