Show More
@@ -1,73 +1,76 b'' | |||||
1 | import IPython.ipapi |
|
1 | import IPython.ipapi | |
2 | ip = IPython.ipapi.get() |
|
2 | ip = IPython.ipapi.get() | |
3 |
|
3 | |||
4 | import os,pprint |
|
4 | import os,pprint | |
5 |
|
5 | |||
6 | def export(filename = None): |
|
6 | def export(filename = None): | |
7 |
|
7 | |||
8 | lines = ['import IPython.ipapi', 'ip = IPython.ipapi.get()',''] |
|
8 | lines = ['import IPython.ipapi', 'ip = IPython.ipapi.get()',''] | |
9 |
|
9 | |||
10 | vars = ip.db.keys('autorestore/*') |
|
10 | vars = ip.db.keys('autorestore/*') | |
11 | vars.sort() |
|
11 | vars.sort() | |
12 | varstomove = [] |
|
12 | varstomove = [] | |
13 | get = ip.db.get |
|
13 | get = ip.db.get | |
14 |
|
14 | |||
15 | macros = [] |
|
15 | macros = [] | |
16 | variables = [] |
|
16 | variables = [] | |
17 |
|
17 | |||
18 | for var in vars: |
|
18 | for var in vars: | |
19 | k = os.path.basename(var) |
|
19 | k = os.path.basename(var) | |
20 | v = get(var) |
|
20 | v = get(var) | |
21 |
|
21 | |||
22 | if k.startswith('_'): |
|
22 | if k.startswith('_'): | |
23 | continue |
|
23 | continue | |
24 | if isinstance(v, IPython.macro.Macro): |
|
24 | if isinstance(v, IPython.macro.Macro): | |
25 | macros.append((k,v)) |
|
25 | macros.append((k,v)) | |
26 | if type(v) in [int, str, float]: |
|
26 | if type(v) in [int, str, float]: | |
27 | variables.append((k,v)) |
|
27 | variables.append((k,v)) | |
28 |
|
28 | |||
29 |
|
29 | |||
30 |
|
30 | |||
31 | if macros: |
|
31 | if macros: | |
32 | lines.extend(['# === Macros ===' ,'']) |
|
32 | lines.extend(['# === Macros ===' ,'']) | |
33 | for k,v in macros: |
|
33 | for k,v in macros: | |
34 | lines.append("ip.defmacro('%s'," % k) |
|
34 | lines.append("ip.defmacro('%s'," % k) | |
35 | for line in v.value.splitlines(): |
|
35 | for line in v.value.splitlines(): | |
36 | lines.append(' ' + repr(line+'\n')) |
|
36 | lines.append(' ' + repr(line+'\n')) | |
37 | lines.extend([')', '']) |
|
37 | lines.extend([')', '']) | |
38 |
|
38 | |||
39 | if variables: |
|
39 | if variables: | |
40 | lines.extend(['','# === Variables ===','']) |
|
40 | lines.extend(['','# === Variables ===','']) | |
41 | for k,v in variables: |
|
41 | for k,v in variables: | |
42 | varstomove.append(k) |
|
42 | varstomove.append(k) | |
43 | lines.append('%s = %s' % (k,repr(v))) |
|
43 | lines.append('%s = %s' % (k,repr(v))) | |
44 |
|
44 | |||
45 | lines.append('ip.to_user_ns("%s")' % (' '.join(varstomove))) |
|
45 | lines.append('ip.to_user_ns("%s")' % (' '.join(varstomove))) | |
46 |
|
46 | |||
47 | bkms = ip.db.get('bookmarks',{}) |
|
47 | bkms = ip.db.get('bookmarks',{}) | |
48 |
|
48 | |||
49 | if bkms: |
|
49 | if bkms: | |
50 | lines.extend(['','# === Bookmarks ===','']) |
|
50 | lines.extend(['','# === Bookmarks ===','']) | |
51 | lines.append("ip.db['bookmarks'] = %s " % pprint.pformat(bkms, indent = 2) ) |
|
51 | lines.append("ip.db['bookmarks'] = %s " % pprint.pformat(bkms, indent = 2) ) | |
52 |
|
52 | |||
53 | aliases = ip.db.get('stored_aliases', {} ) |
|
53 | aliases = ip.db.get('stored_aliases', {} ) | |
54 |
|
54 | |||
55 | if aliases: |
|
55 | if aliases: | |
56 | lines.extend(['','# === Alias definitions ===','']) |
|
56 | lines.extend(['','# === Alias definitions ===','']) | |
57 | for k,v in aliases.items(): |
|
57 | for k,v in aliases.items(): | |
58 | lines.append("ip.defalias('%s', %s)" % (k, repr(v[1]))) |
|
58 | try: | |
|
59 | lines.append("ip.defalias('%s', %s)" % (k, repr(v[1]))) | |||
|
60 | except (AttributeError, TypeError): | |||
|
61 | pass | |||
59 |
|
62 | |||
60 | env = ip.db.get('stored_env') |
|
63 | env = ip.db.get('stored_env') | |
61 | if env: |
|
64 | if env: | |
62 | lines.extend(['','# === Stored env vars ===','']) |
|
65 | lines.extend(['','# === Stored env vars ===','']) | |
63 | lines.append("ip.db['stored_env'] = %s " % pprint.pformat(env, indent = 2) ) |
|
66 | lines.append("ip.db['stored_env'] = %s " % pprint.pformat(env, indent = 2) ) | |
64 |
|
67 | |||
65 |
|
68 | |||
66 |
|
69 | |||
67 | out = '\n'.join(lines) |
|
70 | out = '\n'.join(lines) | |
68 |
|
71 | |||
69 | if filename: |
|
72 | if filename: | |
70 | open(filename,'w').write(out) |
|
73 | open(filename,'w').write(out) | |
71 | else: |
|
74 | else: | |
72 | print out |
|
75 | print out | |
73 |
|
76 |
@@ -1,83 +1,83 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """Release data for the IPython project. |
|
2 | """Release data for the IPython project. | |
3 |
|
3 | |||
4 |
$Id: Release.py 26 |
|
4 | $Id: Release.py 2681 2007-08-28 17:51:38Z vivainio $""" | |
5 |
|
5 | |||
6 | #***************************************************************************** |
|
6 | #***************************************************************************** | |
7 | # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu> |
|
7 | # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu> | |
8 | # |
|
8 | # | |
9 | # Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and Nathaniel Gray |
|
9 | # Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and Nathaniel Gray | |
10 | # <n8gray@caltech.edu> |
|
10 | # <n8gray@caltech.edu> | |
11 | # |
|
11 | # | |
12 | # Distributed under the terms of the BSD License. The full license is in |
|
12 | # Distributed under the terms of the BSD License. The full license is in | |
13 | # the file COPYING, distributed as part of this software. |
|
13 | # the file COPYING, distributed as part of this software. | |
14 | #***************************************************************************** |
|
14 | #***************************************************************************** | |
15 |
|
15 | |||
16 | # Name of the package for release purposes. This is the name which labels |
|
16 | # Name of the package for release purposes. This is the name which labels | |
17 | # the tarballs and RPMs made by distutils, so it's best to lowercase it. |
|
17 | # the tarballs and RPMs made by distutils, so it's best to lowercase it. | |
18 | name = 'ipython' |
|
18 | name = 'ipython' | |
19 |
|
19 | |||
20 | # For versions with substrings (like 0.6.16.svn), use an extra . to separate |
|
20 | # For versions with substrings (like 0.6.16.svn), use an extra . to separate | |
21 | # the new substring. We have to avoid using either dashes or underscores, |
|
21 | # the new substring. We have to avoid using either dashes or underscores, | |
22 | # because bdist_rpm does not accept dashes (an RPM) convention, and |
|
22 | # because bdist_rpm does not accept dashes (an RPM) convention, and | |
23 | # bdist_deb does not accept underscores (a Debian convention). |
|
23 | # bdist_deb does not accept underscores (a Debian convention). | |
24 |
|
24 | |||
25 |
revision = '26 |
|
25 | revision = '2680M' | |
26 |
|
26 | |||
27 | version = '0.8.2.svn.r' + revision.rstrip('M') |
|
27 | version = '0.8.2.svn.r' + revision.rstrip('M') | |
28 |
|
28 | |||
29 | description = "An enhanced interactive Python shell." |
|
29 | description = "An enhanced interactive Python shell." | |
30 |
|
30 | |||
31 | long_description = \ |
|
31 | long_description = \ | |
32 | """ |
|
32 | """ | |
33 | IPython provides a replacement for the interactive Python interpreter with |
|
33 | IPython provides a replacement for the interactive Python interpreter with | |
34 | extra functionality. |
|
34 | extra functionality. | |
35 |
|
35 | |||
36 | Main features: |
|
36 | Main features: | |
37 |
|
37 | |||
38 | * Comprehensive object introspection. |
|
38 | * Comprehensive object introspection. | |
39 |
|
39 | |||
40 | * Input history, persistent across sessions. |
|
40 | * Input history, persistent across sessions. | |
41 |
|
41 | |||
42 | * Caching of output results during a session with automatically generated |
|
42 | * Caching of output results during a session with automatically generated | |
43 | references. |
|
43 | references. | |
44 |
|
44 | |||
45 | * Readline based name completion. |
|
45 | * Readline based name completion. | |
46 |
|
46 | |||
47 | * Extensible system of 'magic' commands for controlling the environment and |
|
47 | * Extensible system of 'magic' commands for controlling the environment and | |
48 | performing many tasks related either to IPython or the operating system. |
|
48 | performing many tasks related either to IPython or the operating system. | |
49 |
|
49 | |||
50 | * Configuration system with easy switching between different setups (simpler |
|
50 | * Configuration system with easy switching between different setups (simpler | |
51 | than changing $PYTHONSTARTUP environment variables every time). |
|
51 | than changing $PYTHONSTARTUP environment variables every time). | |
52 |
|
52 | |||
53 | * Session logging and reloading. |
|
53 | * Session logging and reloading. | |
54 |
|
54 | |||
55 | * Extensible syntax processing for special purpose situations. |
|
55 | * Extensible syntax processing for special purpose situations. | |
56 |
|
56 | |||
57 | * Access to the system shell with user-extensible alias system. |
|
57 | * Access to the system shell with user-extensible alias system. | |
58 |
|
58 | |||
59 | * Easily embeddable in other Python programs. |
|
59 | * Easily embeddable in other Python programs. | |
60 |
|
60 | |||
61 | * Integrated access to the pdb debugger and the Python profiler. |
|
61 | * Integrated access to the pdb debugger and the Python profiler. | |
62 |
|
62 | |||
63 | The latest development version is always available at the IPython subversion |
|
63 | The latest development version is always available at the IPython subversion | |
64 | repository_. |
|
64 | repository_. | |
65 |
|
65 | |||
66 | .. _repository: http://ipython.scipy.org/svn/ipython/ipython/trunk#egg=ipython-dev |
|
66 | .. _repository: http://ipython.scipy.org/svn/ipython/ipython/trunk#egg=ipython-dev | |
67 | """ |
|
67 | """ | |
68 |
|
68 | |||
69 | license = 'BSD' |
|
69 | license = 'BSD' | |
70 |
|
70 | |||
71 | authors = {'Fernando' : ('Fernando Perez','fperez@colorado.edu'), |
|
71 | authors = {'Fernando' : ('Fernando Perez','fperez@colorado.edu'), | |
72 | 'Janko' : ('Janko Hauser','jhauser@zscout.de'), |
|
72 | 'Janko' : ('Janko Hauser','jhauser@zscout.de'), | |
73 | 'Nathan' : ('Nathaniel Gray','n8gray@caltech.edu'), |
|
73 | 'Nathan' : ('Nathaniel Gray','n8gray@caltech.edu'), | |
74 | 'Ville' : ('Ville Vainio','vivainio@gmail.com') |
|
74 | 'Ville' : ('Ville Vainio','vivainio@gmail.com') | |
75 | } |
|
75 | } | |
76 |
|
76 | |||
77 | url = 'http://ipython.scipy.org' |
|
77 | url = 'http://ipython.scipy.org' | |
78 |
|
78 | |||
79 | download_url = 'http://ipython.scipy.org/dist' |
|
79 | download_url = 'http://ipython.scipy.org/dist' | |
80 |
|
80 | |||
81 | platforms = ['Linux','Mac OSX','Windows XP/2000/NT','Windows 95/98/ME'] |
|
81 | platforms = ['Linux','Mac OSX','Windows XP/2000/NT','Windows 95/98/ME'] | |
82 |
|
82 | |||
83 | keywords = ['Interactive','Interpreter','Shell'] |
|
83 | keywords = ['Interactive','Interpreter','Shell'] |
General Comments 0
You need to be logged in to leave comments.
Login now