-
Notifications
You must be signed in to change notification settings - Fork 22
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
Integration with pyvenv #22
Comments
Hey @immerrr All the path management in |
I don't think I can see any references between pythonic and pyvenv, could you elaborate a bit on
|
@immerrr oops, I confused it with https://github.com/proofit404/pyenv-mode Still, I'm not sure how we can leverage |
pyvenv is about activating virtualenvs and managing environment related to them. pipenv creates and manages virtualenvs for projects automatically, but for activation you only have I'm saying that when it's established that a project is pipenv-based, it's probably useful to provide convenient utilities to create & update that environment (piggybacking on the cmdline utility), and then just activating that environment via pyvenv and just letting pyvenv handle path modifications. There are a lot of subtleties in activating the settings and especially in rolling them back, it doesn't make much sense duplicating it. For example, to ensure that all syntactic constructs work fine I prefer using |
Ok. So basically replace https://github.com/pwalsh/pipenv.el/blob/master/pipenv.el#L337 with https://github.com/jorgenschaefer/pyvenv/blob/master/pyvenv.el#L158 and https://github.com/pwalsh/pipenv.el/blob/master/pipenv.el#L347 with https://github.com/jorgenschaefer/pyvenv/blob/master/pyvenv.el#L215 |
Yep, that's the easy part. The other would be to figure out a way to interact with pipfiles, or rather file- and directory-local settings. For pyvenv the majority of the use cases are easy: the user decides to what virtualenv they'd like to switch and when. However, there's this pyvenv-workon variable that could be used to switch virtualenvs automatically. I myself haven't used it though, so not sure how good it is, but given the automagical nature of pipenv that could be very relevant, too. And I can easily see this feature being annoying if not executed properly. For example, non-file-based buffers don't inherit directory local variables ( despite having |
Just to chime in here, my current work flow is to before I open any python file, M-x pyvenv-workon, this gives me a list of available virtual environments based on the WORKON_HOME environment variable. I have currently set my to /Users/username/.local/share/virtualenvs, which is where pipenv keeps is virtual environments on macos at least. I then switch to the virtualenv of interest then access my python project files. For me this is especially crucial as I have stared using the lsp-mode and lsp-python packages. It mandates that the python language server (pyls) is installed in the virtualenv before opening the first python file else it bails on you. |
Done in #48 |
There's this package
pyvenv
that is basically an Emacs alternative tovirtualenvwrapper
with itspyvenv-activate
command and its easier to usepyvenv-workon
counterpart. I wonder if there's benefit in integratingpipenv.el
withpyvenv
or even offloading the activation command completely and use a more established package to do a thing as tricky as path management.The text was updated successfully, but these errors were encountered: