Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions acceptance/bundle/python/venv-path-subdir/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
bundle:
name: my_project
sync: {paths: []}
python:
venv_path: .venv
resources:
- "resources:load_resources"
3 changes: 3 additions & 0 deletions acceptance/bundle/python/venv-path-subdir/out.test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Cloud = false
EnvMatrix.DMS = ["", "true"]
EnvMatrix.PYDAB_VERSION = ["current"]
20 changes: 20 additions & 0 deletions acceptance/bundle/python/venv-path-subdir/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

=== from the bundle root

>>> [CLI] bundle summary
Name: my_project
Target: default
Workspace:
User: [USERNAME]
Path: /Workspace/Users/[USERNAME]/.bundle/my_project/default
Resources:
Jobs:
my_job:
Name: My Job
URL: (not deployed)

=== from a subdirectory

>>> withdir src [CLI] bundle summary
Error: failed to get Python interpreter path: can't find "[VENV_PYTHON]", check if virtualenv is created

7 changes: 7 additions & 0 deletions acceptance/bundle/python/venv-path-subdir/resources.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from databricks.bundles.core import Resources


def load_resources() -> Resources:
resources = Resources()
resources.add_job("my_job", {"name": "My Job"})
return resources
10 changes: 10 additions & 0 deletions acceptance/bundle/python/venv-path-subdir/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
uv venv -q .venv
uv pip install -q --python .venv "$(cat requirements-latest.txt)"

title "from the bundle root"
trace $CLI bundle summary

title "from a subdirectory"
musterr trace withdir src $CLI bundle summary

rm -fr .databricks __pycache__ .venv
Empty file.
9 changes: 9 additions & 0 deletions acceptance/bundle/python/venv-path-subdir/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# The venv gets the wheel built from this commit; another databricks-bundles version adds nothing here.
EnvMatrix.PYDAB_VERSION = ["current"]

Badness = "python.venv_path is resolved against the current directory instead of the bundle root, so with the default venv_path: .venv every bundle command run from a subdirectory of the bundle (here src/) fails with 'can't find \".venv/bin/python3\", check if virtualenv is created'; it should use <bundle root>/.venv as it does when run from the root."

# The venv interpreter is bin/python3 on Unix and Scripts\python.exe on Windows.
[[Repls]]
Old = '\.venv[/\\]+(bin[/\\]+python3|Scripts[/\\]+python\.exe)'
New = '[VENV_PYTHON]'
Loading