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

Pipenv shell support #1035

Open
alper opened this issue May 18, 2020 · 3 comments
Open

Pipenv shell support #1035

alper opened this issue May 18, 2020 · 3 comments

Comments

@alper
Copy link

alper commented May 18, 2020

I tried out Elvish and it immediately broke when I did pipenv shell. See also this ticket over at pipenv: pypa/pipenv#4198

I'm not too clear about the intricacies of this and which side needs to change what to make this work but I thought it would be good to have a tracking ticket on this side.

@iwoloschin
Copy link
Contributor

I suspect this is related to #974, and even if it is not, we should probably link the two issues into a larger "Python Support" issue.

@xiaq I think it might be best if you give some guidance here (or in #974). I'm willing to try and implement something, either as a built-in or as a separate module, but I don't want to go make something that is counter to how you think Elvish should handle python support.

@alper I don't use pipenv, but I do use poetry. I happen to have a slightly weird usage pattern that relies on existing virtual environments, so I don't use the equivalent poetry shell command. However, when I just tried it out I see it fails. I'm not familiar with poetry internals here, but a quick glance does show some special handlers for fish and csh so I assume pipenv has something similar?

As a quick workaround I suspect you can make your own virtual environment and activate it using my python module. Again, I don't use pipenv so I'm not entirely sure if it'll work with my module, but I suspect it'll be fine.

@krader1961
Copy link
Contributor

krader1961 commented May 20, 2020

I've been a Python user, and fan, for thirteen years. I've used a couple of python virtual environment managers. I currently prefer Anaconda. I've never heard of either "pipenv" or "poetry". The problem in pypa/pipenv#4198 is that elvish does not have a -i flag to force "interactive" mode and pipenv assumes the shell does support that flag. That is not something Elvish can solve, in general, since it is not a POSIX 1003.2 compatible shell.

It is impossible for Elvish to work with all of the (not just Python) virtual environment managers without being a POSIX 1003.2 compatible shell. And that, by definition, will never happen since Elvish is explicitly not POSIX 1003.2 compatible.

The only solution here is

a) adding special-case support to those virtual environment managers for elvish, similar to what has been done for other non-traditional shells like fish, or

b) bundling equivalent mechanisms with elvish.

Option (a) is preferable but requires someone who cares about a specific virtual environment manager to create, and lobby to get merged, an appropriate change to that project.

@iwoloschin
Copy link
Contributor

I suspect for Python in general, the best thing would be for Elvish to gain built-in support for "activating" and "deactivating" Python virtual environments. As far as I know all Python project managers use the same underlying virtual environment practices, so this would allow Elvish users to be productive in Python, even if they have to jump through a few extra hoops compared to POSIX compatible shell users. I already have some code that does basically this (it makes some assumptions based on my personal workflow, but this could be changed).

As far as fixing specific tools, such as pipenv or poetry or conda there are two options I can think of, I'm sure there are more but I've only had one cup of coffee so far today.

  1. Give Elvish a new -i flag. This is really, really, really incredibly silly since it wouldn't do anything, but maybe it's silly enough to "just work". I reserve the right to mercilessly mock this idea after another cup of coffee.
  2. Provide some general documentation on best practices for starting a new Elvish shell from a 3rd party tool. Do not focus just on Python project managers, but anything that could require starting a brand new Elvish process.

@xiaq xiaq moved this to Todo in All Elvish issues Feb 25, 2022
@xiaq xiaq moved this from ❓Triage to 🧭Recon in All Elvish issues Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🧭Recon
Development

No branches or pull requests

3 participants