Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you run blackbricks while using databricks in the browser? #27

Closed
msmall318 opened this issue Sep 9, 2022 · 4 comments
Closed

Can you run blackbricks while using databricks in the browser? #27

msmall318 opened this issue Sep 9, 2022 · 4 comments

Comments

@msmall318
Copy link
Contributor

msmall318 commented Sep 9, 2022

For those without a CLI setup, could you run this in the browser version of databricks?
My thought would be blackbricks.format_notebook('notebook_path', ['notebook_dest']) with ['notebook_dest'] being an optional argument with the default being notebook_path to just update the current notebook.

@msmall318
Copy link
Contributor Author

Found in the documentation that request is not currently possible

@bsamseth
Copy link
Collaborator

Hi! There are two ways this could have worked, but none of which work as you would hope:

  • The databricks CLI is preinstalled on recent Databricks runtimes, but they do not automatically set up credentials for you. If you do configure the databricks CLI on a cluster, you could run blackbricks just as normal.
  • The notebook file does live on the filesystem that you can get at with a %sh cell. This would have been a solution, where you could just run blackbricks on the cluster-filesystem file. Sadly, it doesn't work because for some reason you can't access the contents of notebooks via the filesystem. See this example.
    image

So, the conclusion is that no, right now you cannot do what you want, and there doesn't seem to be a way for blackbricks to work around it either. You need to either sync the notebook as a local file and run blackbricks on that before you reupload it, or you'll need to set up databricks CLI and run blackbricks on the remotely stored notebooks.

bsamseth added a commit that referenced this issue Sep 10, 2022
@tedjt
Copy link

tedjt commented Oct 27, 2022

We just added support embedded in the notebook web ui for formatting python cells with Black when using DBR 11.2
https://docs.databricks.com/notebooks/notebooks-use.html#format-code-cells on

Blackbricks is still better for formatting integrated with CI and for bulk formatting many files, but for quick cell level formatting during development, hopefully the new feature works for people.

@msmall318
Copy link
Contributor Author

Thanks for the info. I'll check it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants