databricks-cli/libs/filer
shreyas-goenka e1978fa429
Add support for non-Python ipynb notebooks to DABs (#1827)
## Changes

### Background

The workspace import APIs recently added support for importing Jupyter
notebooks written in R, Scala, or SQL, that is non-Python notebooks.
This now works for the `/import-file` API which we leverage in the CLI.

Note: We do not need any changes in `databricks sync`. It works out of
the box because any state mapping of local names to remote names that we
store is only scoped to the notebook extension (i.e., `.ipynb` in this
case) and is agnostic of the notebook's specific language.

### Problem this PR addresses

The extension-aware filer previously did not function because it checks
that a `.ipynb` notebook is written in Python. This PR relaxes that
constraint and adds integration tests for both the normal workspace
filer and extensions aware filer writing and reading non-Python `.ipynb`
notebooks.

This implies that after this PR DABs in the workspace / CLI from DBR
will work for non-Python notebooks as well. non-Python notebooks for
DABs deployment from local machines already works after the platform
side changes to the API landed, this PR just adds integration tests for
that bit of functionality.

Note: Any platform side changes we needed for the import API have
already been rolled out to production.

### Before

DABs deploy would work fine for non-Python notebooks. But DABs
deployments from DBR would not.

### After

DABs deploys both from local machines and DBR will work fine.

## Testing

For creating the `.ipynb` notebook fixtures used in the integration
tests I created them directly from the VSCode UI. This ensures high
fidelity with how users will create their non-Python notebooks locally.
For Python notebooks this is supported out of the box by VSCode but for
R and Scala notebooks this requires installing the Jupyter kernel for R
and Scala on my local machine and using that from VSCode.

For SQL, I ended up directly modifying the `language_info` field in the
Jupyter metadata to create the test fixture.

### Discussion: Issues with configuring language at the cell level

The language metadata for a Jupyter notebook is standardized at the
notebook level (in the `language_info` field). Unfortunately, it's not
standardized at the cell level. Thus, for example, if a user changes the
language for their cell in VSCode (which is supported by the standard
Jupyter VSCode integration), it'll cause a runtime error when the user
actually attempts to run the notebook. This is because the cell-level
metadata is encoded in a format specific to VSCode:
```
cells: []{
    "vscode": {
     "languageId": "sql"
    }
}
```

Supporting cell level languages is thus out of scope for this PR and can
be revisited along with the workspace files team if there's strong
customer interest.
2024-11-13 21:39:51 +00:00
..
completer Add command line autocomplete to the fs commands (#1622) 2024-08-09 09:40:25 +00:00
dbfs_client.go Upgraded Go version to 1.21 (#664) 2023-08-15 13:50:40 +00:00
fake_filer.go Add command line autocomplete to the fs commands (#1622) 2024-08-09 09:40:25 +00:00
filer.go Show actionable errors for collaborative deployment scenarios (#1386) 2024-10-10 11:18:23 +00:00
files_client.go [Fix] Do not buffer files in memory when downloading (#1599) 2024-07-17 07:14:02 +00:00
fs.go Add fs.FS adapter for the filer interface (#422) 2023-06-02 12:49:59 +00:00
fs_test.go Add command line autocomplete to the fs commands (#1622) 2024-08-09 09:40:25 +00:00
local_client.go Update error checks that use the `os` package to use `errors.Is` (#1461) 2024-06-03 12:39:36 +00:00
local_root_path.go Remove unnecessary `filepath.FromSlash` calls (#1458) 2024-05-29 15:30:26 +00:00
local_root_path_test.go Make local files default for fs commands (#506) 2023-06-23 16:07:09 +02:00
slice.go Upgraded Go version to 1.21 (#664) 2023-08-15 13:50:40 +00:00
slice_test.go Abstract over file handling with WSFS or DBFS through filer interface (#135) 2022-12-14 15:37:14 +01:00
workspace_files_cache.go Implement readahead cache for Workspace API calls (#1582) 2024-07-18 09:45:10 +00:00
workspace_files_cache_test.go Add tests for the Workspace API readahead cache (#1605) 2024-07-19 07:03:25 +00:00
workspace_files_client.go Show actionable errors for collaborative deployment scenarios (#1386) 2024-10-10 11:18:23 +00:00
workspace_files_client_test.go Move bespoke status call to main workspace files filer (#1570) 2024-07-05 11:32:29 +00:00
workspace_files_extensions_client.go Add support for non-Python ipynb notebooks to DABs (#1827) 2024-11-13 21:39:51 +00:00
workspace_files_extensions_client_test.go Add support for non-Python ipynb notebooks to DABs (#1827) 2024-11-13 21:39:51 +00:00
workspace_root_path.go Make local files default for fs commands (#506) 2023-06-23 16:07:09 +02:00
workspace_root_path_test.go Make local files default for fs commands (#506) 2023-06-23 16:07:09 +02:00