Blacken not finding pyproject.toml over TRAMP
I'm working on a project that has this in the pyproject.toml:
[tool.black]
line-length = 100
black says that nothing needs to be reformatted:
$ black --check .
All done! ✨ 🍰 ✨
177 files would be left unchanged.
But when I have blacken-mode running, lines longer than 100 are reformatted on save. I have to set blacken-line-length to 100 to get the desired behavior. Why doesn't black use the configured line length when it's run through blacken-mode?
If it makes a difference, this is over TRAMP.
What's the value of blacken-line-length in that buffer? If that's nil blacken shouldn't pass any additional --line-length parameter to black.
It's nil. I logged the arguments passed to black, and it's just -.
I think this is related to TRAMP. I cloned the same repository locally and on my server, and the behavior only happens when using blacken with the project on the server.
Makes sense. fyi, I'm not using blacken myself anymore (switched to apheleia) so if you send a PR I'll have a look and merge it but I don't think it'll get fixed otherwise.
Thanks
Yea, I did a quick test executing (start-process "test" "test" "pwd") in a TRAMP buffer and the local buffer. In the local buffer, it returns the path to the file's directory as expected. With the TRAMP buffer, it returns the home directory on my local machine, so it wouldn't be able to find the pyproject.toml file. But doing (start-file-process "test" "test" "pwd") seems to do the correct thing with TRAMP.
That being said, I think I'll check out apheleia first, and if anyone wants to pick this up they can just put up a PR using start-file-process.