how to configure?
damienlancry opened this issue · 1 comments
damienlancry commented
hello! very nice extension! I use black in my python repositories, and I have some specific configurations for example I like to set the max-line-length to 140. is it possible to do that with this extension?
yarnabrina commented
I just figured one way myself, and sharing that. This is applicable only if you use jupyter_nbextensions_configurator
.
Then in the dashboard, navigate to the cell with a JSON line. It should have a line similar to this:
...black.format_str(cell_text, mode=black.FileMode())...
Here, you pass the configurations you need to pass. On 20.8b1
), these are the default values:
>>> black.FileMode()
Mode(target_versions=set(), line_length=88, string_normalization=True, experimental_string_processing=False, is_pyi=False)
So, for your particular point, you can use the following:
...black.format_str(cell_text, mode=black.FileMode(line_length=140))...