##// END OF EJS Templates
Merge pull request #2 from ipython/master...
kaushikanant -
r22831:f18b180e merge
parent child Browse files
Show More
@@ -0,0 +1,3 b''
1 The `--deep-reload` flag and the corresponding options to inject `dreload` or
2 `reload` into the interactive namespace have been removed. You have to
3 explicitly import `reload` from `IPython.lib.deepreload` to use it.
@@ -0,0 +1,2 b''
1 IPython.utils.warn was deprecated in IPython 4.0, and has now been removed.
2 instead of Ipython.utils.warn inbuilt warning module is used.
@@ -22,17 +22,24 b' from __future__ import absolute_import'
22
22
23 import os
23 import os
24 import sys
24 import sys
25 import warnings
26
25
27 #-----------------------------------------------------------------------------
26 #-----------------------------------------------------------------------------
28 # Setup everything
27 # Setup everything
29 #-----------------------------------------------------------------------------
28 #-----------------------------------------------------------------------------
30
29
31 # Don't forget to also update setup.py when this changes!
30 # Don't forget to also update setup.py when this changes!
32 v = sys.version_info
31 if sys.version_info < (3,3):
33 if v[:2] < (3,3):
32 raise ImportError(
34 raise ImportError('IPython requires Python version 3.3 or above.')
33 """
35 del v
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 # Make it easy to import extensions - they are always directly on pythonpath.
44 # Make it easy to import extensions - they are always directly on pythonpath.
38 # Therefore, non-IPython modules can be added to extensions directory.
45 # Therefore, non-IPython modules can be added to extensions directory.
@@ -143,4 +150,3 b' def start_kernel(argv=None, **kwargs):'
143 """
150 """
144 from IPython.kernel.zmq.kernelapp import launch_new_instance
151 from IPython.kernel.zmq.kernelapp import launch_new_instance
145 return launch_new_instance(argv=argv, **kwargs)
152 return launch_new_instance(argv=argv, **kwargs)
146
@@ -52,17 +52,6 b' class BuiltinTrap(Configurable):'
52 'quit': HideBuiltin,
52 'quit': HideBuiltin,
53 'get_ipython': self.shell.get_ipython,
53 'get_ipython': self.shell.get_ipython,
54 }
54 }
55 # Recursive reload function
56 try:
57 from IPython.lib import deepreload
58 if self.shell.deep_reload:
59 from warnings import warn
60 warn("Automatically replacing builtin `reload` by `deepreload.reload` is deprecated since IPython 4.0, please import `reload` explicitly from `IPython.lib.deepreload", DeprecationWarning)
61 self.auto_builtins['reload'] = deepreload._dreload
62 else:
63 self.auto_builtins['dreload']= deepreload._dreload
64 except ImportError:
65 pass
66
55
67 def __enter__(self):
56 def __enter__(self):
68 if self._nested_level == 0:
57 if self._nested_level == 0:
@@ -260,21 +260,6 b' class InteractiveShell(SingletonConfigurable):'
260 help="Set the color scheme (NoColor, Neutral, Linux, or LightBG)."
260 help="Set the color scheme (NoColor, Neutral, Linux, or LightBG)."
261 ).tag(config=True)
261 ).tag(config=True)
262 debug = Bool(False).tag(config=True)
262 debug = Bool(False).tag(config=True)
263 deep_reload = Bool(False, help=
264 """
265 **Deprecated**
266
267 Will be removed in IPython 6.0
268
269 Enable deep (recursive) reloading by default. IPython can use the
270 deep_reload module which reloads changes in modules recursively (it
271 replaces the reload() function, so you don't need to change anything to
272 use it). `deep_reload` forces a full reload of modules whose code may
273 have changed, which the default reload() function does not. When
274 deep_reload is off, IPython will use the normal reload(), but
275 deep_reload will still be available as dreload().
276 """
277 ).tag(config=True)
278 disable_failing_post_execute = Bool(False,
263 disable_failing_post_execute = Bool(False,
279 help="Don't call post-execute functions that have failed in the past."
264 help="Don't call post-execute functions that have failed in the past."
280 ).tag(config=True)
265 ).tag(config=True)
@@ -17,7 +17,7 b' from IPython import paths'
17 from IPython.testing.decorators import skip_win32
17 from IPython.testing.decorators import skip_win32
18 from IPython.utils.tempdir import TemporaryDirectory
18 from IPython.utils.tempdir import TemporaryDirectory
19
19
20 TMP_TEST_DIR = tempfile.mkdtemp()
20 TMP_TEST_DIR = os.path.realpath(tempfile.mkdtemp())
21 HOME_TEST_DIR = os.path.join(TMP_TEST_DIR, "home_test_dir")
21 HOME_TEST_DIR = os.path.join(TMP_TEST_DIR, "home_test_dir")
22 XDG_TEST_DIR = os.path.join(HOME_TEST_DIR, "xdg_test_dir")
22 XDG_TEST_DIR = os.path.join(HOME_TEST_DIR, "xdg_test_dir")
23 XDG_CACHE_DIR = os.path.join(HOME_TEST_DIR, "xdg_cache_dir")
23 XDG_CACHE_DIR = os.path.join(HOME_TEST_DIR, "xdg_cache_dir")
@@ -341,21 +341,3 b" def reload(module, exclude=('sys', 'os.path', builtin_mod_name, '__main__')):"
341 return deep_reload_hook(module)
341 return deep_reload_hook(module)
342 finally:
342 finally:
343 found_now = {}
343 found_now = {}
344
345
346 def _dreload(module, **kwargs):
347 """
348 **deprecated**
349
350 import reload explicitly from `IPython.lib.deepreload` to use it
351
352 """
353 # this was marked as deprecated and for 5.0 removal, but
354 # IPython.core_builtin_trap have a Deprecation warning for 6.0, so cannot
355 # remove that now.
356 warn("""
357 injecting `dreload` in interactive namespace is deprecated since IPython 4.0.
358 Please import `reload` explicitly from `IPython.lib.deepreload`.
359 """, DeprecationWarning, stacklevel=2)
360 reload(module, **kwargs)
361
@@ -8,10 +8,10 b' from warnings import warn'
8
8
9 from IPython.core.interactiveshell import InteractiveShell, InteractiveShellABC
9 from IPython.core.interactiveshell import InteractiveShell, InteractiveShellABC
10 from IPython.utils import io
10 from IPython.utils import io
11 from IPython.utils.py3compat import PY3, cast_unicode_py2, input
11 from IPython.utils.py3compat import PY3, cast_unicode_py2, input, string_types
12 from IPython.utils.terminal import toggle_set_term_title, set_term_title
12 from IPython.utils.terminal import toggle_set_term_title, set_term_title
13 from IPython.utils.process import abbrev_cwd
13 from IPython.utils.process import abbrev_cwd
14 from traitlets import Bool, Unicode, Dict, Integer, observe, Instance, Type, default, Enum
14 from traitlets import Bool, Unicode, Dict, Integer, observe, Instance, Type, default, Enum, Union
15
15
16 from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
16 from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
17 from prompt_toolkit.filters import (HasFocus, Condition, IsDone)
17 from prompt_toolkit.filters import (HasFocus, Condition, IsDone)
@@ -23,6 +23,7 b' from prompt_toolkit.layout.processors import ConditionalProcessor, HighlightMatc'
23 from prompt_toolkit.styles import PygmentsStyle, DynamicStyle
23 from prompt_toolkit.styles import PygmentsStyle, DynamicStyle
24
24
25 from pygments.styles import get_style_by_name, get_all_styles
25 from pygments.styles import get_style_by_name, get_all_styles
26 from pygments.style import Style
26 from pygments.token import Token
27 from pygments.token import Token
27
28
28 from .debugger import TerminalPdb, Pdb
29 from .debugger import TerminalPdb, Pdb
@@ -132,8 +133,9 b' class TerminalInteractiveShell(InteractiveShell):'
132 help="Enable mouse support in the prompt"
133 help="Enable mouse support in the prompt"
133 ).tag(config=True)
134 ).tag(config=True)
134
135
135 highlighting_style = Unicode('legacy',
136 highlighting_style = Union([Unicode('legacy'), Type(klass=Style)],
136 help="The name of a Pygments style to use for syntax highlighting: \n %s" % ', '.join(get_all_styles())
137 help="""The name or class of a Pygments style to use for syntax
138 highlighting: \n %s""" % ', '.join(get_all_styles())
137 ).tag(config=True)
139 ).tag(config=True)
138
140
139
141
@@ -143,7 +145,7 b' class TerminalInteractiveShell(InteractiveShell):'
143 self.refresh_style()
145 self.refresh_style()
144
146
145 def refresh_style(self):
147 def refresh_style(self):
146 self._style = self._make_style_from_name(self.highlighting_style)
148 self._style = self._make_style_from_name_or_cls(self.highlighting_style)
147
149
148
150
149 highlighting_style_overrides = Dict(
151 highlighting_style_overrides = Dict(
@@ -229,7 +231,7 b' class TerminalInteractiveShell(InteractiveShell):'
229 if cell and (cell != last_cell):
231 if cell and (cell != last_cell):
230 history.append(cell)
232 history.append(cell)
231
233
232 self._style = self._make_style_from_name(self.highlighting_style)
234 self._style = self._make_style_from_name_or_cls(self.highlighting_style)
233 style = DynamicStyle(lambda: self._style)
235 style = DynamicStyle(lambda: self._style)
234
236
235 editing_mode = getattr(EditingMode, self.editing_mode.upper())
237 editing_mode = getattr(EditingMode, self.editing_mode.upper())
@@ -249,14 +251,14 b' class TerminalInteractiveShell(InteractiveShell):'
249 self._pt_app, eventloop=self._eventloop,
251 self._pt_app, eventloop=self._eventloop,
250 output=create_output(true_color=self.true_color))
252 output=create_output(true_color=self.true_color))
251
253
252 def _make_style_from_name(self, name):
254 def _make_style_from_name_or_cls(self, name_or_cls):
253 """
255 """
254 Small wrapper that make an IPython compatible style from a style name
256 Small wrapper that make an IPython compatible style from a style name
255
257
256 We need that to add style for prompt ... etc.
258 We need that to add style for prompt ... etc.
257 """
259 """
258 style_overrides = {}
260 style_overrides = {}
259 if name == 'legacy':
261 if name_or_cls == 'legacy':
260 legacy = self.colors.lower()
262 legacy = self.colors.lower()
261 if legacy == 'linux':
263 if legacy == 'linux':
262 style_cls = get_style_by_name('monokai')
264 style_cls = get_style_by_name('monokai')
@@ -287,7 +289,10 b' class TerminalInteractiveShell(InteractiveShell):'
287 else :
289 else :
288 raise ValueError('Got unknown colors: ', legacy)
290 raise ValueError('Got unknown colors: ', legacy)
289 else :
291 else :
290 style_cls = get_style_by_name(name)
292 if isinstance(name_or_cls, string_types):
293 style_cls = get_style_by_name(name_or_cls)
294 else:
295 style_cls = name_or_cls
291 style_overrides = {
296 style_overrides = {
292 Token.Prompt: '#009900',
297 Token.Prompt: '#009900',
293 Token.PromptNum: '#00ff00 bold',
298 Token.PromptNum: '#00ff00 bold',
@@ -71,4 +71,4 b' class RichPromptDisplayHook(DisplayHook):'
71 if self.shell.pt_cli:
71 if self.shell.pt_cli:
72 self.shell.pt_cli.print_tokens(tokens)
72 self.shell.pt_cli.print_tokens(tokens)
73 else:
73 else:
74 print(*(s for t, s in tokens), sep='')
74 sys.stdout.write(''.join(s for t, s in tokens))
@@ -19,7 +19,7 b' Overview'
19 ========
19 ========
20
20
21 Welcome to IPython. Our full documentation is available on `ipython.readthedocs.io
21 Welcome to IPython. Our full documentation is available on `ipython.readthedocs.io
22 <https://ipython.readthedocs.io/en/stable/>`_ and contain information on how to install, use
22 <https://ipython.readthedocs.io/en/stable/>`_ and contains information on how to install, use and
23 contribute to the project.
23 contribute to the project.
24
24
25 Officially, IPython requires Python version 3.3 and above.
25 Officially, IPython requires Python version 3.3 and above.
@@ -32,20 +32,56 b' if you want to use these.'
32
32
33
33
34
34
35 Developement and Instant runnimg
35 Development and Instant running
36 ================================
36 ===============================
37
37
38 You can find the latest version of the development documentation on `readthedocs
38 You can find the latest version of the development documentation on `readthedocs
39 <http://ipython.readthedocs.io/en/latest/>`_.
39 <http://ipython.readthedocs.io/en/latest/>`_.
40
40
41 You can run IPython from this directory without even installing it system-wide
41 You can run IPython from this directory without even installing it system-wide
42 by typing at the terminal::
42 by typing at the terminal::
43
43
44 $ python -m IPython
44 $ python -m IPython
45
45
46 Or see the `developement installation docs
46 Or see the `development installation docs
47 <http://ipython.readthedocs.io/en/latest/install/install.html#installing-the-development-version>`_
47 <http://ipython.readthedocs.io/en/latest/install/install.html#installing-the-development-version>`_
48 for the latest revision on read the docs.
48 for the latest revision on read the docs.
49
49
50 Documentation and installation instructions for older version of IPython can be
50 Documentation and installation instructions for older version of IPython can be
51 found on the `IPython website <http://ipython.org/documentation.html>`_
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
@@ -101,9 +101,10 b" is set to ``'legacy'``. It has four case-insensitive values:"
101 should be legible on either dark or light terminal backgrounds. *linux* is
101 should be legible on either dark or light terminal backgrounds. *linux* is
102 optimised for dark backgrounds and *lightbg* for light ones.
102 optimised for dark backgrounds and *lightbg* for light ones.
103
103
104 ``TerminalInteractiveShell.highlighting_style`` determines prompt colours and syntax
104 ``TerminalInteractiveShell.highlighting_style`` determines prompt colours and
105 highlighting. It takes the name of a Pygments style as a string, or the special
105 syntax highlighting. It takes the name (as a string) or class (as a subclass of
106 value ``'legacy'`` to pick a style in accordance with ``InteractiveShell.colors``.
106 ``pygments.style.Style``) of a Pygments style, or the special value ``'legacy'``
107 to pick a style in accordance with ``InteractiveShell.colors``.
107
108
108 You can see the Pygments styles available on your system by running::
109 You can see the Pygments styles available on your system by running::
109
110
@@ -26,9 +26,18 b' import sys'
26
26
27 # This check is also made in IPython/__init__, don't forget to update both when
27 # This check is also made in IPython/__init__, don't forget to update both when
28 # changing Python version requirements.
28 # changing Python version requirements.
29 v = sys.version_info
29 if sys.version_info < (3,3):
30 if v[:2] < (3,3):
30 error = """
31 error = "ERROR: IPython requires Python version 3.3 or above."
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 print(error, file=sys.stderr)
41 print(error, file=sys.stderr)
33 sys.exit(1)
42 sys.exit(1)
34
43
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now