Path to yapf binary and custom yapf configuration
debuggerpk opened this issue · 3 comments
by default it looks for yapf in /usr/local/bin .. which is not the case for me.
second should look for a configuration file at the root folder .yapf or something?
I've been going back and forth on the config question; yapf itself has settled quite a bit in the last three or four months. I'm leaning toward a global default config then an optional override in each project. The trouble is that doesn't tie in very nicely with Sublime; well, only the global one does.
The yapf executable location is in the config. The default is what you would get from a global pip install. It would be better/friendlier to do a PATH search if it the provided path/filename is not there. Easy enough to add; I just don't actually need it so I haven't bothered.
Now that the change delta on yapf has slowed I ought to take a long look at how to best integrate the plugin. It mostly works as-is but there have been a lot of great yapf changes and I want to make it easy for people to take advantage of them.
Our new way of running yapf in the current document's working directory (and passing in the source code on stdin) allows yapf to pick up style configuration in the correct way ("The default is pep8 unless a .style.yapf or setup.cfg file located in one of the parent directories of the source file (or current directory for stdin)" (that is, unless explicitly overridden in the Package Settings).
Unfortunately, this triggers a unicode bug when yapf is run with Python 2, so we might need to fall back to the old behavior for a little while (see #20).
For what it's worth, I use js_prettier and love their option for per-project setup (and would be interested in using that here, so I can point at a yapf binary inside the project, instead of requiring global installs).
If you're interested in how they do it: