pyvenv icon indicating copy to clipboard operation
pyvenv copied to clipboard

call add2virtualenv as hook after pyvenv-workon

Open grafoo opened this issue 7 years ago • 3 comments

is there a way to do a similar thing like pyvenv-run-virtualenvwrapper-hook does but with a custom file? what i'd like to achieve is that all elpy dependencies like e.g. jedi are installed into a virtualenv and this one gets added to whatever virtualenv i'm currently working on (with e.g. add2virtualenv), but only in emacs. this way i could avoid adding a global post_activate hook to virtualenvwrapper.

cheers, grafoo

grafoo avatar May 13 '18 15:05 grafoo

You can use pyvenv-post-activate-hooks to run a custom function after activation, and run whatever code you like there. I'm not sure if that solves your problem?

jorgenschaefer avatar May 18 '18 16:05 jorgenschaefer

yes, pyvenv-post-activate-hooks is the right place to store the function but i had a look at the add2virtualenv implementation and it actually doesn't provide the functionality i'd like to achieve.

after calling pyvenv-workon i'd like to modify sys.path of the python interpreter elpy is communicating with and insert the site-packages directory of the dedicated - different virtualenv pyvenv-workon was called with - where only elpy dependencies are installed.

i guess this isn't related to pyvenv after all, but can you give me a pointer on what function i need to call from elpy to modify the interpreters path?

grafoo avatar Jun 17 '18 21:06 grafoo

Does python-shell-send-string-no-output do what you want?

jorgenschaefer avatar Jun 29 '18 10:06 jorgenschaefer