Show More
@@ -0,0 +1,8 b'' | |||
|
1 | New setting to silence warning if working inside a virtual environment | |
|
2 | ====================================================================== | |
|
3 | ||
|
4 | Previously, when starting IPython in a virtual environment without IPython installed (so IPython from the global environment is used), the following warning was printed: | |
|
5 | ||
|
6 | Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv. | |
|
7 | ||
|
8 | This warning can be permanently silenced by setting ``c.InteractiveShell.warn_venv`` to ``False`` (the default is ``True``). |
@@ -479,6 +479,11 b' class InteractiveShell(SingletonConfigurable):' | |||
|
479 | 479 | """ |
|
480 | 480 | ).tag(config=True) |
|
481 | 481 | |
|
482 | warn_venv = Bool( | |
|
483 | True, | |
|
484 | help="Warn if running in a virtual environment with no IPython installed (so IPython from the global environment is used).", | |
|
485 | ).tag(config=True) | |
|
486 | ||
|
482 | 487 | # TODO: this part of prompt management should be moved to the frontends. |
|
483 | 488 | # Use custom TraitTypes that convert '0'->'' and '\\n'->'\n' |
|
484 | 489 | separate_in = SeparateUnicode('\n').tag(config=True) |
@@ -847,11 +852,11 b' class InteractiveShell(SingletonConfigurable):' | |||
|
847 | 852 | p_ver = re_m.groups() |
|
848 | 853 | |
|
849 | 854 | virtual_env = str(virtual_env_path).format(*p_ver) |
|
850 | ||
|
851 | warn( | |
|
852 | "Attempting to work in a virtualenv. If you encounter problems, " | |
|
853 | "please install IPython inside the virtualenv." | |
|
854 | ) | |
|
855 | if self.warn_venv: | |
|
856 | warn( | |
|
857 | "Attempting to work in a virtualenv. If you encounter problems, " | |
|
858 | "please install IPython inside the virtualenv." | |
|
859 | ) | |
|
855 | 860 | import site |
|
856 | 861 | sys.path.insert(0, virtual_env) |
|
857 | 862 | site.addsitedir(virtual_env) |
General Comments 0
You need to be logged in to leave comments.
Login now