rich_avery
New Contributor III

As of February 2025 it is possible using the repos rest api (I use the sdk for simplicity) and dbutils. This code snippet assumes that the notebook it's being run in is in the root of the databricks repos folder that we're interested in.

from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
 
notebook_path = dbutils.notebook.entry_point.getDbutils().notebook().getContext().notebookPath().get()
prefix_path = '/'.join(notebook_path.split('/')[:-1])

repo_info = list(w.repos.list(path_prefix = prefix_path))[0]