-
Notifications
You must be signed in to change notification settings - Fork 96
Open
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
The NotebookLoader
accounts for notebooks being referred without extension, like %run child_notebook
, but being exported to .py
files, [see this](
ucx/src/databricks/labs/ucx/source_code/notebooks/loaders.py
Lines 44 to 59 in c8859d8
def resolve(self, path_lookup: PathLookup, path: Path) -> Path | None: | |
"""If the path is a Python file, return the path to the Python file. If the path is neither, | |
return None.""" | |
# check current working directory first | |
absolute_path = path_lookup.cwd / path | |
absolute_path = absolute_path.resolve() | |
if is_a_notebook(absolute_path): | |
return absolute_path | |
# When exported through Git, notebooks are saved with a .py extension. So check with and without extension | |
candidates = (path, self._adjust_path(path)) if not path.suffix else (path,) | |
for candidate in candidates: | |
a_path = path_lookup.resolve(candidate) | |
if not a_path: | |
continue | |
return a_path | |
return None |
Expected Behavior
The is_a_notebook
does NOT account for the additional .py
extension. Which could - I think but am not sure that this is the case - lead to bugs or unfound notebook/files
Steps To Reproduce
No response
Cloud
AWS
Operating System
macOS
Version
latest via Databricks CLI
Relevant log output
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo