cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Administration & Architecture
Explore discussions on Databricks administration, deployment strategies, and architectural best practices. Connect with administrators and architects to optimize your Databricks environment for performance, scalability, and security.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to run black code-formating on the notebooks using custom configurations in UI

Barnita
New Contributor III

Hi all,

Iโ€™m currently exploring how we can format notebook code using Black (installed via libraries) with specific configurations.

I understand that we can configure Black locally using a pyproject.toml file. However, Iโ€™d like to know if thereโ€™s a way to apply these configurations directly within the Databricks UI or cluster environment, since most of our developers primarily code in the UI.

Any guidance or suggestions would be greatly appreciated!

4 REPLIES 4

szymon_dybczak
Esteemed Contributor III

Hi @Barnita ,

On Databricks Runtime 11.3 LTS and above, Azure Databricks preinstalls black and tokenize-rt. You can use the formatter directly without needing to install these libraries.

Develop code in Databricks notebooks - Azure Databricks | Microsoft Learn

And here's an instruction of how to format code:

Develop code in Databricks notebooks - Azure Databricks | Microsoft Learn

Barnita
New Contributor III

Hi @szymon_dybczak ,

Thanks for your response. My team has been using the same setup you mentioned. Iโ€™d like to know if thereโ€™s a way to override the default configuration that Black uses in a cluster environment โ€” for example, adjusting the line-length or other formatting options.

szymon_dybczak
Esteemed Contributor III

I think it's possible. Is it described in one of the links I've shared above:

szymon_dybczak_0-1761201283981.png

 

Sure, I'll try this