Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blacken not finding pyproject.toml over TRAMP #51

Open
gsingh93 opened this issue Aug 30, 2022 · 4 comments
Open

Blacken not finding pyproject.toml over TRAMP #51

gsingh93 opened this issue Aug 30, 2022 · 4 comments

Comments

@gsingh93
Copy link

gsingh93 commented Aug 30, 2022

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.

@dakra
Copy link
Member

dakra commented Aug 30, 2022

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.

@gsingh93
Copy link
Author

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.

@dakra
Copy link
Member

dakra commented Aug 30, 2022

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

@gsingh93
Copy link
Author

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.

@gsingh93 gsingh93 changed the title Blacken not respecting pyproject.toml line length setting Blacken not finding pyproject.toml over TRAMP Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants