forked from piranha/conf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathipython_config.py
More file actions
44 lines (32 loc) · 1.21 KB
/
ipython_config.py
File metadata and controls
44 lines (32 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import site
import sys
from os import environ
from os.path import join
import IPython
from IPython.terminal.prompts import ClassicPrompts
c = get_config()
c.TerminalInteractiveShell.prompts_class = ClassicPrompts
c.TerminalInteractiveShell.autocall = 1
c.TerminalInteractiveShell.confirm_exit = False
c.TerminalInteractiveShell.automagic = False
c.InteractiveShellApp.extensions = ['autoreload']
c.InteractiveShellApp.exec_lines = ['%autoreload 1']
c.TerminalInteractiveShell.banner1 = "Py %s IPy %s\n" % (
sys.version.split('\n', 1)[0], IPython.__version__)
# virtualenv support
if 'VIRTUAL_ENV' in environ:
virtual_env = join(environ.get('VIRTUAL_ENV'),
'lib',
'python%d.%d' % sys.version_info[:2],
'site-packages')
# Remember original sys.path.
prev_sys_path = list(sys.path)
site.addsitedir(virtual_env)
# Reorder sys.path so new directories at the front.
new_sys_path = []
for item in list(sys.path):
if item not in prev_sys_path:
new_sys_path.append(item)
sys.path.remove(item)
sys.path[1:1] = new_sys_path
c.TerminalInteractiveShell.banner1 += 'virtualenv -> %s\n' % virtual_env