Show More
@@ -6,10 +6,14 b' IPython.' | |||||
6 | IPython is a set of tools for interactive and exploratory computing in Python. |
|
6 | IPython is a set of tools for interactive and exploratory computing in Python. | |
7 | """ |
|
7 | """ | |
8 | #----------------------------------------------------------------------------- |
|
8 | #----------------------------------------------------------------------------- | |
9 |
# Copyright ( |
|
9 | # Copyright (c) 2008-2010, IPython Development Team. | |
|
10 | # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu> | |||
|
11 | # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de> | |||
|
12 | # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu> | |||
10 | # |
|
13 | # | |
11 |
# Distributed under the terms of the BSD License. |
|
14 | # Distributed under the terms of the Modified BSD License. | |
12 | # the file COPYING, distributed as part of this software. |
|
15 | # | |
|
16 | # The full license is in the file COPYING.txt, distributed with this software. | |||
13 | #----------------------------------------------------------------------------- |
|
17 | #----------------------------------------------------------------------------- | |
14 |
|
18 | |||
15 | #----------------------------------------------------------------------------- |
|
19 | #----------------------------------------------------------------------------- | |
@@ -45,6 +49,7 b' from .frontend.terminal.embed import embed' | |||||
45 | from .core.error import TryNext |
|
49 | from .core.error import TryNext | |
46 | from .core.interactiveshell import InteractiveShell |
|
50 | from .core.interactiveshell import InteractiveShell | |
47 | from .testing import test |
|
51 | from .testing import test | |
|
52 | from .utils.sysinfo import sys_info | |||
48 |
|
53 | |||
49 | # Release data |
|
54 | # Release data | |
50 | __author__ = '' |
|
55 | __author__ = '' | |
@@ -52,4 +57,3 b' for author, email in release.authors.itervalues():' | |||||
52 | __author__ += author + ' <' + email + '>\n' |
|
57 | __author__ += author + ' <' + email + '>\n' | |
53 | __license__ = release.license |
|
58 | __license__ = release.license | |
54 | __version__ = release.version |
|
59 | __version__ = release.version | |
55 | __revision__ = release.revision |
|
@@ -1,39 +1,40 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 | #***************************************************************************** |
|
4 | #----------------------------------------------------------------------------- | |
5 |
# |
|
5 | # Copyright (c) 2008-2010, IPython Development Team. | |
6 |
# |
|
6 | # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu> | |
7 |
# |
|
7 | # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de> | |
8 | # <n8gray@caltech.edu> |
|
8 | # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu> | |
9 | # |
|
9 | # | |
10 |
# Distributed under the terms of the BSD License. |
|
10 | # Distributed under the terms of the Modified BSD License. | |
11 | # the file COPYING, distributed as part of this software. |
|
11 | # | |
12 | #***************************************************************************** |
|
12 | # The full license is in the file COPYING.txt, distributed with this software. | |
|
13 | #----------------------------------------------------------------------------- | |||
13 |
|
14 | |||
14 | # Name of the package for release purposes. This is the name which labels |
|
15 | # Name of the package for release purposes. This is the name which labels | |
15 | # the tarballs and RPMs made by distutils, so it's best to lowercase it. |
|
16 | # the tarballs and RPMs made by distutils, so it's best to lowercase it. | |
16 | name = 'ipython' |
|
17 | name = 'ipython' | |
17 |
|
18 | |||
18 | # For versions with substrings (like 0.6.16.svn), use an extra . to separate |
|
19 | # IPython version information. An empty _version_extra corresponds to a full | |
19 | # the new substring. We have to avoid using either dashes or underscores, |
|
20 | # release. 'dev' as a _version_extra string means this is a development | |
20 | # because bdist_rpm does not accept dashes (an RPM) convention, and |
|
21 | # version | |
21 | # bdist_deb does not accept underscores (a Debian convention). |
|
22 | _version_major = 0 | |
|
23 | _version_minor = 11 | |||
|
24 | _version_micro = '' # use '' for first of series, number for 1 and above | |||
|
25 | _version_extra = 'dev' | |||
|
26 | #_version_extra = '' # Uncomment this for full releases | |||
22 |
|
27 | |||
23 | development = True # change this to False to do a release |
|
28 | # Construct full version string from these. | |
24 | version_base = '0.11.alpha1' |
|
29 | _ver = [_version_major, _version_minor] | |
25 | branch = 'ipython' |
|
30 | if _version_micro: | |
26 | # This needs to be updated to something that is meaningful for git |
|
31 | _ver.append(_version_micro) | |
27 | revision = '0' |
|
32 | if _version_extra: | |
|
33 | _ver.append(_version_extra) | |||
28 |
|
34 | |||
29 | if development: |
|
35 | __version__ = '.'.join(map(str, _ver)) | |
30 | if branch == 'ipython': |
|
|||
31 | version = '%s.git' % (version_base) |
|
|||
32 | else: |
|
|||
33 | version = '%s.git.%s' % (version_base, branch) |
|
|||
34 | else: |
|
|||
35 | version = version_base |
|
|||
36 |
|
36 | |||
|
37 | version = __version__ # backwards compatibility name | |||
37 |
|
38 | |||
38 | description = "An interactive computing environment for Python" |
|
39 | description = "An interactive computing environment for Python" | |
39 |
|
40 | |||
@@ -95,8 +96,8 b' The parallel computing architecture has the following main features:' | |||||
95 |
|
96 | |||
96 | * Robust error handling in parallel code. |
|
97 | * Robust error handling in parallel code. | |
97 |
|
98 | |||
98 |
The latest development version is always available from IPython's ` |
|
99 | The latest development version is always available from IPython's `GitHub | |
99 |
site <http:// |
|
100 | site <http://github.com/ipython>`_. | |
100 | """ |
|
101 | """ | |
101 |
|
102 | |||
102 | license = 'BSD' |
|
103 | license = 'BSD' |
@@ -115,7 +115,7 b" have['gobject'] = test_for('gobject')" | |||||
115 | def report(): |
|
115 | def report(): | |
116 | """Return a string with a summary report of test-related variables.""" |
|
116 | """Return a string with a summary report of test-related variables.""" | |
117 |
|
117 | |||
118 | out = [ sys_info() ] |
|
118 | out = [ sys_info(), '\n'] | |
119 |
|
119 | |||
120 | avail = [] |
|
120 | avail = [] | |
121 | not_avail = [] |
|
121 | not_avail = [] |
@@ -1,6 +1,6 b'' | |||||
1 | # encoding: utf-8 |
|
1 | # encoding: utf-8 | |
2 | """ |
|
2 | """ | |
3 | Utilities for getting information about a system. |
|
3 | Utilities for getting information about IPython and the system it's running in. | |
4 | """ |
|
4 | """ | |
5 |
|
5 | |||
6 | #----------------------------------------------------------------------------- |
|
6 | #----------------------------------------------------------------------------- | |
@@ -16,37 +16,122 b' Utilities for getting information about a system.' | |||||
16 |
|
16 | |||
17 | import os |
|
17 | import os | |
18 | import platform |
|
18 | import platform | |
|
19 | import pprint | |||
19 | import sys |
|
20 | import sys | |
20 | import subprocess |
|
21 | import subprocess | |
21 |
|
22 | |||
|
23 | from ConfigParser import ConfigParser | |||
|
24 | ||||
22 | from IPython.core import release |
|
25 | from IPython.core import release | |
23 |
|
26 | |||
24 | #----------------------------------------------------------------------------- |
|
27 | #----------------------------------------------------------------------------- | |
|
28 | # Globals | |||
|
29 | #----------------------------------------------------------------------------- | |||
|
30 | COMMIT_INFO_FNAME = '.git_commit_info.ini' | |||
|
31 | ||||
|
32 | #----------------------------------------------------------------------------- | |||
25 | # Code |
|
33 | # Code | |
26 | #----------------------------------------------------------------------------- |
|
34 | #----------------------------------------------------------------------------- | |
27 |
|
35 | |||
|
36 | def pkg_commit_hash(pkg_path): | |||
|
37 | """Get short form of commit hash given directory `pkg_path` | |||
|
38 | ||||
|
39 | There should be a file called 'COMMIT_INFO.txt' in `pkg_path`. This is a | |||
|
40 | file in INI file format, with at least one section: ``commit hash``, and two | |||
|
41 | variables ``archive_subst_hash`` and ``install_hash``. The first has a | |||
|
42 | substitution pattern in it which may have been filled by the execution of | |||
|
43 | ``git archive`` if this is an archive generated that way. The second is | |||
|
44 | filled in by the installation, if the installation is from a git archive. | |||
|
45 | ||||
|
46 | We get the commit hash from (in order of preference): | |||
|
47 | ||||
|
48 | * A substituted value in ``archive_subst_hash`` | |||
|
49 | * A written commit hash value in ``install_hash` | |||
|
50 | * git output, if we are in a git repository | |||
|
51 | ||||
|
52 | If all these fail, we return a not-found placeholder tuple | |||
|
53 | ||||
|
54 | Parameters | |||
|
55 | ---------- | |||
|
56 | pkg_path : str | |||
|
57 | directory containing package | |||
|
58 | ||||
|
59 | Returns | |||
|
60 | ------- | |||
|
61 | hash_from : str | |||
|
62 | Where we got the hash from - description | |||
|
63 | hash_str : str | |||
|
64 | short form of hash | |||
|
65 | """ | |||
|
66 | # Try and get commit from written commit text file | |||
|
67 | pth = os.path.join(pkg_path, COMMIT_INFO_FNAME) | |||
|
68 | if not os.path.isfile(pth): | |||
|
69 | raise IOError('Missing commit info file %s' % pth) | |||
|
70 | cfg_parser = ConfigParser() | |||
|
71 | cfg_parser.read(pth) | |||
|
72 | archive_subst = cfg_parser.get('commit hash', 'archive_subst_hash') | |||
|
73 | if not archive_subst.startswith('$Format'): # it has been substituted | |||
|
74 | return 'archive substitution', archive_subst | |||
|
75 | install_subst = cfg_parser.get('commit hash', 'install_hash') | |||
|
76 | if install_subst != '': | |||
|
77 | return 'installation', install_subst | |||
|
78 | # maybe we are in a repository | |||
|
79 | proc = subprocess.Popen('git rev-parse --short HEAD', | |||
|
80 | stdout=subprocess.PIPE, | |||
|
81 | stderr=subprocess.PIPE, | |||
|
82 | cwd=pkg_path, shell=True) | |||
|
83 | repo_commit, _ = proc.communicate() | |||
|
84 | if repo_commit: | |||
|
85 | return 'repository', repo_commit.strip() | |||
|
86 | return '(none found)', '<not found>' | |||
|
87 | ||||
|
88 | ||||
|
89 | def pkg_info(pkg_path): | |||
|
90 | """Return dict describing the context of this package | |||
|
91 | ||||
|
92 | Parameters | |||
|
93 | ---------- | |||
|
94 | pkg_path : str | |||
|
95 | path containing __init__.py for package | |||
|
96 | ||||
|
97 | Returns | |||
|
98 | ------- | |||
|
99 | context : dict | |||
|
100 | with named parameters of interest | |||
|
101 | """ | |||
|
102 | src, hsh = pkg_commit_hash(pkg_path) | |||
|
103 | return dict( | |||
|
104 | ipython_version=release.version, | |||
|
105 | ipython_path=pkg_path, | |||
|
106 | commit_source=src, | |||
|
107 | commit_hash=hsh, | |||
|
108 | sys_version=sys.version, | |||
|
109 | sys_executable=sys.executable, | |||
|
110 | sys_platform=sys.platform, | |||
|
111 | platform=platform.platform(), | |||
|
112 | os_name=os.name, | |||
|
113 | ) | |||
|
114 | ||||
|
115 | ||||
28 | def sys_info(): |
|
116 | def sys_info(): | |
29 | """Return useful information about IPython and the system, as a string. |
|
117 | """Return useful information about IPython and the system, as a string. | |
30 |
|
118 | |||
31 |
Example |
|
119 | Example | |
32 |
------- |
|
120 | ------- | |
33 |
In [ |
|
121 | In [2]: print sys_info() | |
34 | IPython version: 0.11.bzr.r1340 # random |
|
122 | {'commit_hash': '144fdae', # random | |
35 | BZR revision : 1340 |
|
123 | 'commit_source': 'repository', | |
36 | Platform info : os.name -> posix, sys.platform -> linux2 |
|
124 | 'ipython_path': '/home/fperez/usr/lib/python2.6/site-packages/IPython', | |
37 | : Linux-2.6.31-17-generic-i686-with-Ubuntu-9.10-karmic |
|
125 | 'ipython_version': '0.11.dev', | |
38 | Python info : 2.6.4 (r264:75706, Dec 7 2009, 18:45:15) |
|
126 | 'os_name': 'posix', | |
39 | [GCC 4.4.1] |
|
127 | 'platform': 'Linux-2.6.35-22-generic-i686-with-Ubuntu-10.10-maverick', | |
40 | """ |
|
128 | 'sys_executable': '/usr/bin/python', | |
41 | out = [] |
|
129 | 'sys_platform': 'linux2', | |
42 | out.append('IPython version: %s' % release.version) |
|
130 | 'sys_version': '2.6.6 (r266:84292, Sep 15 2010, 15:52:39) \\n[GCC 4.4.5]'} | |
43 | out.append('BZR revision : %s' % release.revision) |
|
131 | """ | |
44 | out.append('Platform info : os.name -> %s, sys.platform -> %s' % |
|
132 | p = os.path | |
45 | (os.name,sys.platform) ) |
|
133 | path = p.dirname(p.abspath(p.join(__file__, '..'))) | |
46 | out.append(' : %s' % platform.platform()) |
|
134 | return pprint.pformat(pkg_info(path)) | |
47 | out.append('Python info : %s' % sys.version) |
|
|||
48 | out.append('') # ensure closing newline |
|
|||
49 | return '\n'.join(out) |
|
|||
50 |
|
135 | |||
51 |
|
136 | |||
52 | def _num_cpus_unix(): |
|
137 | def _num_cpus_unix(): |
@@ -49,28 +49,22 b' it system-wide or having configure anything, by typing at the terminal:' | |||||
49 |
|
49 | |||
50 | python ipython.py |
|
50 | python ipython.py | |
51 |
|
51 | |||
52 | and similarly, you can execute the built-in test suite with: |
|
52 | In order to run the test suite, you must at least be able to import IPython, | |
53 |
|
53 | even if you haven't fully installed the user-facing scripts yet (common in a | ||
54 | .. code-block:: bash |
|
54 | development environment). You can then run the tests with: | |
55 |
|
||||
56 | python iptest.py |
|
|||
57 |
|
55 | |||
|
56 | .. code-block:: bash | |||
58 |
|
57 | |||
59 | This script manages intelligently both nose and trial, choosing the correct |
|
58 | python -c "import IPython; IPython.test()" | |
60 | test system for each of IPython's components. |
|
|||
61 |
|
59 | |||
62 | Once you have either installed it or at least configured your system to be |
|
60 | Once you have installed IPython either via a full install or using: | |
63 | able to import IPython, you can run the tests with: |
|
|||
64 |
|
61 | |||
65 | .. code-block:: bash |
|
62 | .. code-block:: bash | |
66 |
|
63 | |||
67 | python -c "import IPython; IPython.test()" |
|
64 | python setup.py develop | |
68 |
|
65 | |||
69 | This should work as long as IPython can be imported, even if you haven't fully |
|
66 | you will have available a system-wide script called :file:`iptest` that runs | |
70 | installed the user-facing scripts yet (common in a development environment). |
|
67 | the full test suite. You can then run the suite with: | |
71 | Once you have installed IPython, you will have available system-wide a script |
|
|||
72 | called :file:`iptest` that does the exact same as the :file:`iptest.py` script |
|
|||
73 | in the source directory, so you can then test simply with: |
|
|||
74 |
|
68 | |||
75 | .. code-block:: bash |
|
69 | .. code-block:: bash | |
76 |
|
70 | |||
@@ -83,26 +77,25 b' Regardless of how you run things, you should eventually see something like:' | |||||
83 |
|
77 | |||
84 | ********************************************************************** |
|
78 | ********************************************************************** | |
85 | Test suite completed for system with the following information: |
|
79 | Test suite completed for system with the following information: | |
86 | IPython version: 0.11.bzr.r1340 |
|
80 | {'commit_hash': '144fdae', | |
87 | BZR revision : 1340 |
|
81 | 'commit_source': 'repository', | |
88 | Platform info : os.name -> posix, sys.platform -> linux2 |
|
82 | 'ipython_path': '/home/fperez/usr/lib/python2.6/site-packages/IPython', | |
89 | : Linux-2.6.31-17-generic-i686-with-Ubuntu-9.10-karmic |
|
83 | 'ipython_version': '0.11.dev', | |
90 | Python info : 2.6.4 (r264:75706, Dec 7 2009, 18:45:15) |
|
84 | 'os_name': 'posix', | |
91 | [GCC 4.4.1] |
|
85 | 'platform': 'Linux-2.6.35-22-generic-i686-with-Ubuntu-10.10-maverick', | |
92 |
|
86 | 'sys_executable': '/usr/bin/python', | ||
93 | Running from an installed IPython: True |
|
87 | 'sys_platform': 'linux2', | |
|
88 | 'sys_version': '2.6.6 (r266:84292, Sep 15 2010, 15:52:39) \n[GCC 4.4.5]'} | |||
94 |
|
89 | |||
95 | Tools and libraries available at test time: |
|
90 | Tools and libraries available at test time: | |
96 | curses foolscap gobject gtk pexpect twisted wx wx.aui zope.interface |
|
91 | curses foolscap gobject gtk pexpect twisted wx wx.aui zope.interface | |
97 |
|
92 | |||
98 | Tools and libraries NOT available at test time: |
|
93 | Ran 9 test groups in 67.213s | |
99 | objc |
|
|||
100 |
|
||||
101 | Ran 11 test groups in 36.244s |
|
|||
102 |
|
94 | |||
103 | Status: |
|
95 | Status: | |
104 | OK |
|
96 | OK | |
105 |
|
97 | |||
|
98 | ||||
106 | If not, there will be a message indicating which test group failed and how to |
|
99 | If not, there will be a message indicating which test group failed and how to | |
107 | rerun that group individually. For example, this tests the |
|
100 | rerun that group individually. For example, this tests the | |
108 | :mod:`IPython.utils` subpackage, the :option:`-v` option shows progress |
|
101 | :mod:`IPython.utils` subpackage, the :option:`-v` option shows progress | |
@@ -110,7 +103,7 b' indicators:' | |||||
110 |
|
103 | |||
111 | .. code-block:: bash |
|
104 | .. code-block:: bash | |
112 |
|
105 | |||
113 |
$ |
|
106 | $ iptest -v IPython.utils | |
114 | ..........................SS..SSS............................S.S... |
|
107 | ..........................SS..SSS............................S.S... | |
115 | ......................................................... |
|
108 | ......................................................... | |
116 | ---------------------------------------------------------------------- |
|
109 | ---------------------------------------------------------------------- | |
@@ -126,7 +119,7 b' example, this lets you run the specific test :func:`test_rehashx` inside the' | |||||
126 |
|
119 | |||
127 | .. code-block:: bash |
|
120 | .. code-block:: bash | |
128 |
|
121 | |||
129 |
$ |
|
122 | $ iptest -vv IPython.core.tests.test_magic:test_rehashx | |
130 | IPython.core.tests.test_magic.test_rehashx(True,) ... ok |
|
123 | IPython.core.tests.test_magic.test_rehashx(True,) ... ok | |
131 | IPython.core.tests.test_magic.test_rehashx(True,) ... ok |
|
124 | IPython.core.tests.test_magic.test_rehashx(True,) ... ok | |
132 |
|
125 | |||
@@ -146,6 +139,16 b' package basis:' | |||||
146 |
|
139 | |||
147 | trial IPython.kernel |
|
140 | trial IPython.kernel | |
148 |
|
141 | |||
|
142 | .. note:: | |||
|
143 | ||||
|
144 | The system information summary printed above is accessible from the top | |||
|
145 | level package. If you encounter a problem with IPython, it's useful to | |||
|
146 | include this information when reporting on the mailing list; use:: | |||
|
147 | ||||
|
148 | from IPython import sys_info | |||
|
149 | print sys_info() | |||
|
150 | ||||
|
151 | and include the resulting information in your query. | |||
149 |
|
152 | |||
150 | For developers: writing tests |
|
153 | For developers: writing tests | |
151 | ============================= |
|
154 | ============================= |
General Comments 0
You need to be logged in to leave comments.
Login now