From a22ace8ae6607dec638556737ee67143e6f54a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20B=C4=9Blohl=C3=A1vek?= Date: Fri, 20 Jan 2017 11:05:01 +0100 Subject: [PATCH] Proper IPython regarding the activated virtualev **Current state:** a user invokes `ipython` and is provided with the IPython instance regarding the `$PATH`. **Proposed state:** a user invokes `ipython` (which is a new alias in the *python plugin*) and is provided with the proper IPython instance regarding the currently activated virtualenv. **Example:** the user's default Python is 2.7 with installed IPython 2.7. User activates Python 3.5 virtualenv where he installs IPython 3.5. After activating the environment, one expects `ipython` to run the version of 3.5, which does not happen by default. Instead, IPython 2.7 is used, which in counter-intuitive and often causes problem. This PR solves this problem. --- plugins/python/python.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh index a10c06fd..291118c3 100644 --- a/plugins/python/python.plugin.zsh +++ b/plugins/python/python.plugin.zsh @@ -12,3 +12,5 @@ function pyclean() { # Grep among .py files alias pygrep='grep --include="*.py"' +# Run proper IPython regarding current virtualenv (if any) +alias ipython="python -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'"