##// END OF EJS Templates
Merge pull request #9900 from Carreau/update-no-2x...
Carol Willing -
r22824:59b38638 merge
parent child Browse files
Show More
@@ -1,146 +1,152
1 1 # encoding: utf-8
2 2 """
3 3 IPython: tools for interactive and parallel computing in Python.
4 4
5 5 http://ipython.org
6 6 """
7 7 #-----------------------------------------------------------------------------
8 8 # Copyright (c) 2008-2011, IPython Development Team.
9 9 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
10 10 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
11 11 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
12 12 #
13 13 # Distributed under the terms of the Modified BSD License.
14 14 #
15 15 # The full license is in the file COPYING.txt, distributed with this software.
16 16 #-----------------------------------------------------------------------------
17 17
18 18 #-----------------------------------------------------------------------------
19 19 # Imports
20 20 #-----------------------------------------------------------------------------
21 21 from __future__ import absolute_import
22 22
23 23 import os
24 24 import sys
25 import warnings
26 25
27 26 #-----------------------------------------------------------------------------
28 27 # Setup everything
29 28 #-----------------------------------------------------------------------------
30 29
31 30 # Don't forget to also update setup.py when this changes!
32 v = sys.version_info
33 if v[:2] < (3,3):
34 raise ImportError('IPython requires Python version 3.3 or above.')
35 del v
31 if sys.version_info < (3,3):
32 raise ImportError(
33 """
34 IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
35 When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
36 Beginning with IPython 6.0, Python 3.3 and above is required.
37
38 See IPython `README.rst` file for more information:
39
40 https://github.com/ipython/ipython/blob/master/README.rst
41
42 """)
36 43
37 44 # Make it easy to import extensions - they are always directly on pythonpath.
38 45 # Therefore, non-IPython modules can be added to extensions directory.
39 46 # This should probably be in ipapp.py.
40 47 sys.path.append(os.path.join(os.path.dirname(__file__), "extensions"))
41 48
42 49 #-----------------------------------------------------------------------------
43 50 # Setup the top level names
44 51 #-----------------------------------------------------------------------------
45 52
46 53 from .core.getipython import get_ipython
47 54 from .core import release
48 55 from .core.application import Application
49 56 from .terminal.embed import embed
50 57
51 58 from .core.interactiveshell import InteractiveShell
52 59 from .testing import test
53 60 from .utils.sysinfo import sys_info
54 61 from .utils.frame import extract_module_locals
55 62
56 63 # Release data
57 64 __author__ = '%s <%s>' % (release.author, release.author_email)
58 65 __license__ = release.license
59 66 __version__ = release.version
60 67 version_info = release.version_info
61 68
62 69 def embed_kernel(module=None, local_ns=None, **kwargs):
63 70 """Embed and start an IPython kernel in a given scope.
64 71
65 72 If you don't want the kernel to initialize the namespace
66 73 from the scope of the surrounding function,
67 74 and/or you want to load full IPython configuration,
68 75 you probably want `IPython.start_kernel()` instead.
69 76
70 77 Parameters
71 78 ----------
72 79 module : ModuleType, optional
73 80 The module to load into IPython globals (default: caller)
74 81 local_ns : dict, optional
75 82 The namespace to load into IPython user namespace (default: caller)
76 83
77 84 kwargs : various, optional
78 85 Further keyword args are relayed to the IPKernelApp constructor,
79 86 allowing configuration of the Kernel. Will only have an effect
80 87 on the first embed_kernel call for a given process.
81 88 """
82 89
83 90 (caller_module, caller_locals) = extract_module_locals(1)
84 91 if module is None:
85 92 module = caller_module
86 93 if local_ns is None:
87 94 local_ns = caller_locals
88 95
89 96 # Only import .zmq when we really need it
90 97 from ipykernel.embed import embed_kernel as real_embed_kernel
91 98 real_embed_kernel(module=module, local_ns=local_ns, **kwargs)
92 99
93 100 def start_ipython(argv=None, **kwargs):
94 101 """Launch a normal IPython instance (as opposed to embedded)
95 102
96 103 `IPython.embed()` puts a shell in a particular calling scope,
97 104 such as a function or method for debugging purposes,
98 105 which is often not desirable.
99 106
100 107 `start_ipython()` does full, regular IPython initialization,
101 108 including loading startup files, configuration, etc.
102 109 much of which is skipped by `embed()`.
103 110
104 111 This is a public API method, and will survive implementation changes.
105 112
106 113 Parameters
107 114 ----------
108 115
109 116 argv : list or None, optional
110 117 If unspecified or None, IPython will parse command-line options from sys.argv.
111 118 To prevent any command-line parsing, pass an empty list: `argv=[]`.
112 119 user_ns : dict, optional
113 120 specify this dictionary to initialize the IPython user namespace with particular values.
114 121 kwargs : various, optional
115 122 Any other kwargs will be passed to the Application constructor,
116 123 such as `config`.
117 124 """
118 125 from IPython.terminal.ipapp import launch_new_instance
119 126 return launch_new_instance(argv=argv, **kwargs)
120 127
121 128 def start_kernel(argv=None, **kwargs):
122 129 """Launch a normal IPython kernel instance (as opposed to embedded)
123 130
124 131 `IPython.embed_kernel()` puts a shell in a particular calling scope,
125 132 such as a function or method for debugging purposes,
126 133 which is often not desirable.
127 134
128 135 `start_kernel()` does full, regular IPython initialization,
129 136 including loading startup files, configuration, etc.
130 137 much of which is skipped by `embed()`.
131 138
132 139 Parameters
133 140 ----------
134 141
135 142 argv : list or None, optional
136 143 If unspecified or None, IPython will parse command-line options from sys.argv.
137 144 To prevent any command-line parsing, pass an empty list: `argv=[]`.
138 145 user_ns : dict, optional
139 146 specify this dictionary to initialize the IPython user namespace with particular values.
140 147 kwargs : various, optional
141 148 Any other kwargs will be passed to the Application constructor,
142 149 such as `config`.
143 150 """
144 151 from IPython.kernel.zmq.kernelapp import launch_new_instance
145 152 return launch_new_instance(argv=argv, **kwargs)
146
@@ -1,51 +1,87
1 1 .. image:: https://codecov.io/github/ipython/ipython/coverage.svg?branch=master
2 2 :target: https://codecov.io/github/ipython/ipython?branch=master
3 3
4 4 .. image:: https://img.shields.io/pypi/dm/IPython.svg
5 5 :target: https://pypi.python.org/pypi/ipython
6 6
7 7 .. image:: https://img.shields.io/pypi/v/IPython.svg
8 8 :target: https://pypi.python.org/pypi/ipython
9 9
10 10 .. image:: https://img.shields.io/travis/ipython/ipython.svg
11 11 :target: https://travis-ci.org/ipython/ipython
12 12
13 13
14 14 ===========================================
15 15 IPython: Productive Interactive Computing
16 16 ===========================================
17 17
18 18 Overview
19 19 ========
20 20
21 21 Welcome to IPython. Our full documentation is available on `ipython.readthedocs.io
22 22 <https://ipython.readthedocs.io/en/stable/>`_ and contains information on how to install, use and
23 23 contribute to the project.
24 24
25 25 Officially, IPython requires Python version 3.3 and above.
26 26 IPython 5.x is the last IPython version to support Python 2.7.
27 27
28 28 The Notebook, Qt console and a number of other pieces are now parts of *Jupyter*.
29 29 See the `Jupyter installation docs <http://jupyter.readthedocs.io/en/latest/install.html>`__
30 30 if you want to use these.
31 31
32 32
33 33
34 34
35 35 Development and Instant runnimg
36 36 ================================
37 37
38 38 You can find the latest version of the development documentation on `readthedocs
39 39 <http://ipython.readthedocs.io/en/latest/>`_.
40 40
41 41 You can run IPython from this directory without even installing it system-wide
42 42 by typing at the terminal::
43 43
44 44 $ python -m IPython
45 45
46 46 Or see the `development installation docs
47 47 <http://ipython.readthedocs.io/en/latest/install/install.html#installing-the-development-version>`_
48 48 for the latest revision on read the docs.
49 49
50 50 Documentation and installation instructions for older version of IPython can be
51 51 found on the `IPython website <http://ipython.org/documentation.html>`_
52
53
54
55 IPython requires Python version 3 or above
56 ==========================================
57
58 Starting with version 6.0, IPython does not support Python 2.7, 3.0, 3.1, or
59 3.2.
60
61 For a version compatible with Python 2.7, please install the 5.x LTS Long Term
62 Support version.
63
64 If you are encountering this error message you are likely trying to install or
65 use IPython from source. You need to checkout the remote 5.x branch. If you are
66 using git the following should work:
67
68 $ git fetch origin
69 $ git checkout -b origin/5.x
70
71 If you encounter this error message with a regular install of IPython, then you
72 likely need to update your package manager, for example if you are using `pip`
73 check the version of pip with
74
75 $ pip --version
76
77 You will need to update pip to the version 8.2 or greater. If you are not using
78 pip, please inquiry with the maintainers of the package for your package
79 manager.
80
81 For more information see one of our blog posts:
82
83 http://blog.jupyter.org/2016/07/08/ipython-5-0-released/
84
85 As well as the following Pull-Request for discussion:
86
87 https://github.com/ipython/ipython/pull/9900
@@ -1,289 +1,298
1 1 #!/usr/bin/env python
2 2 # -*- coding: utf-8 -*-
3 3 """Setup script for IPython.
4 4
5 5 Under Posix environments it works like a typical setup.py script.
6 6 Under Windows, the command sdist is not supported, since IPython
7 7 requires utilities which are not available under Windows."""
8 8
9 9 #-----------------------------------------------------------------------------
10 10 # Copyright (c) 2008-2011, IPython Development Team.
11 11 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
12 12 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
13 13 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
14 14 #
15 15 # Distributed under the terms of the Modified BSD License.
16 16 #
17 17 # The full license is in the file COPYING.rst, distributed with this software.
18 18 #-----------------------------------------------------------------------------
19 19
20 20 #-----------------------------------------------------------------------------
21 21 # Minimal Python version sanity check
22 22 #-----------------------------------------------------------------------------
23 23 from __future__ import print_function
24 24
25 25 import sys
26 26
27 27 # This check is also made in IPython/__init__, don't forget to update both when
28 28 # changing Python version requirements.
29 v = sys.version_info
30 if v[:2] < (3,3):
31 error = "ERROR: IPython requires Python version 3.3 or above."
29 if sys.version_info < (3,3):
30 error = """
31 IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
32 When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
33 Beginning with IPython 6.0, Python 3.3 and above is required.
34
35 See IPython `README.rst` file for more information:
36
37 https://github.com/ipython/ipython/blob/master/README.rst
38
39 """
40
32 41 print(error, file=sys.stderr)
33 42 sys.exit(1)
34 43
35 44 PY3 = (sys.version_info[0] >= 3)
36 45
37 46 # At least we're on the python version we need, move on.
38 47
39 48 #-------------------------------------------------------------------------------
40 49 # Imports
41 50 #-------------------------------------------------------------------------------
42 51
43 52 # Stdlib imports
44 53 import os
45 54
46 55 from glob import glob
47 56
48 57 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
49 58 # update it when the contents of directories change.
50 59 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
51 60
52 61 from distutils.core import setup
53 62
54 63 # Our own imports
55 64 from setupbase import target_update
56 65
57 66 from setupbase import (
58 67 setup_args,
59 68 find_packages,
60 69 find_package_data,
61 70 check_package_data_first,
62 71 find_entry_points,
63 72 build_scripts_entrypt,
64 73 find_data_files,
65 74 git_prebuild,
66 75 install_symlinked,
67 76 install_lib_symlink,
68 77 install_scripts_for_symlink,
69 78 unsymlink,
70 79 )
71 80
72 81 isfile = os.path.isfile
73 82 pjoin = os.path.join
74 83
75 84 #-------------------------------------------------------------------------------
76 85 # Handle OS specific things
77 86 #-------------------------------------------------------------------------------
78 87
79 88 if os.name in ('nt','dos'):
80 89 os_name = 'windows'
81 90 else:
82 91 os_name = os.name
83 92
84 93 # Under Windows, 'sdist' has not been supported. Now that the docs build with
85 94 # Sphinx it might work, but let's not turn it on until someone confirms that it
86 95 # actually works.
87 96 if os_name == 'windows' and 'sdist' in sys.argv:
88 97 print('The sdist command is not available under Windows. Exiting.')
89 98 sys.exit(1)
90 99
91 100
92 101 #-------------------------------------------------------------------------------
93 102 # Things related to the IPython documentation
94 103 #-------------------------------------------------------------------------------
95 104
96 105 # update the manuals when building a source dist
97 106 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
98 107
99 108 # List of things to be updated. Each entry is a triplet of args for
100 109 # target_update()
101 110 to_update = [
102 111 ('docs/man/ipython.1.gz',
103 112 ['docs/man/ipython.1'],
104 113 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
105 114 ]
106 115
107 116
108 117 [ target_update(*t) for t in to_update ]
109 118
110 119 #---------------------------------------------------------------------------
111 120 # Find all the packages, package data, and data_files
112 121 #---------------------------------------------------------------------------
113 122
114 123 packages = find_packages()
115 124 package_data = find_package_data()
116 125
117 126 data_files = find_data_files()
118 127
119 128 setup_args['packages'] = packages
120 129 setup_args['package_data'] = package_data
121 130 setup_args['data_files'] = data_files
122 131
123 132 #---------------------------------------------------------------------------
124 133 # custom distutils commands
125 134 #---------------------------------------------------------------------------
126 135 # imports here, so they are after setuptools import if there was one
127 136 from distutils.command.sdist import sdist
128 137 from distutils.command.upload import upload
129 138
130 139 class UploadWindowsInstallers(upload):
131 140
132 141 description = "Upload Windows installers to PyPI (only used from tools/release_windows.py)"
133 142 user_options = upload.user_options + [
134 143 ('files=', 'f', 'exe file (or glob) to upload')
135 144 ]
136 145 def initialize_options(self):
137 146 upload.initialize_options(self)
138 147 meta = self.distribution.metadata
139 148 base = '{name}-{version}'.format(
140 149 name=meta.get_name(),
141 150 version=meta.get_version()
142 151 )
143 152 self.files = os.path.join('dist', '%s.*.exe' % base)
144 153
145 154 def run(self):
146 155 for dist_file in glob(self.files):
147 156 self.upload_file('bdist_wininst', 'any', dist_file)
148 157
149 158 setup_args['cmdclass'] = {
150 159 'build_py': \
151 160 check_package_data_first(git_prebuild('IPython')),
152 161 'sdist' : git_prebuild('IPython', sdist),
153 162 'upload_wininst' : UploadWindowsInstallers,
154 163 'symlink': install_symlinked,
155 164 'install_lib_symlink': install_lib_symlink,
156 165 'install_scripts_sym': install_scripts_for_symlink,
157 166 'unsymlink': unsymlink,
158 167 }
159 168
160 169
161 170 #---------------------------------------------------------------------------
162 171 # Handle scripts, dependencies, and setuptools specific things
163 172 #---------------------------------------------------------------------------
164 173
165 174 # For some commands, use setuptools. Note that we do NOT list install here!
166 175 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
167 176 needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm',
168 177 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel',
169 178 'egg_info', 'easy_install', 'upload', 'install_egg_info',
170 179 ))
171 180
172 181 if len(needs_setuptools.intersection(sys.argv)) > 0:
173 182 import setuptools
174 183
175 184 # This dict is used for passing extra arguments that are setuptools
176 185 # specific to setup
177 186 setuptools_extra_args = {}
178 187
179 188 # setuptools requirements
180 189
181 190 extras_require = dict(
182 191 parallel = ['ipyparallel'],
183 192 qtconsole = ['qtconsole'],
184 193 doc = ['Sphinx>=1.3'],
185 194 test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments', 'nbformat', 'ipykernel', 'numpy'],
186 195 terminal = [],
187 196 kernel = ['ipykernel'],
188 197 nbformat = ['nbformat'],
189 198 notebook = ['notebook', 'ipywidgets'],
190 199 nbconvert = ['nbconvert'],
191 200 )
192 201
193 202 install_requires = [
194 203 'setuptools>=18.5',
195 204 'decorator',
196 205 'pickleshare',
197 206 'simplegeneric>0.8',
198 207 'traitlets>=4.2',
199 208 'prompt_toolkit>=1.0.3,<2.0.0',
200 209 'pygments',
201 210 ]
202 211
203 212 # Platform-specific dependencies:
204 213 # This is the correct way to specify these,
205 214 # but requires pip >= 6. pip < 6 ignores these.
206 215
207 216 extras_require.update({
208 217 ':python_version == "2.7"': ['backports.shutil_get_terminal_size'],
209 218 ':python_version == "2.7" or python_version == "3.3"': ['pathlib2'],
210 219 ':sys_platform != "win32"': ['pexpect'],
211 220 ':sys_platform == "darwin"': ['appnope'],
212 221 ':sys_platform == "win32"': ['colorama', 'win_unicode_console>=0.5'],
213 222 'test:python_version == "2.7"': ['mock'],
214 223 })
215 224 # FIXME: re-specify above platform dependencies for pip < 6
216 225 # These would result in non-portable bdists.
217 226 if not any(arg.startswith('bdist') for arg in sys.argv):
218 227 if sys.version_info < (3, 3):
219 228 extras_require['test'].append('mock')
220 229
221 230 if sys.platform == 'darwin':
222 231 install_requires.extend(['appnope'])
223 232
224 233 if not sys.platform.startswith('win'):
225 234 install_requires.append('pexpect')
226 235
227 236 # workaround pypa/setuptools#147, where setuptools misspells
228 237 # platform_python_implementation as python_implementation
229 238 if 'setuptools' in sys.modules:
230 239 for key in list(extras_require):
231 240 if 'platform_python_implementation' in key:
232 241 new_key = key.replace('platform_python_implementation', 'python_implementation')
233 242 extras_require[new_key] = extras_require.pop(key)
234 243
235 244 everything = set()
236 245 for key, deps in extras_require.items():
237 246 if ':' not in key:
238 247 everything.update(deps)
239 248 extras_require['all'] = everything
240 249
241 250 if 'setuptools' in sys.modules:
242 251 setuptools_extra_args['python_requires'] = '>=3.3'
243 252 setuptools_extra_args['zip_safe'] = False
244 253 setuptools_extra_args['entry_points'] = {
245 254 'console_scripts': find_entry_points(),
246 255 'pygments.lexers': [
247 256 'ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer',
248 257 'ipython = IPython.lib.lexers:IPythonLexer',
249 258 'ipython3 = IPython.lib.lexers:IPython3Lexer',
250 259 ],
251 260 }
252 261 setup_args['extras_require'] = extras_require
253 262 requires = setup_args['install_requires'] = install_requires
254 263
255 264 # Script to be run by the windows binary installer after the default setup
256 265 # routine, to add shortcuts and similar windows-only things. Windows
257 266 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
258 267 # doesn't find them.
259 268 if 'bdist_wininst' in sys.argv:
260 269 if len(sys.argv) > 2 and \
261 270 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
262 271 print("ERROR: bdist_wininst must be run alone. Exiting.", file=sys.stderr)
263 272 sys.exit(1)
264 273 setup_args['data_files'].append(
265 274 ['Scripts', ('scripts/ipython.ico', 'scripts/ipython_nb.ico')])
266 275 setup_args['scripts'] = [pjoin('scripts','ipython_win_post_install.py')]
267 276 setup_args['options'] = {"bdist_wininst":
268 277 {"install_script":
269 278 "ipython_win_post_install.py"}}
270 279
271 280 else:
272 281 # scripts has to be a non-empty list, or install_scripts isn't called
273 282 setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()]
274 283
275 284 setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt
276 285
277 286 #---------------------------------------------------------------------------
278 287 # Do the actual setup now
279 288 #---------------------------------------------------------------------------
280 289
281 290 setup_args.update(setuptools_extra_args)
282 291
283 292
284 293
285 294 def main():
286 295 setup(**setup_args)
287 296
288 297 if __name__ == '__main__':
289 298 main()
General Comments 0
You need to be logged in to leave comments. Login now