Open PythonNut opened 8 years ago
Hey @PythonNut, this sounds like a great idea for which we also have, I believe, a more complex implementation of in the anaconda-mode as you linked to in your initial issue description.
I for one (being an Elpy user) feel like the process of installing dependencies in each project is tedious and I would rather have this automated in the first place than doing it manually every time (though I may be missing something trivial -- do let me know if I'm doing this wrong 🐍)
I believe you want a similar function to the one your linked to that will install dependencies only after validating if they are already installed and perhaps up to date as it will behaves as a hook and possibly loaded and so executed upon loading python-mode.
(defvar py-yapf-mode-install-yapf-script "
import sys
import pip
directory = sys.argv[-2]
version = sys.argv[-1]
pip.main(['install', '-t', directory, 'yapf==' + version])
" "Install `yapf'.")
In general, it would be really cool if
py-yapf
could installyapf
automatically on demand.We could limit the side-effects of this operations by executing it in a virtual environment. This is a common strategy for packages like
jedi
,anaconda-mode
and others. See the wayanaconda-mode
does it here.