##// END OF EJS Templates
remove duplicate WatsNew from bad rebase
Matthias Bussonnier -
Show More
@@ -1,56 +1,56 b''
1 # http://travis-ci.org/#!/ipython/ipython
1 # http://travis-ci.org/#!/ipython/ipython
2 language: python
2 language: python
3 python:
3 python:
4 - "nightly"
4 - "nightly"
5 - "3.7-dev"
5 - "3.7-dev"
6 - 3.7
6 - 3.6
7 - 3.6
7 - 3.5
8 - 3.5
8 - 3.4
9 sudo: false
9 sudo: false
10 env:
10 env:
11 global:
11 global:
12 - PATH=$TRAVIS_BUILD_DIR/pandoc:$PATH
12 - PATH=$TRAVIS_BUILD_DIR/pandoc:$PATH
13 group: edge
13 group: edge
14 before_install:
14 before_install:
15 - 'if [[ $GROUP != js* ]]; then COVERAGE=""; fi'
15 - 'if [[ $GROUP != js* ]]; then COVERAGE=""; fi'
16 install:
16 install:
17 - pip install pip --upgrade
17 - pip install pip --upgrade
18 - pip install setuptools --upgrade
18 - pip install setuptools --upgrade
19 - pip install -e file://$PWD#egg=ipython[test] --upgrade
19 - pip install -e file://$PWD#egg=ipython[test] --upgrade
20 - pip install codecov check-manifest --upgrade
20 - pip install codecov check-manifest --upgrade
21 - sudo apt-get install graphviz
21 - sudo apt-get install graphviz
22 script:
22 script:
23 - check-manifest
23 - check-manifest
24 - cd /tmp && iptest --coverage xml && cd -
24 - cd /tmp && iptest --coverage xml && cd -
25 # On the latest Python only, make sure that the docs build.
25 # On the latest Python only, make sure that the docs build.
26 - |
26 - |
27 if [[ "$TRAVIS_PYTHON_VERSION" == "3.6" ]]; then
27 if [[ "$TRAVIS_PYTHON_VERSION" == "3.6" ]]; then
28 pip install -r docs/requirements.txt
28 pip install -r docs/requirements.txt
29 make -C docs/ html SPHINXOPTS="-W"
29 make -C docs/ html SPHINXOPTS="-W"
30 fi
30 fi
31 after_success:
31 after_success:
32 - cp /tmp/ipy_coverage.xml ./
32 - cp /tmp/ipy_coverage.xml ./
33 - cp /tmp/.coverage ./
33 - cp /tmp/.coverage ./
34 - codecov
34 - codecov
35
35
36 matrix:
36 matrix:
37 allow_failures:
37 allow_failures:
38 - python: nightly
38 - python: nightly
39
39
40 before_deploy:
40 before_deploy:
41 - rm -rf dist/
41 - rm -rf dist/
42 - python setup.py sdist
42 - python setup.py sdist
43 - python setup.py bdist_wheel
43 - python setup.py bdist_wheel
44
44
45 deploy:
45 deploy:
46 provider: releases
46 provider: releases
47 api_key:
47 api_key:
48 secure: Y/Ae9tYs5aoBU8bDjN2YrwGG6tCbezj/h3Lcmtx8HQavSbBgXnhnZVRb2snOKD7auqnqjfT/7QMm4ZyKvaOEgyggGktKqEKYHC8KOZ7yp8I5/UMDtk6j9TnXpSqqBxPiud4MDV76SfRYEQiaDoG4tGGvSfPJ9KcNjKrNvSyyxns=
48 secure: Y/Ae9tYs5aoBU8bDjN2YrwGG6tCbezj/h3Lcmtx8HQavSbBgXnhnZVRb2snOKD7auqnqjfT/7QMm4ZyKvaOEgyggGktKqEKYHC8KOZ7yp8I5/UMDtk6j9TnXpSqqBxPiud4MDV76SfRYEQiaDoG4tGGvSfPJ9KcNjKrNvSyyxns=
49 file: dist/*
49 file: dist/*
50 file_glob: true
50 file_glob: true
51 skip_cleanup: true
51 skip_cleanup: true
52 on:
52 on:
53 repo: ipython/ipython
53 repo: ipython/ipython
54 all_branches: true # Backports are released from e.g. 5.x branch
54 all_branches: true # Backports are released from e.g. 5.x branch
55 tags: true
55 tags: true
56 python: 3.6 # Any version should work, but we only need one
56 python: 3.6 # Any version should work, but we only need one
@@ -1,151 +1,151 b''
1 # encoding: utf-8
1 # encoding: utf-8
2 """
2 """
3 IPython: tools for interactive and parallel computing in Python.
3 IPython: tools for interactive and parallel computing in Python.
4
4
5 https://ipython.org
5 https://ipython.org
6 """
6 """
7 #-----------------------------------------------------------------------------
7 #-----------------------------------------------------------------------------
8 # Copyright (c) 2008-2011, IPython Development Team.
8 # Copyright (c) 2008-2011, IPython Development Team.
9 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
9 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
10 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
10 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
11 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
11 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
12 #
12 #
13 # Distributed under the terms of the Modified BSD License.
13 # Distributed under the terms of the Modified BSD License.
14 #
14 #
15 # The full license is in the file COPYING.txt, distributed with this software.
15 # The full license is in the file COPYING.txt, distributed with this software.
16 #-----------------------------------------------------------------------------
16 #-----------------------------------------------------------------------------
17
17
18 #-----------------------------------------------------------------------------
18 #-----------------------------------------------------------------------------
19 # Imports
19 # Imports
20 #-----------------------------------------------------------------------------
20 #-----------------------------------------------------------------------------
21
21
22 import os
22 import os
23 import sys
23 import sys
24
24
25 #-----------------------------------------------------------------------------
25 #-----------------------------------------------------------------------------
26 # Setup everything
26 # Setup everything
27 #-----------------------------------------------------------------------------
27 #-----------------------------------------------------------------------------
28
28
29 # Don't forget to also update setup.py when this changes!
29 # Don't forget to also update setup.py when this changes!
30 if sys.version_info < (3,4):
30 if sys.version_info < (3, 5):
31 raise ImportError(
31 raise ImportError(
32 """
32 """
33 IPython 7.0+ supports Python 3.4 and above.
33 IPython 7.0+ supports Python 3.5 and above.
34 When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
34 When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
35 Python 3.3 was supported up to IPython 6.x.
35 Python 3.3 and 3.4 were supported up to IPython 6.x.
36
36
37 See IPython `README.rst` file for more information:
37 See IPython `README.rst` file for more information:
38
38
39 https://github.com/ipython/ipython/blob/master/README.rst
39 https://github.com/ipython/ipython/blob/master/README.rst
40
40
41 """)
41 """)
42
42
43 # Make it easy to import extensions - they are always directly on pythonpath.
43 # Make it easy to import extensions - they are always directly on pythonpath.
44 # Therefore, non-IPython modules can be added to extensions directory.
44 # Therefore, non-IPython modules can be added to extensions directory.
45 # This should probably be in ipapp.py.
45 # This should probably be in ipapp.py.
46 sys.path.append(os.path.join(os.path.dirname(__file__), "extensions"))
46 sys.path.append(os.path.join(os.path.dirname(__file__), "extensions"))
47
47
48 #-----------------------------------------------------------------------------
48 #-----------------------------------------------------------------------------
49 # Setup the top level names
49 # Setup the top level names
50 #-----------------------------------------------------------------------------
50 #-----------------------------------------------------------------------------
51
51
52 from .core.getipython import get_ipython
52 from .core.getipython import get_ipython
53 from .core import release
53 from .core import release
54 from .core.application import Application
54 from .core.application import Application
55 from .terminal.embed import embed
55 from .terminal.embed import embed
56
56
57 from .core.interactiveshell import InteractiveShell
57 from .core.interactiveshell import InteractiveShell
58 from .testing import test
58 from .testing import test
59 from .utils.sysinfo import sys_info
59 from .utils.sysinfo import sys_info
60 from .utils.frame import extract_module_locals
60 from .utils.frame import extract_module_locals
61
61
62 # Release data
62 # Release data
63 __author__ = '%s <%s>' % (release.author, release.author_email)
63 __author__ = '%s <%s>' % (release.author, release.author_email)
64 __license__ = release.license
64 __license__ = release.license
65 __version__ = release.version
65 __version__ = release.version
66 version_info = release.version_info
66 version_info = release.version_info
67
67
68 def embed_kernel(module=None, local_ns=None, **kwargs):
68 def embed_kernel(module=None, local_ns=None, **kwargs):
69 """Embed and start an IPython kernel in a given scope.
69 """Embed and start an IPython kernel in a given scope.
70
70
71 If you don't want the kernel to initialize the namespace
71 If you don't want the kernel to initialize the namespace
72 from the scope of the surrounding function,
72 from the scope of the surrounding function,
73 and/or you want to load full IPython configuration,
73 and/or you want to load full IPython configuration,
74 you probably want `IPython.start_kernel()` instead.
74 you probably want `IPython.start_kernel()` instead.
75
75
76 Parameters
76 Parameters
77 ----------
77 ----------
78 module : ModuleType, optional
78 module : ModuleType, optional
79 The module to load into IPython globals (default: caller)
79 The module to load into IPython globals (default: caller)
80 local_ns : dict, optional
80 local_ns : dict, optional
81 The namespace to load into IPython user namespace (default: caller)
81 The namespace to load into IPython user namespace (default: caller)
82
82
83 kwargs : various, optional
83 kwargs : various, optional
84 Further keyword args are relayed to the IPKernelApp constructor,
84 Further keyword args are relayed to the IPKernelApp constructor,
85 allowing configuration of the Kernel. Will only have an effect
85 allowing configuration of the Kernel. Will only have an effect
86 on the first embed_kernel call for a given process.
86 on the first embed_kernel call for a given process.
87 """
87 """
88
88
89 (caller_module, caller_locals) = extract_module_locals(1)
89 (caller_module, caller_locals) = extract_module_locals(1)
90 if module is None:
90 if module is None:
91 module = caller_module
91 module = caller_module
92 if local_ns is None:
92 if local_ns is None:
93 local_ns = caller_locals
93 local_ns = caller_locals
94
94
95 # Only import .zmq when we really need it
95 # Only import .zmq when we really need it
96 from ipykernel.embed import embed_kernel as real_embed_kernel
96 from ipykernel.embed import embed_kernel as real_embed_kernel
97 real_embed_kernel(module=module, local_ns=local_ns, **kwargs)
97 real_embed_kernel(module=module, local_ns=local_ns, **kwargs)
98
98
99 def start_ipython(argv=None, **kwargs):
99 def start_ipython(argv=None, **kwargs):
100 """Launch a normal IPython instance (as opposed to embedded)
100 """Launch a normal IPython instance (as opposed to embedded)
101
101
102 `IPython.embed()` puts a shell in a particular calling scope,
102 `IPython.embed()` puts a shell in a particular calling scope,
103 such as a function or method for debugging purposes,
103 such as a function or method for debugging purposes,
104 which is often not desirable.
104 which is often not desirable.
105
105
106 `start_ipython()` does full, regular IPython initialization,
106 `start_ipython()` does full, regular IPython initialization,
107 including loading startup files, configuration, etc.
107 including loading startup files, configuration, etc.
108 much of which is skipped by `embed()`.
108 much of which is skipped by `embed()`.
109
109
110 This is a public API method, and will survive implementation changes.
110 This is a public API method, and will survive implementation changes.
111
111
112 Parameters
112 Parameters
113 ----------
113 ----------
114
114
115 argv : list or None, optional
115 argv : list or None, optional
116 If unspecified or None, IPython will parse command-line options from sys.argv.
116 If unspecified or None, IPython will parse command-line options from sys.argv.
117 To prevent any command-line parsing, pass an empty list: `argv=[]`.
117 To prevent any command-line parsing, pass an empty list: `argv=[]`.
118 user_ns : dict, optional
118 user_ns : dict, optional
119 specify this dictionary to initialize the IPython user namespace with particular values.
119 specify this dictionary to initialize the IPython user namespace with particular values.
120 kwargs : various, optional
120 kwargs : various, optional
121 Any other kwargs will be passed to the Application constructor,
121 Any other kwargs will be passed to the Application constructor,
122 such as `config`.
122 such as `config`.
123 """
123 """
124 from IPython.terminal.ipapp import launch_new_instance
124 from IPython.terminal.ipapp import launch_new_instance
125 return launch_new_instance(argv=argv, **kwargs)
125 return launch_new_instance(argv=argv, **kwargs)
126
126
127 def start_kernel(argv=None, **kwargs):
127 def start_kernel(argv=None, **kwargs):
128 """Launch a normal IPython kernel instance (as opposed to embedded)
128 """Launch a normal IPython kernel instance (as opposed to embedded)
129
129
130 `IPython.embed_kernel()` puts a shell in a particular calling scope,
130 `IPython.embed_kernel()` puts a shell in a particular calling scope,
131 such as a function or method for debugging purposes,
131 such as a function or method for debugging purposes,
132 which is often not desirable.
132 which is often not desirable.
133
133
134 `start_kernel()` does full, regular IPython initialization,
134 `start_kernel()` does full, regular IPython initialization,
135 including loading startup files, configuration, etc.
135 including loading startup files, configuration, etc.
136 much of which is skipped by `embed()`.
136 much of which is skipped by `embed()`.
137
137
138 Parameters
138 Parameters
139 ----------
139 ----------
140
140
141 argv : list or None, optional
141 argv : list or None, optional
142 If unspecified or None, IPython will parse command-line options from sys.argv.
142 If unspecified or None, IPython will parse command-line options from sys.argv.
143 To prevent any command-line parsing, pass an empty list: `argv=[]`.
143 To prevent any command-line parsing, pass an empty list: `argv=[]`.
144 user_ns : dict, optional
144 user_ns : dict, optional
145 specify this dictionary to initialize the IPython user namespace with particular values.
145 specify this dictionary to initialize the IPython user namespace with particular values.
146 kwargs : various, optional
146 kwargs : various, optional
147 Any other kwargs will be passed to the Application constructor,
147 Any other kwargs will be passed to the Application constructor,
148 such as `config`.
148 such as `config`.
149 """
149 """
150 from IPython.kernel.zmq.kernelapp import launch_new_instance
150 from IPython.kernel.zmq.kernelapp import launch_new_instance
151 return launch_new_instance(argv=argv, **kwargs)
151 return launch_new_instance(argv=argv, **kwargs)
@@ -1,150 +1,44 b''
1 =====================
1 =====================
2 Development version
2 Development version
3 =====================
3 =====================
4
4
5 This document describes in-flight development work.
5 This document describes in-flight development work.
6
6
7 .. warning::
7 .. warning::
8
8
9 Please do not edit this file by hand (doing so will likely cause merge
9 Please do not edit this file by hand (doing so will likely cause merge
10 conflicts for other Pull Requests). Instead, create a new file in the
10 conflicts for other Pull Requests). Instead, create a new file in the
11 `docs/source/whatsnew/pr` folder
11 `docs/source/whatsnew/pr` folder
12
12
13
13
14 Released .... ...., 2017
14 Released .... ...., 2017
15
15
16
16
17 Need to be updated:
17 Need to be updated:
18
18
19 .. toctree::
19 .. toctree::
20 :maxdepth: 2
20 :maxdepth: 2
21 :glob:
21 :glob:
22
22
23 pr/*
23 pr/*
24
24
25 IPython 6 feature a major improvement in the completion machinery which is now
25 IPython 6 feature a major improvement in the completion machinery which is now
26 capable of completing non-executed code. It is also the first version of IPython
26 capable of completing non-executed code. It is also the first version of IPython
27 to stop compatibility with Python 2, which is still supported on the bugfix only
27 to stop compatibility with Python 2, which is still supported on the bugfix only
28 5.x branch. Read below to have a non-exhaustive list of new features.
28 5.x branch. Read below to have a non-exhaustive list of new features.
29
29
30 Make sure you have pip > 9.0 before upgrading.
30 Make sure you have pip > 9.0 before upgrading.
31 You should be able to update by using:
31 You should be able to update by using:
32
32
33 .. code::
33 .. code::
34
34
35 pip install ipython --upgrade
35 pip install ipython --upgrade
36
36
37 New completion API and Interface
38 --------------------------------
39
40 The completer Completion API has seen an overhaul, and the new completer have
41 plenty of improvement both from the end users of terminal IPython or for
42 consumers of the API.
43
44 This new API is capable of pulling completions from :any:`jedi`, thus allowing
45 type inference on non-executed code. If :any:`jedi` is installed completion like
46 the following are now becoming possible without code evaluation:
47
48 >>> data = ['Number of users', 123_456]
49 ... data[0].<tab>
50
51 That is to say, IPython is now capable of inferring that `data[0]` is a string,
52 and will suggest completions like `.capitalize`. The completion power of IPython
53 will increase with new Jedi releases, and a number of bugs and more completions
54 are already available on development version of :any:`jedi` if you are curious.
55
56 With the help of prompt toolkit, types of completions can be shown in the
57 completer interface:
58
59 .. image:: ../_images/jedi_type_inference_60.png
60 :alt: Jedi showing ability to do type inference
61 :align: center
62 :width: 400px
63 :target: ../_images/jedi_type_inference_60.png
64
65 The appearance of the completer is controlled by the
66 ``c.TerminalInteractiveShell.display_completions`` option that will show the
67 type differently depending on the value among ``'column'``, ``'multicolumn'``
68 and ``'readlinelike'``
69
70 The use of Jedi also full fill a number of request and fix a number of bugs
71 like case insensitive completion, completion after division operator: See
72 :ghpull:`10182`.
73
74 Extra patches and updates will be needed to the :mod:`ipykernel` package for
75 this feature to be available to other clients like jupyter Notebook, Lab,
76 Nteract, Hydrogen...
77
78 The use of Jedi can is barely noticeable on recent enough machines, but can be
79 feel on older ones, in cases were Jedi behavior need to be adjusted, the amount
80 of time given to Jedi to compute type inference can be adjusted with
81 ``c.IPCompleter.jedi_compute_type_timeout``, with object whose type were not
82 inferred will be shown as ``<unknown>``. Jedi can also be completely deactivated
83 by using the ``c.Completer.use_jedi=False`` option.
84
85
86 The old ``Completer.complete()`` API is waiting deprecation and should be
87 replaced replaced by ``Completer.completions()`` in a near future. Feedback on
88 the current state of the API and suggestions welcome.
89
90 Python 3 only codebase
91 ----------------------
92
93 One of the large challenges in IPython 6.0 has been the adoption of a pure
94 Python 3 code base, which lead us to great length to upstream patches in pip,
95 pypi and warehouse to make sure Python 2 system still upgrade to the latest
96 compatible Python version compatible.
97
98 We remind our Python 2 users that IPython 5 is still compatible with Python 2.7,
99 still maintained and get regular releases. Using pip 9+, upgrading IPython will
100 automatically upgrade to the latest version compatible with your system.
101
102 .. warning::
103
104 If you are on a system using an older verison of pip on Python 2, pip may
105 still install IPython 6.0 on your system, and IPython will refuse to start.
106 You can fix this by ugrading pip, and reinstalling ipython, or forcing pip to
107 install an earlier version: ``pip install 'ipython<6'``
108
109 The ability to use only Python 3 on the code base of IPython has bring a number
110 of advantage. Most of the newly written code make use of `optional function type
111 anotation <https://www.python.org/dev/peps/pep-0484/>`_ leading to clearer code
112 and better documentation.
113
114 The total size of the repository has also for a first time between releases
115 (excluding the big split for 4.0) decreased by about 1500 lines, potentially
116 quite a bit more codewide as some documents like this one are append only and
117 are about 300 lines long.
118
119 The removal as of Python2/Python3 shim layer has made the code quite clearer and
120 more idiomatic in a number of location, and much friendlier to work with and
121 understand. We hope to further embrace Python 3 capability in the next release
122 cycle and introduce more of the Python 3 only idioms (yield from, kwarg only,
123 general unpacking) in the code base of IPython, and see if we can take advantage
124 of these as well to improve user experience with better error messages and
125 hints.
126
127
128 Miscs improvements
129 ------------------
130
131
132 - The :cellmagic:`capture` magic can now capture the result of a cell (from an
133 expression on the last line), as well as printed and displayed output.
134 :ghpull:`9851`.
135
136 - Pressing Ctrl-Z in the terminal debugger now suspends IPython, as it already
137 does in the main terminal prompt.
138
139 - autoreload can now reload ``Enum``. See :ghissue:`10232` and :ghpull:`10316`
140
141 - IPython.display has gained a :any:`GeoJSON <IPython.display.GeoJSON>` object.
142 :ghpull:`10288` and :ghpull:`10253`
143
37
144 .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT.
38 .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT.
145
39
146
40
147 Backwards incompatible changes
41 Backwards incompatible changes
148 ------------------------------
42 ------------------------------
149
43
150 .. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT.
44 .. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT.
@@ -1,265 +1,264 b''
1 #!/usr/bin/env python3
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
2 # -*- coding: utf-8 -*-
3 """Setup script for IPython.
3 """Setup script for IPython.
4
4
5 Under Posix environments it works like a typical setup.py script.
5 Under Posix environments it works like a typical setup.py script.
6 Under Windows, the command sdist is not supported, since IPython
6 Under Windows, the command sdist is not supported, since IPython
7 requires utilities which are not available under Windows."""
7 requires utilities which are not available under Windows."""
8
8
9 #-----------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
10 # Copyright (c) 2008-2011, IPython Development Team.
10 # Copyright (c) 2008-2011, IPython Development Team.
11 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
11 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
12 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
12 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
13 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
13 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
14 #
14 #
15 # Distributed under the terms of the Modified BSD License.
15 # Distributed under the terms of the Modified BSD License.
16 #
16 #
17 # The full license is in the file COPYING.rst, distributed with this software.
17 # The full license is in the file COPYING.rst, distributed with this software.
18 #-----------------------------------------------------------------------------
18 #-----------------------------------------------------------------------------
19
19
20 from __future__ import print_function
20 from __future__ import print_function
21
21
22 import os
22 import os
23 import sys
23 import sys
24
24
25 # **Python version check**
25 # **Python version check**
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 if sys.version_info < (3, 4):
29 if sys.version_info < (3, 5):
30 pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.'
30 pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.'
31 try:
31 try:
32 import pip
32 import pip
33 pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]])
33 pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]])
34 if pip_version < (9, 0, 1) :
34 if pip_version < (9, 0, 1) :
35 pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\
35 pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\
36 'pip {} detected.'.format(pip.__version__)
36 'pip {} detected.'.format(pip.__version__)
37 else:
37 else:
38 # pip is new enough - it must be something else
38 # pip is new enough - it must be something else
39 pip_message = ''
39 pip_message = ''
40 except Exception:
40 except Exception:
41 pass
41 pass
42
42
43
43
44 error = """
44 error = """
45 IPython 7.0+ supports Python 3.4 and above.
45 IPython 7.0+ supports Python 3.5 and above.
46 When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
46 When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
47 Python 3.3 was supported up to IPython 6.x.
47 Python 3.3 and 3.4 were supported up to IPython 6.x.
48
48
49 See IPython `README.rst` file for more information:
49 See IPython `README.rst` file for more information:
50
50
51 https://github.com/ipython/ipython/blob/master/README.rst
51 https://github.com/ipython/ipython/blob/master/README.rst
52
52
53 Python {py} detected.
53 Python {py} detected.
54 {pip}
54 {pip}
55 """.format(py=sys.version_info, pip=pip_message )
55 """.format(py=sys.version_info, pip=pip_message )
56
56
57 print(error, file=sys.stderr)
57 print(error, file=sys.stderr)
58 sys.exit(1)
58 sys.exit(1)
59
59
60 # At least we're on the python version we need, move on.
60 # At least we're on the python version we need, move on.
61
61
62 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
62 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
63 # update it when the contents of directories change.
63 # update it when the contents of directories change.
64 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
64 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
65
65
66 from distutils.core import setup
66 from distutils.core import setup
67
67
68 # Our own imports
68 # Our own imports
69 from setupbase import target_update
69 from setupbase import target_update
70
70
71 from setupbase import (
71 from setupbase import (
72 setup_args,
72 setup_args,
73 find_packages,
73 find_packages,
74 find_package_data,
74 find_package_data,
75 check_package_data_first,
75 check_package_data_first,
76 find_entry_points,
76 find_entry_points,
77 build_scripts_entrypt,
77 build_scripts_entrypt,
78 find_data_files,
78 find_data_files,
79 git_prebuild,
79 git_prebuild,
80 install_symlinked,
80 install_symlinked,
81 install_lib_symlink,
81 install_lib_symlink,
82 install_scripts_for_symlink,
82 install_scripts_for_symlink,
83 unsymlink,
83 unsymlink,
84 )
84 )
85
85
86 isfile = os.path.isfile
86 isfile = os.path.isfile
87 pjoin = os.path.join
87 pjoin = os.path.join
88
88
89 #-------------------------------------------------------------------------------
89 #-------------------------------------------------------------------------------
90 # Handle OS specific things
90 # Handle OS specific things
91 #-------------------------------------------------------------------------------
91 #-------------------------------------------------------------------------------
92
92
93 if os.name in ('nt','dos'):
93 if os.name in ('nt','dos'):
94 os_name = 'windows'
94 os_name = 'windows'
95 else:
95 else:
96 os_name = os.name
96 os_name = os.name
97
97
98 # Under Windows, 'sdist' has not been supported. Now that the docs build with
98 # Under Windows, 'sdist' has not been supported. Now that the docs build with
99 # Sphinx it might work, but let's not turn it on until someone confirms that it
99 # Sphinx it might work, but let's not turn it on until someone confirms that it
100 # actually works.
100 # actually works.
101 if os_name == 'windows' and 'sdist' in sys.argv:
101 if os_name == 'windows' and 'sdist' in sys.argv:
102 print('The sdist command is not available under Windows. Exiting.')
102 print('The sdist command is not available under Windows. Exiting.')
103 sys.exit(1)
103 sys.exit(1)
104
104
105
105
106 #-------------------------------------------------------------------------------
106 #-------------------------------------------------------------------------------
107 # Things related to the IPython documentation
107 # Things related to the IPython documentation
108 #-------------------------------------------------------------------------------
108 #-------------------------------------------------------------------------------
109
109
110 # update the manuals when building a source dist
110 # update the manuals when building a source dist
111 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
111 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
112
112
113 # List of things to be updated. Each entry is a triplet of args for
113 # List of things to be updated. Each entry is a triplet of args for
114 # target_update()
114 # target_update()
115 to_update = [
115 to_update = [
116 ('docs/man/ipython.1.gz',
116 ('docs/man/ipython.1.gz',
117 ['docs/man/ipython.1'],
117 ['docs/man/ipython.1'],
118 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
118 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
119 ]
119 ]
120
120
121
121
122 [ target_update(*t) for t in to_update ]
122 [ target_update(*t) for t in to_update ]
123
123
124 #---------------------------------------------------------------------------
124 #---------------------------------------------------------------------------
125 # Find all the packages, package data, and data_files
125 # Find all the packages, package data, and data_files
126 #---------------------------------------------------------------------------
126 #---------------------------------------------------------------------------
127
127
128 packages = find_packages()
128 packages = find_packages()
129 package_data = find_package_data()
129 package_data = find_package_data()
130
130
131 data_files = find_data_files()
131 data_files = find_data_files()
132
132
133 setup_args['packages'] = packages
133 setup_args['packages'] = packages
134 setup_args['package_data'] = package_data
134 setup_args['package_data'] = package_data
135 setup_args['data_files'] = data_files
135 setup_args['data_files'] = data_files
136
136
137 #---------------------------------------------------------------------------
137 #---------------------------------------------------------------------------
138 # custom distutils commands
138 # custom distutils commands
139 #---------------------------------------------------------------------------
139 #---------------------------------------------------------------------------
140 # imports here, so they are after setuptools import if there was one
140 # imports here, so they are after setuptools import if there was one
141 from distutils.command.sdist import sdist
141 from distutils.command.sdist import sdist
142
142
143 setup_args['cmdclass'] = {
143 setup_args['cmdclass'] = {
144 'build_py': \
144 'build_py': \
145 check_package_data_first(git_prebuild('IPython')),
145 check_package_data_first(git_prebuild('IPython')),
146 'sdist' : git_prebuild('IPython', sdist),
146 'sdist' : git_prebuild('IPython', sdist),
147 'symlink': install_symlinked,
147 'symlink': install_symlinked,
148 'install_lib_symlink': install_lib_symlink,
148 'install_lib_symlink': install_lib_symlink,
149 'install_scripts_sym': install_scripts_for_symlink,
149 'install_scripts_sym': install_scripts_for_symlink,
150 'unsymlink': unsymlink,
150 'unsymlink': unsymlink,
151 }
151 }
152
152
153
153
154 #---------------------------------------------------------------------------
154 #---------------------------------------------------------------------------
155 # Handle scripts, dependencies, and setuptools specific things
155 # Handle scripts, dependencies, and setuptools specific things
156 #---------------------------------------------------------------------------
156 #---------------------------------------------------------------------------
157
157
158 # For some commands, use setuptools. Note that we do NOT list install here!
158 # For some commands, use setuptools. Note that we do NOT list install here!
159 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
159 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
160 needs_setuptools = {'develop', 'release', 'bdist_egg', 'bdist_rpm',
160 needs_setuptools = {'develop', 'release', 'bdist_egg', 'bdist_rpm',
161 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel',
161 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel',
162 'egg_info', 'easy_install', 'upload', 'install_egg_info',
162 'egg_info', 'easy_install', 'upload', 'install_egg_info',
163 }
163 }
164
164
165 if len(needs_setuptools.intersection(sys.argv)) > 0:
165 if len(needs_setuptools.intersection(sys.argv)) > 0:
166 import setuptools
166 import setuptools
167
167
168 # This dict is used for passing extra arguments that are setuptools
168 # This dict is used for passing extra arguments that are setuptools
169 # specific to setup
169 # specific to setup
170 setuptools_extra_args = {}
170 setuptools_extra_args = {}
171
171
172 # setuptools requirements
172 # setuptools requirements
173
173
174 extras_require = dict(
174 extras_require = dict(
175 parallel = ['ipyparallel'],
175 parallel = ['ipyparallel'],
176 qtconsole = ['qtconsole'],
176 qtconsole = ['qtconsole'],
177 doc = ['Sphinx>=1.3'],
177 doc = ['Sphinx>=1.3'],
178 test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments', 'nbformat', 'ipykernel', 'numpy'],
178 test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments', 'nbformat', 'ipykernel', 'numpy'],
179 terminal = [],
179 terminal = [],
180 kernel = ['ipykernel'],
180 kernel = ['ipykernel'],
181 nbformat = ['nbformat'],
181 nbformat = ['nbformat'],
182 notebook = ['notebook', 'ipywidgets'],
182 notebook = ['notebook', 'ipywidgets'],
183 nbconvert = ['nbconvert'],
183 nbconvert = ['nbconvert'],
184 )
184 )
185
185
186 install_requires = [
186 install_requires = [
187 'setuptools>=18.5',
187 'setuptools>=18.5',
188 'jedi>=0.10',
188 'jedi>=0.10',
189 'decorator',
189 'decorator',
190 'pickleshare',
190 'pickleshare',
191 'simplegeneric>0.8',
191 'simplegeneric>0.8',
192 'traitlets>=4.2',
192 'traitlets>=4.2',
193 'prompt_toolkit>=2.0.0,<2.1.0',
193 'prompt_toolkit>=2.0.0,<2.1.0',
194 'pygments',
194 'pygments',
195 'backcall',
195 'backcall',
196 ]
196 ]
197
197
198 # Platform-specific dependencies:
198 # Platform-specific dependencies:
199 # This is the correct way to specify these,
199 # This is the correct way to specify these,
200 # but requires pip >= 6. pip < 6 ignores these.
200 # but requires pip >= 6. pip < 6 ignores these.
201
201
202 extras_require.update({
202 extras_require.update({
203 ':python_version == "3.4"': ['typing'],
203 ':python_version == "3.4"': ['typing'],
204 ':python_version >= "3.5"': ['trio', 'curio'],
205 ':sys_platform != "win32"': ['pexpect'],
204 ':sys_platform != "win32"': ['pexpect'],
206 ':sys_platform == "darwin"': ['appnope'],
205 ':sys_platform == "darwin"': ['appnope'],
207 ':sys_platform == "win32"': ['colorama'],
206 ':sys_platform == "win32"': ['colorama'],
208 ':sys_platform == "win32" and python_version < "3.6"': ['win_unicode_console>=0.5'],
207 ':sys_platform == "win32" and python_version < "3.6"': ['win_unicode_console>=0.5'],
209 })
208 })
210 # FIXME: re-specify above platform dependencies for pip < 6
209 # FIXME: re-specify above platform dependencies for pip < 6
211 # These would result in non-portable bdists.
210 # These would result in non-portable bdists.
212 if not any(arg.startswith('bdist') for arg in sys.argv):
211 if not any(arg.startswith('bdist') for arg in sys.argv):
213 if sys.platform == 'darwin':
212 if sys.platform == 'darwin':
214 install_requires.extend(['appnope'])
213 install_requires.extend(['appnope'])
215
214
216 if not sys.platform.startswith('win'):
215 if not sys.platform.startswith('win'):
217 install_requires.append('pexpect')
216 install_requires.append('pexpect')
218
217
219 # workaround pypa/setuptools#147, where setuptools misspells
218 # workaround pypa/setuptools#147, where setuptools misspells
220 # platform_python_implementation as python_implementation
219 # platform_python_implementation as python_implementation
221 if 'setuptools' in sys.modules:
220 if 'setuptools' in sys.modules:
222 for key in list(extras_require):
221 for key in list(extras_require):
223 if 'platform_python_implementation' in key:
222 if 'platform_python_implementation' in key:
224 new_key = key.replace('platform_python_implementation', 'python_implementation')
223 new_key = key.replace('platform_python_implementation', 'python_implementation')
225 extras_require[new_key] = extras_require.pop(key)
224 extras_require[new_key] = extras_require.pop(key)
226
225
227 everything = set()
226 everything = set()
228 for key, deps in extras_require.items():
227 for key, deps in extras_require.items():
229 if ':' not in key:
228 if ':' not in key:
230 everything.update(deps)
229 everything.update(deps)
231 extras_require['all'] = everything
230 extras_require['all'] = everything
232
231
233 if 'setuptools' in sys.modules:
232 if 'setuptools' in sys.modules:
234 setuptools_extra_args['python_requires'] = '>=3.4'
233 setuptools_extra_args['python_requires'] = '>=3.5'
235 setuptools_extra_args['zip_safe'] = False
234 setuptools_extra_args['zip_safe'] = False
236 setuptools_extra_args['entry_points'] = {
235 setuptools_extra_args['entry_points'] = {
237 'console_scripts': find_entry_points(),
236 'console_scripts': find_entry_points(),
238 'pygments.lexers': [
237 'pygments.lexers': [
239 'ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer',
238 'ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer',
240 'ipython = IPython.lib.lexers:IPythonLexer',
239 'ipython = IPython.lib.lexers:IPythonLexer',
241 'ipython3 = IPython.lib.lexers:IPython3Lexer',
240 'ipython3 = IPython.lib.lexers:IPython3Lexer',
242 ],
241 ],
243 }
242 }
244 setup_args['extras_require'] = extras_require
243 setup_args['extras_require'] = extras_require
245 setup_args['install_requires'] = install_requires
244 setup_args['install_requires'] = install_requires
246
245
247 else:
246 else:
248 # scripts has to be a non-empty list, or install_scripts isn't called
247 # scripts has to be a non-empty list, or install_scripts isn't called
249 setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()]
248 setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()]
250
249
251 setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt
250 setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt
252
251
253 #---------------------------------------------------------------------------
252 #---------------------------------------------------------------------------
254 # Do the actual setup now
253 # Do the actual setup now
255 #---------------------------------------------------------------------------
254 #---------------------------------------------------------------------------
256
255
257 setup_args.update(setuptools_extra_args)
256 setup_args.update(setuptools_extra_args)
258
257
259
258
260
259
261 def main():
260 def main():
262 setup(**setup_args)
261 setup(**setup_args)
263
262
264 if __name__ == '__main__':
263 if __name__ == '__main__':
265 main()
264 main()
General Comments 0
You need to be logged in to leave comments. Login now