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
2 changes: 2 additions & 0 deletions acceptance/bundle/artifacts/issue_3109/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include:
- src/job1/databricks_job/resources/*.yaml
5 changes: 5 additions & 0 deletions acceptance/bundle/artifacts/issue_3109/out.test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Local = true
Cloud = false

[EnvMatrix]
DATABRICKS_CLI_DEPLOYMENT = ["terraform", "direct-exp"]
6 changes: 6 additions & 0 deletions acceptance/bundle/artifacts/issue_3109/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Building wheels...
Uploading dist/my_default_python-0.0.1-py3-none-any.whl...
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/dev/files...
Deploying resources...
Updating deployment state...
Deployment complete!
15 changes: 15 additions & 0 deletions acceptance/bundle/artifacts/issue_3109/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[project]
name = "my_default_python"
version = "0.0.1"
authors = [{ name = "[USERNAME]" }]
requires-python = ">= 3.11"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/job1/databricks_job"]

[project.scripts]
main = "my_default_python.main:main"
1 change: 1 addition & 0 deletions acceptance/bundle/artifacts/issue_3109/script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$CLI bundle deploy --target dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
targets:
dev:
mode: development
artifacts:
wheels:
type: whl
build: "uv build --wheel"
resources:
jobs:
job1:
name: job1
tasks:
- task_key: wheel_task
job_cluster_key: job_cluster
python_wheel_task:
package_name: job1_databricks_job
job_clusters:
- job_cluster_key: job_cluster
new_cluster:
spark_version: 11.3.x-scala2.12
node_type_id: i3.xlarge
num_workers: 2
1 change: 1 addition & 0 deletions acceptance/bundle/artifacts/issue_3109/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
RecordRequests = false
30 changes: 15 additions & 15 deletions bundle/artifacts/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,6 @@ func (m *prepare) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics
b.Metrics.AddBoolValue(metrics.ArtifactBuildCommandIsSet, artifact.BuildCommand != "")
b.Metrics.AddBoolValue(metrics.ArtifactFilesIsSet, len(artifact.Files) != 0)

if artifact.Type == "whl" {
if artifact.BuildCommand == "" && len(artifact.Files) == 0 {
artifact.BuildCommand = python.GetExecutable() + " setup.py bdist_wheel"
}

// Wheel builds write to `./dist`. Pick up all wheel files by default if nothing is specified.
if len(artifact.Files) == 0 {
artifact.Files = []config.ArtifactFile{
{
Source: filepath.Join(artifact.Path, "dist", "*.whl"),
},
}
}
}

l := b.Config.GetLocation("artifacts." + artifactName)
dirPath := filepath.Dir(l.File)

Expand All @@ -79,6 +64,21 @@ func (m *prepare) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics
artifact.Path = b.BundleRootPath
}

if artifact.Type == "whl" {
if artifact.BuildCommand == "" && len(artifact.Files) == 0 {
artifact.BuildCommand = python.GetExecutable() + " setup.py bdist_wheel"
}

// Wheel builds write to `./dist`. Pick up all wheel files by default if nothing is specified.
if len(artifact.Files) == 0 {
artifact.Files = []config.ArtifactFile{
{
Source: filepath.Join(artifact.Path, "dist", "*.whl"),
},
}
}
}

if !filepath.IsAbs(artifact.Path) {
artifact.Path = filepath.Join(dirPath, artifact.Path)
}
Expand Down
Loading