Show More
@@ -1,56 +1,56 b'' | |||
|
1 | 1 | # http://travis-ci.org/#!/ipython/ipython |
|
2 | 2 | language: python |
|
3 | 3 | python: |
|
4 | 4 | - "nightly" |
|
5 | 5 | - "3.7-dev" |
|
6 | - 3.7 | |
|
6 | 7 | - 3.6 |
|
7 | 8 | - 3.5 |
|
8 | - 3.4 | |
|
9 | 9 | sudo: false |
|
10 | 10 | env: |
|
11 | 11 | global: |
|
12 | 12 | - PATH=$TRAVIS_BUILD_DIR/pandoc:$PATH |
|
13 | 13 | group: edge |
|
14 | 14 | before_install: |
|
15 | 15 | - 'if [[ $GROUP != js* ]]; then COVERAGE=""; fi' |
|
16 | 16 | install: |
|
17 | 17 | - pip install pip --upgrade |
|
18 | 18 | - pip install setuptools --upgrade |
|
19 | 19 | - pip install -e file://$PWD#egg=ipython[test] --upgrade |
|
20 | 20 | - pip install codecov check-manifest --upgrade |
|
21 | 21 | - sudo apt-get install graphviz |
|
22 | 22 | script: |
|
23 | 23 | - check-manifest |
|
24 | 24 | - cd /tmp && iptest --coverage xml && cd - |
|
25 | 25 | # On the latest Python only, make sure that the docs build. |
|
26 | 26 | - | |
|
27 | 27 | if [[ "$TRAVIS_PYTHON_VERSION" == "3.6" ]]; then |
|
28 | 28 | pip install -r docs/requirements.txt |
|
29 | 29 | make -C docs/ html SPHINXOPTS="-W" |
|
30 | 30 | fi |
|
31 | 31 | after_success: |
|
32 | 32 | - cp /tmp/ipy_coverage.xml ./ |
|
33 | 33 | - cp /tmp/.coverage ./ |
|
34 | 34 | - codecov |
|
35 | 35 | |
|
36 | 36 | matrix: |
|
37 | 37 | allow_failures: |
|
38 | 38 | - python: nightly |
|
39 | 39 | |
|
40 | 40 | before_deploy: |
|
41 | 41 | - rm -rf dist/ |
|
42 | 42 | - python setup.py sdist |
|
43 | 43 | - python setup.py bdist_wheel |
|
44 | 44 | |
|
45 | 45 | deploy: |
|
46 | 46 | provider: releases |
|
47 | 47 | api_key: |
|
48 | 48 | secure: Y/Ae9tYs5aoBU8bDjN2YrwGG6tCbezj/h3Lcmtx8HQavSbBgXnhnZVRb2snOKD7auqnqjfT/7QMm4ZyKvaOEgyggGktKqEKYHC8KOZ7yp8I5/UMDtk6j9TnXpSqqBxPiud4MDV76SfRYEQiaDoG4tGGvSfPJ9KcNjKrNvSyyxns= |
|
49 | 49 | file: dist/* |
|
50 | 50 | file_glob: true |
|
51 | 51 | skip_cleanup: true |
|
52 | 52 | on: |
|
53 | 53 | repo: ipython/ipython |
|
54 | 54 | all_branches: true # Backports are released from e.g. 5.x branch |
|
55 | 55 | tags: true |
|
56 | 56 | python: 3.6 # Any version should work, but we only need one |
@@ -1,151 +1,151 b'' | |||
|
1 | 1 | # encoding: utf-8 |
|
2 | 2 | """ |
|
3 | 3 | IPython: tools for interactive and parallel computing in Python. |
|
4 | 4 | |
|
5 | 5 | https://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 | |
|
22 | 22 | import os |
|
23 | 23 | import sys |
|
24 | 24 | |
|
25 | 25 | #----------------------------------------------------------------------------- |
|
26 | 26 | # Setup everything |
|
27 | 27 | #----------------------------------------------------------------------------- |
|
28 | 28 | |
|
29 | 29 | # Don't forget to also update setup.py when this changes! |
|
30 |
if sys.version_info < (3, |
|
|
30 | if sys.version_info < (3, 5): | |
|
31 | 31 | raise ImportError( |
|
32 | 32 | """ |
|
33 |
IPython 7.0+ supports Python 3. |
|
|
33 | IPython 7.0+ supports Python 3.5 and above. | |
|
34 | 34 | When using Python 2.7, please install IPython 5.x LTS Long Term Support version. |
|
35 |
Python 3.3 |
|
|
35 | Python 3.3 and 3.4 were supported up to IPython 6.x. | |
|
36 | 36 | |
|
37 | 37 | See IPython `README.rst` file for more information: |
|
38 | 38 | |
|
39 | 39 | https://github.com/ipython/ipython/blob/master/README.rst |
|
40 | 40 | |
|
41 | 41 | """) |
|
42 | 42 | |
|
43 | 43 | # Make it easy to import extensions - they are always directly on pythonpath. |
|
44 | 44 | # Therefore, non-IPython modules can be added to extensions directory. |
|
45 | 45 | # This should probably be in ipapp.py. |
|
46 | 46 | sys.path.append(os.path.join(os.path.dirname(__file__), "extensions")) |
|
47 | 47 | |
|
48 | 48 | #----------------------------------------------------------------------------- |
|
49 | 49 | # Setup the top level names |
|
50 | 50 | #----------------------------------------------------------------------------- |
|
51 | 51 | |
|
52 | 52 | from .core.getipython import get_ipython |
|
53 | 53 | from .core import release |
|
54 | 54 | from .core.application import Application |
|
55 | 55 | from .terminal.embed import embed |
|
56 | 56 | |
|
57 | 57 | from .core.interactiveshell import InteractiveShell |
|
58 | 58 | from .testing import test |
|
59 | 59 | from .utils.sysinfo import sys_info |
|
60 | 60 | from .utils.frame import extract_module_locals |
|
61 | 61 | |
|
62 | 62 | # Release data |
|
63 | 63 | __author__ = '%s <%s>' % (release.author, release.author_email) |
|
64 | 64 | __license__ = release.license |
|
65 | 65 | __version__ = release.version |
|
66 | 66 | version_info = release.version_info |
|
67 | 67 | |
|
68 | 68 | def embed_kernel(module=None, local_ns=None, **kwargs): |
|
69 | 69 | """Embed and start an IPython kernel in a given scope. |
|
70 | 70 | |
|
71 | 71 | If you don't want the kernel to initialize the namespace |
|
72 | 72 | from the scope of the surrounding function, |
|
73 | 73 | and/or you want to load full IPython configuration, |
|
74 | 74 | you probably want `IPython.start_kernel()` instead. |
|
75 | 75 | |
|
76 | 76 | Parameters |
|
77 | 77 | ---------- |
|
78 | 78 | module : ModuleType, optional |
|
79 | 79 | The module to load into IPython globals (default: caller) |
|
80 | 80 | local_ns : dict, optional |
|
81 | 81 | The namespace to load into IPython user namespace (default: caller) |
|
82 | 82 | |
|
83 | 83 | kwargs : various, optional |
|
84 | 84 | Further keyword args are relayed to the IPKernelApp constructor, |
|
85 | 85 | allowing configuration of the Kernel. Will only have an effect |
|
86 | 86 | on the first embed_kernel call for a given process. |
|
87 | 87 | """ |
|
88 | 88 | |
|
89 | 89 | (caller_module, caller_locals) = extract_module_locals(1) |
|
90 | 90 | if module is None: |
|
91 | 91 | module = caller_module |
|
92 | 92 | if local_ns is None: |
|
93 | 93 | local_ns = caller_locals |
|
94 | 94 | |
|
95 | 95 | # Only import .zmq when we really need it |
|
96 | 96 | from ipykernel.embed import embed_kernel as real_embed_kernel |
|
97 | 97 | real_embed_kernel(module=module, local_ns=local_ns, **kwargs) |
|
98 | 98 | |
|
99 | 99 | def start_ipython(argv=None, **kwargs): |
|
100 | 100 | """Launch a normal IPython instance (as opposed to embedded) |
|
101 | 101 | |
|
102 | 102 | `IPython.embed()` puts a shell in a particular calling scope, |
|
103 | 103 | such as a function or method for debugging purposes, |
|
104 | 104 | which is often not desirable. |
|
105 | 105 | |
|
106 | 106 | `start_ipython()` does full, regular IPython initialization, |
|
107 | 107 | including loading startup files, configuration, etc. |
|
108 | 108 | much of which is skipped by `embed()`. |
|
109 | 109 | |
|
110 | 110 | This is a public API method, and will survive implementation changes. |
|
111 | 111 | |
|
112 | 112 | Parameters |
|
113 | 113 | ---------- |
|
114 | 114 | |
|
115 | 115 | argv : list or None, optional |
|
116 | 116 | If unspecified or None, IPython will parse command-line options from sys.argv. |
|
117 | 117 | To prevent any command-line parsing, pass an empty list: `argv=[]`. |
|
118 | 118 | user_ns : dict, optional |
|
119 | 119 | specify this dictionary to initialize the IPython user namespace with particular values. |
|
120 | 120 | kwargs : various, optional |
|
121 | 121 | Any other kwargs will be passed to the Application constructor, |
|
122 | 122 | such as `config`. |
|
123 | 123 | """ |
|
124 | 124 | from IPython.terminal.ipapp import launch_new_instance |
|
125 | 125 | return launch_new_instance(argv=argv, **kwargs) |
|
126 | 126 | |
|
127 | 127 | def start_kernel(argv=None, **kwargs): |
|
128 | 128 | """Launch a normal IPython kernel instance (as opposed to embedded) |
|
129 | 129 | |
|
130 | 130 | `IPython.embed_kernel()` puts a shell in a particular calling scope, |
|
131 | 131 | such as a function or method for debugging purposes, |
|
132 | 132 | which is often not desirable. |
|
133 | 133 | |
|
134 | 134 | `start_kernel()` does full, regular IPython initialization, |
|
135 | 135 | including loading startup files, configuration, etc. |
|
136 | 136 | much of which is skipped by `embed()`. |
|
137 | 137 | |
|
138 | 138 | Parameters |
|
139 | 139 | ---------- |
|
140 | 140 | |
|
141 | 141 | argv : list or None, optional |
|
142 | 142 | If unspecified or None, IPython will parse command-line options from sys.argv. |
|
143 | 143 | To prevent any command-line parsing, pass an empty list: `argv=[]`. |
|
144 | 144 | user_ns : dict, optional |
|
145 | 145 | specify this dictionary to initialize the IPython user namespace with particular values. |
|
146 | 146 | kwargs : various, optional |
|
147 | 147 | Any other kwargs will be passed to the Application constructor, |
|
148 | 148 | such as `config`. |
|
149 | 149 | """ |
|
150 | 150 | from IPython.kernel.zmq.kernelapp import launch_new_instance |
|
151 | 151 | return launch_new_instance(argv=argv, **kwargs) |
@@ -1,150 +1,44 b'' | |||
|
1 | 1 | ===================== |
|
2 | 2 | Development version |
|
3 | 3 | ===================== |
|
4 | 4 | |
|
5 | 5 | This document describes in-flight development work. |
|
6 | 6 | |
|
7 | 7 | .. warning:: |
|
8 | 8 | |
|
9 | 9 | Please do not edit this file by hand (doing so will likely cause merge |
|
10 | 10 | conflicts for other Pull Requests). Instead, create a new file in the |
|
11 | 11 | `docs/source/whatsnew/pr` folder |
|
12 | 12 | |
|
13 | 13 | |
|
14 | 14 | Released .... ...., 2017 |
|
15 | 15 | |
|
16 | 16 | |
|
17 | 17 | Need to be updated: |
|
18 | 18 | |
|
19 | 19 | .. toctree:: |
|
20 | 20 | :maxdepth: 2 |
|
21 | 21 | :glob: |
|
22 | 22 | |
|
23 | 23 | pr/* |
|
24 | 24 | |
|
25 | 25 | IPython 6 feature a major improvement in the completion machinery which is now |
|
26 | 26 | capable of completing non-executed code. It is also the first version of IPython |
|
27 | 27 | to stop compatibility with Python 2, which is still supported on the bugfix only |
|
28 | 28 | 5.x branch. Read below to have a non-exhaustive list of new features. |
|
29 | 29 | |
|
30 | 30 | Make sure you have pip > 9.0 before upgrading. |
|
31 | 31 | You should be able to update by using: |
|
32 | 32 | |
|
33 | 33 | .. code:: |
|
34 | 34 | |
|
35 | 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 | 38 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT. |
|
145 | 39 | |
|
146 | 40 | |
|
147 | 41 | Backwards incompatible changes |
|
148 | 42 | ------------------------------ |
|
149 | 43 | |
|
150 | 44 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT. |
@@ -1,265 +1,264 b'' | |||
|
1 | 1 | #!/usr/bin/env python3 |
|
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 | from __future__ import print_function |
|
21 | 21 | |
|
22 | 22 | import os |
|
23 | 23 | import sys |
|
24 | 24 | |
|
25 | 25 | # **Python version check** |
|
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 |
if sys.version_info < (3, |
|
|
29 | if sys.version_info < (3, 5): | |
|
30 | 30 | pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.' |
|
31 | 31 | try: |
|
32 | 32 | import pip |
|
33 | 33 | pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]]) |
|
34 | 34 | if pip_version < (9, 0, 1) : |
|
35 | 35 | pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\ |
|
36 | 36 | 'pip {} detected.'.format(pip.__version__) |
|
37 | 37 | else: |
|
38 | 38 | # pip is new enough - it must be something else |
|
39 | 39 | pip_message = '' |
|
40 | 40 | except Exception: |
|
41 | 41 | pass |
|
42 | 42 | |
|
43 | 43 | |
|
44 | 44 | error = """ |
|
45 |
IPython 7.0+ supports Python 3. |
|
|
45 | IPython 7.0+ supports Python 3.5 and above. | |
|
46 | 46 | When using Python 2.7, please install IPython 5.x LTS Long Term Support version. |
|
47 |
Python 3.3 |
|
|
47 | Python 3.3 and 3.4 were supported up to IPython 6.x. | |
|
48 | 48 | |
|
49 | 49 | See IPython `README.rst` file for more information: |
|
50 | 50 | |
|
51 | 51 | https://github.com/ipython/ipython/blob/master/README.rst |
|
52 | 52 | |
|
53 | 53 | Python {py} detected. |
|
54 | 54 | {pip} |
|
55 | 55 | """.format(py=sys.version_info, pip=pip_message ) |
|
56 | 56 | |
|
57 | 57 | print(error, file=sys.stderr) |
|
58 | 58 | sys.exit(1) |
|
59 | 59 | |
|
60 | 60 | # At least we're on the python version we need, move on. |
|
61 | 61 | |
|
62 | 62 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly |
|
63 | 63 | # update it when the contents of directories change. |
|
64 | 64 | if os.path.exists('MANIFEST'): os.remove('MANIFEST') |
|
65 | 65 | |
|
66 | 66 | from distutils.core import setup |
|
67 | 67 | |
|
68 | 68 | # Our own imports |
|
69 | 69 | from setupbase import target_update |
|
70 | 70 | |
|
71 | 71 | from setupbase import ( |
|
72 | 72 | setup_args, |
|
73 | 73 | find_packages, |
|
74 | 74 | find_package_data, |
|
75 | 75 | check_package_data_first, |
|
76 | 76 | find_entry_points, |
|
77 | 77 | build_scripts_entrypt, |
|
78 | 78 | find_data_files, |
|
79 | 79 | git_prebuild, |
|
80 | 80 | install_symlinked, |
|
81 | 81 | install_lib_symlink, |
|
82 | 82 | install_scripts_for_symlink, |
|
83 | 83 | unsymlink, |
|
84 | 84 | ) |
|
85 | 85 | |
|
86 | 86 | isfile = os.path.isfile |
|
87 | 87 | pjoin = os.path.join |
|
88 | 88 | |
|
89 | 89 | #------------------------------------------------------------------------------- |
|
90 | 90 | # Handle OS specific things |
|
91 | 91 | #------------------------------------------------------------------------------- |
|
92 | 92 | |
|
93 | 93 | if os.name in ('nt','dos'): |
|
94 | 94 | os_name = 'windows' |
|
95 | 95 | else: |
|
96 | 96 | os_name = os.name |
|
97 | 97 | |
|
98 | 98 | # Under Windows, 'sdist' has not been supported. Now that the docs build with |
|
99 | 99 | # Sphinx it might work, but let's not turn it on until someone confirms that it |
|
100 | 100 | # actually works. |
|
101 | 101 | if os_name == 'windows' and 'sdist' in sys.argv: |
|
102 | 102 | print('The sdist command is not available under Windows. Exiting.') |
|
103 | 103 | sys.exit(1) |
|
104 | 104 | |
|
105 | 105 | |
|
106 | 106 | #------------------------------------------------------------------------------- |
|
107 | 107 | # Things related to the IPython documentation |
|
108 | 108 | #------------------------------------------------------------------------------- |
|
109 | 109 | |
|
110 | 110 | # update the manuals when building a source dist |
|
111 | 111 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): |
|
112 | 112 | |
|
113 | 113 | # List of things to be updated. Each entry is a triplet of args for |
|
114 | 114 | # target_update() |
|
115 | 115 | to_update = [ |
|
116 | 116 | ('docs/man/ipython.1.gz', |
|
117 | 117 | ['docs/man/ipython.1'], |
|
118 | 118 | 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'), |
|
119 | 119 | ] |
|
120 | 120 | |
|
121 | 121 | |
|
122 | 122 | [ target_update(*t) for t in to_update ] |
|
123 | 123 | |
|
124 | 124 | #--------------------------------------------------------------------------- |
|
125 | 125 | # Find all the packages, package data, and data_files |
|
126 | 126 | #--------------------------------------------------------------------------- |
|
127 | 127 | |
|
128 | 128 | packages = find_packages() |
|
129 | 129 | package_data = find_package_data() |
|
130 | 130 | |
|
131 | 131 | data_files = find_data_files() |
|
132 | 132 | |
|
133 | 133 | setup_args['packages'] = packages |
|
134 | 134 | setup_args['package_data'] = package_data |
|
135 | 135 | setup_args['data_files'] = data_files |
|
136 | 136 | |
|
137 | 137 | #--------------------------------------------------------------------------- |
|
138 | 138 | # custom distutils commands |
|
139 | 139 | #--------------------------------------------------------------------------- |
|
140 | 140 | # imports here, so they are after setuptools import if there was one |
|
141 | 141 | from distutils.command.sdist import sdist |
|
142 | 142 | |
|
143 | 143 | setup_args['cmdclass'] = { |
|
144 | 144 | 'build_py': \ |
|
145 | 145 | check_package_data_first(git_prebuild('IPython')), |
|
146 | 146 | 'sdist' : git_prebuild('IPython', sdist), |
|
147 | 147 | 'symlink': install_symlinked, |
|
148 | 148 | 'install_lib_symlink': install_lib_symlink, |
|
149 | 149 | 'install_scripts_sym': install_scripts_for_symlink, |
|
150 | 150 | 'unsymlink': unsymlink, |
|
151 | 151 | } |
|
152 | 152 | |
|
153 | 153 | |
|
154 | 154 | #--------------------------------------------------------------------------- |
|
155 | 155 | # Handle scripts, dependencies, and setuptools specific things |
|
156 | 156 | #--------------------------------------------------------------------------- |
|
157 | 157 | |
|
158 | 158 | # For some commands, use setuptools. Note that we do NOT list install here! |
|
159 | 159 | # If you want a setuptools-enhanced install, just run 'setupegg.py install' |
|
160 | 160 | needs_setuptools = {'develop', 'release', 'bdist_egg', 'bdist_rpm', |
|
161 | 161 | 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel', |
|
162 | 162 | 'egg_info', 'easy_install', 'upload', 'install_egg_info', |
|
163 | 163 | } |
|
164 | 164 | |
|
165 | 165 | if len(needs_setuptools.intersection(sys.argv)) > 0: |
|
166 | 166 | import setuptools |
|
167 | 167 | |
|
168 | 168 | # This dict is used for passing extra arguments that are setuptools |
|
169 | 169 | # specific to setup |
|
170 | 170 | setuptools_extra_args = {} |
|
171 | 171 | |
|
172 | 172 | # setuptools requirements |
|
173 | 173 | |
|
174 | 174 | extras_require = dict( |
|
175 | 175 | parallel = ['ipyparallel'], |
|
176 | 176 | qtconsole = ['qtconsole'], |
|
177 | 177 | doc = ['Sphinx>=1.3'], |
|
178 | 178 | test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments', 'nbformat', 'ipykernel', 'numpy'], |
|
179 | 179 | terminal = [], |
|
180 | 180 | kernel = ['ipykernel'], |
|
181 | 181 | nbformat = ['nbformat'], |
|
182 | 182 | notebook = ['notebook', 'ipywidgets'], |
|
183 | 183 | nbconvert = ['nbconvert'], |
|
184 | 184 | ) |
|
185 | 185 | |
|
186 | 186 | install_requires = [ |
|
187 | 187 | 'setuptools>=18.5', |
|
188 | 188 | 'jedi>=0.10', |
|
189 | 189 | 'decorator', |
|
190 | 190 | 'pickleshare', |
|
191 | 191 | 'simplegeneric>0.8', |
|
192 | 192 | 'traitlets>=4.2', |
|
193 | 193 | 'prompt_toolkit>=2.0.0,<2.1.0', |
|
194 | 194 | 'pygments', |
|
195 | 195 | 'backcall', |
|
196 | 196 | ] |
|
197 | 197 | |
|
198 | 198 | # Platform-specific dependencies: |
|
199 | 199 | # This is the correct way to specify these, |
|
200 | 200 | # but requires pip >= 6. pip < 6 ignores these. |
|
201 | 201 | |
|
202 | 202 | extras_require.update({ |
|
203 | 203 | ':python_version == "3.4"': ['typing'], |
|
204 | ':python_version >= "3.5"': ['trio', 'curio'], | |
|
205 | 204 | ':sys_platform != "win32"': ['pexpect'], |
|
206 | 205 | ':sys_platform == "darwin"': ['appnope'], |
|
207 | 206 | ':sys_platform == "win32"': ['colorama'], |
|
208 | 207 | ':sys_platform == "win32" and python_version < "3.6"': ['win_unicode_console>=0.5'], |
|
209 | 208 | }) |
|
210 | 209 | # FIXME: re-specify above platform dependencies for pip < 6 |
|
211 | 210 | # These would result in non-portable bdists. |
|
212 | 211 | if not any(arg.startswith('bdist') for arg in sys.argv): |
|
213 | 212 | if sys.platform == 'darwin': |
|
214 | 213 | install_requires.extend(['appnope']) |
|
215 | 214 | |
|
216 | 215 | if not sys.platform.startswith('win'): |
|
217 | 216 | install_requires.append('pexpect') |
|
218 | 217 | |
|
219 | 218 | # workaround pypa/setuptools#147, where setuptools misspells |
|
220 | 219 | # platform_python_implementation as python_implementation |
|
221 | 220 | if 'setuptools' in sys.modules: |
|
222 | 221 | for key in list(extras_require): |
|
223 | 222 | if 'platform_python_implementation' in key: |
|
224 | 223 | new_key = key.replace('platform_python_implementation', 'python_implementation') |
|
225 | 224 | extras_require[new_key] = extras_require.pop(key) |
|
226 | 225 | |
|
227 | 226 | everything = set() |
|
228 | 227 | for key, deps in extras_require.items(): |
|
229 | 228 | if ':' not in key: |
|
230 | 229 | everything.update(deps) |
|
231 | 230 | extras_require['all'] = everything |
|
232 | 231 | |
|
233 | 232 | if 'setuptools' in sys.modules: |
|
234 |
setuptools_extra_args['python_requires'] = '>=3. |
|
|
233 | setuptools_extra_args['python_requires'] = '>=3.5' | |
|
235 | 234 | setuptools_extra_args['zip_safe'] = False |
|
236 | 235 | setuptools_extra_args['entry_points'] = { |
|
237 | 236 | 'console_scripts': find_entry_points(), |
|
238 | 237 | 'pygments.lexers': [ |
|
239 | 238 | 'ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer', |
|
240 | 239 | 'ipython = IPython.lib.lexers:IPythonLexer', |
|
241 | 240 | 'ipython3 = IPython.lib.lexers:IPython3Lexer', |
|
242 | 241 | ], |
|
243 | 242 | } |
|
244 | 243 | setup_args['extras_require'] = extras_require |
|
245 | 244 | setup_args['install_requires'] = install_requires |
|
246 | 245 | |
|
247 | 246 | else: |
|
248 | 247 | # scripts has to be a non-empty list, or install_scripts isn't called |
|
249 | 248 | setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()] |
|
250 | 249 | |
|
251 | 250 | setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt |
|
252 | 251 | |
|
253 | 252 | #--------------------------------------------------------------------------- |
|
254 | 253 | # Do the actual setup now |
|
255 | 254 | #--------------------------------------------------------------------------- |
|
256 | 255 | |
|
257 | 256 | setup_args.update(setuptools_extra_args) |
|
258 | 257 | |
|
259 | 258 | |
|
260 | 259 | |
|
261 | 260 | def main(): |
|
262 | 261 | setup(**setup_args) |
|
263 | 262 | |
|
264 | 263 | if __name__ == '__main__': |
|
265 | 264 | main() |
General Comments 0
You need to be logged in to leave comments.
Login now