databricks-cli/bundle/config
Gleb Kanterov 3d91691f25
PythonMutator: propagate source locations (#1783)
## Changes
Add a mechanism to load Python source locations in the Python mutator.
Previously, locations pointed to generated YAML. Now, they point to
Python sources instead. Python process outputs "locations.json"
containing locations of bundle paths, examples:

```json
{"path": "resources.jobs.job_0", "file": "resources/job_0.py", "line": 3, "column": 5}
{"path": "resources.jobs.job_0.tasks[0].task_key", "file": "resources/job_0.py", "line": 10, "column": 5}
{"path": "resources.jobs.job_1", "file": "resources/job_1.py", "line": 5, "column": 7}
```

Such locations form a tree, and we assign locations of the closest
ancestor to each `dyn.Value` based on its path. For example,
`resources.jobs.job_0.tasks[0].task_key` is located at `job_0.py:10:5`
and `resources.jobs.job_0.tasks[0].email_notifications` is located at
`job_0.py:3:5`, because we use the location of the job as the most
precise approximation.

This feature is only enabled if `experimental/python` is used.

Note: for now, we don't update locations with relative paths, because it
has a side effect in changing how these paths are resolved

## Example
```
% databricks bundle validate

Warning: job_cluster_key abc is not defined
  at resources.jobs.examples.tasks[0].job_cluster_key
  in resources/example.py:10:1
```

## Tests
Unit tests and manually
2025-01-22 15:37:37 +00:00
..
generate Added support for Databricks Apps in DABs (#1928) 2025-01-13 16:43:48 +00:00
loader Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
mutator PythonMutator: propagate source locations (#1783) 2025-01-22 15:37:37 +00:00
resources Added support for Databricks Apps in DABs (#1928) 2025-01-13 16:43:48 +00:00
validate Enable linter 'copyloopvar' and fix the issues (#2160) 2025-01-16 11:20:50 +00:00
variable Enable perfsprint linter and apply autofix (#2071) 2025-01-07 10:49:23 +00:00
artifact.go Enable perfsprint linter and apply autofix (#2071) 2025-01-07 10:49:23 +00:00
artifacts_test.go Added exec.NewCommandExecutor to execute commands with correct interpreter (#1075) 2023-12-21 15:45:23 +00:00
bundle.go Add the `bundle_uuid` helper function for templates (#1947) 2024-12-02 10:29:29 +00:00
deployment.go Make lock optional in the JSON schema (#1738) 2024-09-02 08:39:08 +00:00
experimental.go Add 'experimental/python' support (#2052) 2025-01-08 09:29:45 +00:00
filename.go Move bundle configuration filename code (#917) 2023-10-25 09:54:39 +00:00
filename_test.go Move bundle configuration filename code (#917) 2023-10-25 09:54:39 +00:00
git.go Use dynamic configuration model in bundles (#1098) 2024-02-16 19:41:58 +00:00
lock.go Disable locking for development mode (#1302) 2024-04-18 01:59:39 +00:00
lock_test.go Acquire lock prior to deploy (#270) 2023-03-22 16:37:26 +01:00
presets.go Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
resources.go Added support for Databricks Apps in DABs (#1928) 2025-01-13 16:43:48 +00:00
resources_test.go Enable intrange linter and apply autofix (#2069) 2025-01-03 09:25:07 +00:00
root.go Clean up unnecessary cleanup of inferred flag (#2193) 2025-01-20 17:21:34 +00:00
root_test.go Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
sync.go Add paths field to bundle sync configuration (#1694) 2024-08-21 15:33:25 +00:00
target.go Added support for creating all-purpose clusters (#1698) 2024-09-23 10:42:34 +00:00
workspace.go Always prepend bundle remote paths with /Workspace (#1724) 2024-10-02 15:34:00 +00:00
workspace_test.go Add error checking in tests and enable errcheck there (#1980) 2024-12-09 13:56:41 +01:00