Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Change black linelength
-
I would like to reformat with black with another line length than the default of 88.
I know that this is in black/const.py, but this seems to be read only.
How can I change const.py, copy black completely or give command line parameters in the reformat command. Or ...? -
@upwart Perhaps a
pyproject.toml
file with the right settings? I did not try that but it might work. -
@ccc
That's a good suggestion.
I tried putting a proper pyproject.toml in the folder where the to-be-reformatted file resides or the parent folder. But it doesn't work.
@omz
It would be nice if I just could edit a file in the site-packages (built-in) , but that folder is obviously readonly. Making that folder read/write would also allow patches in other built in modules. -
@upwart please see the psf/black docs to see what other config files they support.
-
-
This post is deleted! -
This is to tell that I have managed to get black to use an alternative line length (160 in my case), by pip installing black. It will be installed in the site-packages (user) folder. And there, I can just patch the const.py file.
It seems to work perfectly. Hooray! -
ruff.toml
did not work? -
@ccc
What do you mean with ruff.toml?
I tried pyproject.toml, but could get that working. -
-
@cvp
Thanks for thinking with me.
I know how to add the Black section to pyproject.toml. Just can't work out where to put it in Pythonista to work with reformat.
Anyway, I've it working now via a user installation of Back.