-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathipython_velat
executable file
·49 lines (35 loc) · 1.14 KB
/
ipython_velat
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
45
46
47
48
#!/usr/bin/python
from os.path import abspath, basename
from sys import path, stderr, version
import sys
if __name__ != '__main__':
stderr.write("Not doing anything, %s is meant to be ran directly\n")
sys.exit(2)
try:
from IPython.frontend.terminal.embed import InteractiveShellEmbed
except ImportError:
raise ImportError('Missing Ipython >= 0.11 : pip install ipython')
ipshell = InteractiveShellEmbed()
ipshell.banner = """IPython interpreter with velat imported in it.
Python sys.version:
%s
The variable 'instance' refers to a Velat instance.
Velat is the class representing the main entry point.
The function 'load(filename) returns a velat instance from a saved instance.""" % version
localdir=abspath(basename(__file__))
if localdir not in [abspath(item) for item in path]:
path.insert(0, localdir)
#setting up useful local variables
from velat.velat import Velat
#clean up local variables that might confuse the shell user
#(keeping this in a single file script induces some pollution)
del abspath
del basename
del localdir
del path
del InteractiveShellEmbed
del stderr
del version
instance = Velat()
#fire up the shell
ipshell()