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

Add way to force a particular environment shell #968

Closed
ghost opened this issue Oct 24, 2017 · 5 comments
Closed

Add way to force a particular environment shell #968

ghost opened this issue Oct 24, 2017 · 5 comments
Labels
OS: Linux This issue affects the Linux Operating System. Type: Discussion This issue is open for discussion. Type: Enhancement 💡 This is a feature or enhancement request.

Comments

@ghost
Copy link

ghost commented Oct 24, 2017

Arch recommends users to keep a bash-compatible shell as default [0]. I'm using the method of execing fish from my .bashrc.

pipenv fails on pipenv shell, apparently because it thinks that the bash activate should be executed

Spawning environment shell (/bin/bash). Use 'exit' to leave.
~/s/tmp  source /home/me/.local/share/virtualenvs/tmp-yq4UYSVl/bin/activate
~/.local/share/virtualenvs/tmp-yq4UYSVl/bin/activate (line 23): Unsupported use of '||'. In fish, please use 'COMMAND; or COMMAND'.
    if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
                          ^
from sourcing file ~/.local/share/virtualenvs/tmp-yq4UYSVl/bin/activate
	called on standard input

source: Error while reading file “/home/me/.local/share/virtualenvs/tmp-yq4UYSVl/bin/activate”

If I replace activate with activate.fish, the pipenv works as expected.

Could there be a flag or, even better yet, a config option to force the default environment shell?

[0] https://wiki.archlinux.org/index.php/Fish#Not_setting_fish_as_default_shell

Describe you environment
  1. OS Type
    Linux tp 4.13.7-1-ARCH Feature Request - manage dependencies #1 SMP PREEMPT Sat Oct 14 20:13:26 CEST 2017 x86_64 GNU/Linux
  2. Python version: $ python -V
    Python 3.6.2
  3. Pipenv version: $ pipenv --version
    pipenv, version 8.2.7
@erinxocon
Copy link
Contributor

Huh, maybe an environment variable? @kennethreitz @nateprewitt or @techalchemy any thoughts?

@erinxocon erinxocon added Type: Discussion This issue is open for discussion. Type: Enhancement 💡 This is a feature or enhancement request. OS: Linux This issue affects the Linux Operating System. labels Oct 24, 2017
@techalchemy
Copy link
Member

@kehugter in compat mode your shell is determined by the SHELL environment variable, so you can just export $SHELL in your .bashrc or run the subshell with SHELL=/usr/bin/fish pipenv shell and it should work. Let me know if this helps

@erinxocon
Copy link
Contributor

@techalchemy I completely forgot about that, been working on windows too long.....

@ghost
Copy link
Author

ghost commented Oct 25, 2017

@techalchemy

export $SHELL in your .bashrc

thanks, that works.

If I understand it correctly, this approach is fine on a local machine but would break the $SHELL env var that Arch expects in remote non-login non-interactive shells:

https://blog.flowblok.id.au/static/images/shell-startup-actual.png

An edge case perhaps worth considering and documenting.

@techalchemy
Copy link
Member

Yes, as with all shell configurations you should include interactive settings in interactive shells only. That information is mentioned in the docs in the context of fish, but as a user who is concerned about edge cases of people trying to run an interactive pipenv shell on a non interactive shell, well that use case isn’t possible so you shouldn’t change the variable. If you want to be safe however you can follow the bash instructions about testing for interactivity before setting the value: see here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS: Linux This issue affects the Linux Operating System. Type: Discussion This issue is open for discussion. Type: Enhancement 💡 This is a feature or enhancement request.
Projects
None yet
Development

No branches or pull requests

2 participants