cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

How to run code-formating on the notebooks

Erik
Valued Contributor II

Has anyone found a nice way to run code-formating (like black) on the notebooks **in the workspace**? My current workflow is to commit the file, pull it locally, format, repush and pull. It would be nice if it was some relatively easy way to run black on the notebook up in the workspace, is it?

1 ACCEPTED SOLUTION

Accepted Solutions

austin_ford
New Contributor III
New Contributor III

Hi @Erik Parmann​  -- We do not currently have auto-formatting capabilities in the Notebook. As @Joseph Kambourakis​ mentioned, we are working on a new IDE support capability that will enable users to re-format inside of their IDE, but that is currently in development.

We are interested in adding auto-formatting to the Notebook via a tool like black in the future, but we have no plans at this time.

View solution in original post

6 REPLIES 6

Anonymous
Not applicable

I don't believe there is a way to do that. We do have something in development called DevBricks that will help with this kind of issue though. It's an IDE tool and it should be in preview soon. If you're interested in it talk to your CSE

Kaniz
Community Manager
Community Manager

Hi @Erik Parmann​ , Does @Joseph Kambourakis​ 's reply answer your question?

Erik
Valued Contributor II

@Kaniz Fatma​  Yes:-)

Kaniz
Community Manager
Community Manager

Great!

Would you like to mark it as the best answer?

@Erik Parmann​ 

austin_ford
New Contributor III
New Contributor III

Hi @Erik Parmann​  -- We do not currently have auto-formatting capabilities in the Notebook. As @Joseph Kambourakis​ mentioned, we are working on a new IDE support capability that will enable users to re-format inside of their IDE, but that is currently in development.

We are interested in adding auto-formatting to the Notebook via a tool like black in the future, but we have no plans at this time.

MartinPlay01
New Contributor II

Hi Erik,

I don't know if you are aware of this feature, currently there is an option to format the code in your databricks notebooks using the black code style formatter.

Just you need to either have a version of your DBR equal to or greater than 11.2 (the libraries are configured by default) either configure the next libraries in your cluster

%pip install black==22.3.0 tokenize-rt==4.2.1

 https://docs.databricks.com/en/notebooks/notebooks-code.html#format-python-cells 

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.