Show More
@@ -1,109 +1,108 b'' | |||
|
1 | 1 | # http://travis-ci.org/#!/ipython/ipython |
|
2 | 2 | language: python |
|
3 | 3 | os: linux |
|
4 | 4 | |
|
5 | 5 | addons: |
|
6 | 6 | apt: |
|
7 | 7 | packages: |
|
8 | 8 | - graphviz |
|
9 | 9 | |
|
10 | 10 | python: |
|
11 | 11 | - 3.6 |
|
12 | - 3.5 | |
|
13 | 12 | |
|
14 | 13 | sudo: false |
|
15 | 14 | |
|
16 | 15 | env: |
|
17 | 16 | global: |
|
18 | 17 | - PATH=$TRAVIS_BUILD_DIR/pandoc:$PATH |
|
19 | 18 | |
|
20 | 19 | group: edge |
|
21 | 20 | |
|
22 | 21 | before_install: |
|
23 | 22 | - | |
|
24 | 23 | # install Python on macOS |
|
25 | 24 | if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then |
|
26 | 25 | env | sort |
|
27 | 26 | if ! which python$TRAVIS_PYTHON_VERSION; then |
|
28 | 27 | HOMEBREW_NO_AUTO_UPDATE=1 brew tap minrk/homebrew-python-frameworks |
|
29 | 28 | HOMEBREW_NO_AUTO_UPDATE=1 brew cask install python-framework-${TRAVIS_PYTHON_VERSION/./} |
|
30 | 29 | fi |
|
31 | 30 | python3 -m pip install virtualenv |
|
32 | 31 | python3 -m virtualenv -p $(which python$TRAVIS_PYTHON_VERSION) ~/travis-env |
|
33 | 32 | source ~/travis-env/bin/activate |
|
34 | 33 | fi |
|
35 | 34 | - python --version |
|
36 | 35 | |
|
37 | 36 | install: |
|
38 | 37 | - pip install pip --upgrade |
|
39 | 38 | - pip install setuptools --upgrade |
|
40 | 39 | - pip install -e file://$PWD#egg=ipython[test] --upgrade |
|
41 | 40 | - pip install trio curio --upgrade --upgrade-strategy eager |
|
42 | 41 | - pip install 'pytest<4' matplotlib |
|
43 | 42 | - pip install codecov check-manifest --upgrade |
|
44 | 43 | |
|
45 | 44 | script: |
|
46 | 45 | - check-manifest |
|
47 | 46 | - | |
|
48 | 47 | if [[ "$TRAVIS_PYTHON_VERSION" == "nightly" ]]; then |
|
49 | 48 | # on nightly fake parso known the grammar |
|
50 | 49 | cp /home/travis/virtualenv/python3.8-dev/lib/python3.8/site-packages/parso/python/grammar37.txt /home/travis/virtualenv/python3.8-dev/lib/python3.8/site-packages/parso/python/grammar38.txt |
|
51 | 50 | fi |
|
52 | 51 | - cd /tmp && iptest --coverage xml && cd - |
|
53 | 52 | - pytest IPython |
|
54 | 53 | # On the latest Python (on Linux) only, make sure that the docs build. |
|
55 | 54 | - | |
|
56 | 55 | if [[ "$TRAVIS_PYTHON_VERSION" == "3.7" ]] && [[ "$TRAVIS_OS_NAME" == "linux" ]]; then |
|
57 | 56 | pip install -r docs/requirements.txt |
|
58 | 57 | python tools/fixup_whats_new_pr.py |
|
59 | 58 | make -C docs/ html SPHINXOPTS="-W" |
|
60 | 59 | fi |
|
61 | 60 | |
|
62 | 61 | after_success: |
|
63 | 62 | - cp /tmp/ipy_coverage.xml ./ |
|
64 | 63 | - cp /tmp/.coverage ./ |
|
65 | 64 | - codecov |
|
66 | 65 | |
|
67 | 66 | matrix: |
|
68 | 67 | include: |
|
69 | 68 | - python: "3.7" |
|
70 | 69 | dist: xenial |
|
71 | 70 | sudo: true |
|
72 | 71 | - python: "3.8-dev" |
|
73 | 72 | dist: xenial |
|
74 | 73 | sudo: true |
|
75 | 74 | - python: "3.7-dev" |
|
76 | 75 | dist: xenial |
|
77 | 76 | sudo: true |
|
78 | 77 | - python: "nightly" |
|
79 | 78 | dist: xenial |
|
80 | 79 | sudo: true |
|
81 | 80 | - os: osx |
|
82 | 81 | language: generic |
|
83 | 82 | python: 3.6 |
|
84 | 83 | env: TRAVIS_PYTHON_VERSION=3.6 |
|
85 | 84 | - os: osx |
|
86 | 85 | language: generic |
|
87 | 86 | python: 3.7 |
|
88 | 87 | env: TRAVIS_PYTHON_VERSION=3.7 |
|
89 | 88 | allow_failures: |
|
90 | 89 | - python: nightly |
|
91 | 90 | |
|
92 | 91 | before_deploy: |
|
93 | 92 | - rm -rf dist/ |
|
94 | 93 | - python setup.py sdist |
|
95 | 94 | - python setup.py bdist_wheel |
|
96 | 95 | |
|
97 | 96 | deploy: |
|
98 | 97 | provider: releases |
|
99 | 98 | api_key: |
|
100 | 99 | secure: Y/Ae9tYs5aoBU8bDjN2YrwGG6tCbezj/h3Lcmtx8HQavSbBgXnhnZVRb2snOKD7auqnqjfT/7QMm4ZyKvaOEgyggGktKqEKYHC8KOZ7yp8I5/UMDtk6j9TnXpSqqBxPiud4MDV76SfRYEQiaDoG4tGGvSfPJ9KcNjKrNvSyyxns= |
|
101 | 100 | file: dist/* |
|
102 | 101 | file_glob: true |
|
103 | 102 | skip_cleanup: true |
|
104 | 103 | on: |
|
105 | 104 | repo: ipython/ipython |
|
106 | 105 | all_branches: true # Backports are released from e.g. 5.x branch |
|
107 | 106 | tags: true |
|
108 | 107 | python: 3.6 # Any version should work, but we only need one |
|
109 | 108 | condition: $TRAVIS_OS_NAME = "linux" |
@@ -1,151 +1,152 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, 6): | |
|
31 | 31 | raise ImportError( |
|
32 | 32 | """ |
|
33 |
IPython 7.0+ supports Python 3. |
|
|
33 | IPython 7.10+ supports Python 3.6 and above. | |
|
34 | 34 | When using Python 2.7, please install IPython 5.x LTS Long Term Support version. |
|
35 | 35 | Python 3.3 and 3.4 were supported up to IPython 6.x. |
|
36 | Python 3.5 was supported with IPython 7.0 to 7.9. | |
|
36 | 37 | |
|
37 | 38 | See IPython `README.rst` file for more information: |
|
38 | 39 | |
|
39 | 40 | https://github.com/ipython/ipython/blob/master/README.rst |
|
40 | 41 | |
|
41 | 42 | """) |
|
42 | 43 | |
|
43 | 44 | # Make it easy to import extensions - they are always directly on pythonpath. |
|
44 | 45 | # Therefore, non-IPython modules can be added to extensions directory. |
|
45 | 46 | # This should probably be in ipapp.py. |
|
46 | 47 | sys.path.append(os.path.join(os.path.dirname(__file__), "extensions")) |
|
47 | 48 | |
|
48 | 49 | #----------------------------------------------------------------------------- |
|
49 | 50 | # Setup the top level names |
|
50 | 51 | #----------------------------------------------------------------------------- |
|
51 | 52 | |
|
52 | 53 | from .core.getipython import get_ipython |
|
53 | 54 | from .core import release |
|
54 | 55 | from .core.application import Application |
|
55 | 56 | from .terminal.embed import embed |
|
56 | 57 | |
|
57 | 58 | from .core.interactiveshell import InteractiveShell |
|
58 | 59 | from .testing import test |
|
59 | 60 | from .utils.sysinfo import sys_info |
|
60 | 61 | from .utils.frame import extract_module_locals |
|
61 | 62 | |
|
62 | 63 | # Release data |
|
63 | 64 | __author__ = '%s <%s>' % (release.author, release.author_email) |
|
64 | 65 | __license__ = release.license |
|
65 | 66 | __version__ = release.version |
|
66 | 67 | version_info = release.version_info |
|
67 | 68 | |
|
68 | 69 | def embed_kernel(module=None, local_ns=None, **kwargs): |
|
69 | 70 | """Embed and start an IPython kernel in a given scope. |
|
70 | 71 | |
|
71 | 72 | If you don't want the kernel to initialize the namespace |
|
72 | 73 | from the scope of the surrounding function, |
|
73 | 74 | and/or you want to load full IPython configuration, |
|
74 | 75 | you probably want `IPython.start_kernel()` instead. |
|
75 | 76 | |
|
76 | 77 | Parameters |
|
77 | 78 | ---------- |
|
78 | 79 | module : types.ModuleType, optional |
|
79 | 80 | The module to load into IPython globals (default: caller) |
|
80 | 81 | local_ns : dict, optional |
|
81 | 82 | The namespace to load into IPython user namespace (default: caller) |
|
82 | 83 | |
|
83 | 84 | kwargs : various, optional |
|
84 | 85 | Further keyword args are relayed to the IPKernelApp constructor, |
|
85 | 86 | allowing configuration of the Kernel. Will only have an effect |
|
86 | 87 | on the first embed_kernel call for a given process. |
|
87 | 88 | """ |
|
88 | 89 | |
|
89 | 90 | (caller_module, caller_locals) = extract_module_locals(1) |
|
90 | 91 | if module is None: |
|
91 | 92 | module = caller_module |
|
92 | 93 | if local_ns is None: |
|
93 | 94 | local_ns = caller_locals |
|
94 | 95 | |
|
95 | 96 | # Only import .zmq when we really need it |
|
96 | 97 | from ipykernel.embed import embed_kernel as real_embed_kernel |
|
97 | 98 | real_embed_kernel(module=module, local_ns=local_ns, **kwargs) |
|
98 | 99 | |
|
99 | 100 | def start_ipython(argv=None, **kwargs): |
|
100 | 101 | """Launch a normal IPython instance (as opposed to embedded) |
|
101 | 102 | |
|
102 | 103 | `IPython.embed()` puts a shell in a particular calling scope, |
|
103 | 104 | such as a function or method for debugging purposes, |
|
104 | 105 | which is often not desirable. |
|
105 | 106 | |
|
106 | 107 | `start_ipython()` does full, regular IPython initialization, |
|
107 | 108 | including loading startup files, configuration, etc. |
|
108 | 109 | much of which is skipped by `embed()`. |
|
109 | 110 | |
|
110 | 111 | This is a public API method, and will survive implementation changes. |
|
111 | 112 | |
|
112 | 113 | Parameters |
|
113 | 114 | ---------- |
|
114 | 115 | |
|
115 | 116 | argv : list or None, optional |
|
116 | 117 | If unspecified or None, IPython will parse command-line options from sys.argv. |
|
117 | 118 | To prevent any command-line parsing, pass an empty list: `argv=[]`. |
|
118 | 119 | user_ns : dict, optional |
|
119 | 120 | specify this dictionary to initialize the IPython user namespace with particular values. |
|
120 | 121 | kwargs : various, optional |
|
121 | 122 | Any other kwargs will be passed to the Application constructor, |
|
122 | 123 | such as `config`. |
|
123 | 124 | """ |
|
124 | 125 | from IPython.terminal.ipapp import launch_new_instance |
|
125 | 126 | return launch_new_instance(argv=argv, **kwargs) |
|
126 | 127 | |
|
127 | 128 | def start_kernel(argv=None, **kwargs): |
|
128 | 129 | """Launch a normal IPython kernel instance (as opposed to embedded) |
|
129 | 130 | |
|
130 | 131 | `IPython.embed_kernel()` puts a shell in a particular calling scope, |
|
131 | 132 | such as a function or method for debugging purposes, |
|
132 | 133 | which is often not desirable. |
|
133 | 134 | |
|
134 | 135 | `start_kernel()` does full, regular IPython initialization, |
|
135 | 136 | including loading startup files, configuration, etc. |
|
136 | 137 | much of which is skipped by `embed()`. |
|
137 | 138 | |
|
138 | 139 | Parameters |
|
139 | 140 | ---------- |
|
140 | 141 | |
|
141 | 142 | argv : list or None, optional |
|
142 | 143 | If unspecified or None, IPython will parse command-line options from sys.argv. |
|
143 | 144 | To prevent any command-line parsing, pass an empty list: `argv=[]`. |
|
144 | 145 | user_ns : dict, optional |
|
145 | 146 | specify this dictionary to initialize the IPython user namespace with particular values. |
|
146 | 147 | kwargs : various, optional |
|
147 | 148 | Any other kwargs will be passed to the Application constructor, |
|
148 | 149 | such as `config`. |
|
149 | 150 | """ |
|
150 | 151 | from IPython.kernel.zmq.kernelapp import launch_new_instance |
|
151 | 152 | return launch_new_instance(argv=argv, **kwargs) |
@@ -1,111 +1,119 b'' | |||
|
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/v/IPython.svg |
|
5 | 5 | :target: https://pypi.python.org/pypi/ipython |
|
6 | 6 | |
|
7 | 7 | .. image:: https://img.shields.io/travis/ipython/ipython.svg |
|
8 | 8 | :target: https://travis-ci.org/ipython/ipython |
|
9 | 9 | |
|
10 | 10 | .. image:: https://www.codetriage.com/ipython/ipython/badges/users.svg |
|
11 | 11 | :target: https://www.codetriage.com/ipython/ipython/ |
|
12 | 12 | |
|
13 | .. image:: https://raster.shields.io/badge/Follows-NEP29-brightgreen.png | |
|
14 | :target: https://numpy.org/neps/nep-0029-deprecation_policy.html | |
|
15 | ||
|
16 | ||
|
13 | 17 | =========================================== |
|
14 | 18 | IPython: Productive Interactive Computing |
|
15 | 19 | =========================================== |
|
16 | 20 | |
|
17 | 21 | Overview |
|
18 | 22 | ======== |
|
19 | 23 | |
|
20 | 24 | Welcome to IPython. Our full documentation is available on `ipython.readthedocs.io |
|
21 | 25 | <https://ipython.readthedocs.io/en/stable/>`_ and contains information on how to install, use, and |
|
22 | 26 | contribute to the project. |
|
23 | 27 | |
|
24 | 28 | **IPython versions and Python Support** |
|
25 | 29 | |
|
30 | Starting with IPython 7.10, IPython follows `NEP 29 <https://numpy.org/neps/nep-0029-deprecation_policy.html>`_ | |
|
31 | ||
|
32 | **IPython 7.10+** requires Python version 3.6 and above. | |
|
33 | ||
|
26 | 34 | **IPython 7.0** requires Python version 3.5 and above. |
|
27 | 35 | |
|
28 | 36 | **IPython 6.x** requires Python version 3.3 and above. |
|
29 | 37 | |
|
30 | 38 | **IPython 5.x LTS** is the compatible release for Python 2.7. |
|
31 | 39 | If you require Python 2 support, you **must** use IPython 5.x LTS. Please |
|
32 | 40 | update your project configurations and requirements as necessary. |
|
33 | 41 | |
|
34 | 42 | |
|
35 | 43 | The Notebook, Qt console and a number of other pieces are now parts of *Jupyter*. |
|
36 | 44 | See the `Jupyter installation docs <https://jupyter.readthedocs.io/en/latest/install.html>`__ |
|
37 | 45 | if you want to use these. |
|
38 | 46 | |
|
39 | 47 | |
|
40 | 48 | |
|
41 | 49 | |
|
42 | 50 | Development and Instant running |
|
43 | 51 | =============================== |
|
44 | 52 | |
|
45 | 53 | You can find the latest version of the development documentation on `readthedocs |
|
46 | 54 | <https://ipython.readthedocs.io/en/latest/>`_. |
|
47 | 55 | |
|
48 | 56 | You can run IPython from this directory without even installing it system-wide |
|
49 | 57 | by typing at the terminal:: |
|
50 | 58 | |
|
51 | 59 | $ python -m IPython |
|
52 | 60 | |
|
53 | 61 | Or see the `development installation docs |
|
54 | 62 | <https://ipython.readthedocs.io/en/latest/install/install.html#installing-the-development-version>`_ |
|
55 | 63 | for the latest revision on read the docs. |
|
56 | 64 | |
|
57 | 65 | Documentation and installation instructions for older version of IPython can be |
|
58 | 66 | found on the `IPython website <https://ipython.org/documentation.html>`_ |
|
59 | 67 | |
|
60 | 68 | |
|
61 | 69 | |
|
62 | 70 | IPython requires Python version 3 or above |
|
63 | 71 | ========================================== |
|
64 | 72 | |
|
65 | 73 | Starting with version 6.0, IPython does not support Python 2.7, 3.0, 3.1, or |
|
66 | 74 | 3.2. |
|
67 | 75 | |
|
68 | 76 | For a version compatible with Python 2.7, please install the 5.x LTS Long Term |
|
69 | 77 | Support version. |
|
70 | 78 | |
|
71 | 79 | If you are encountering this error message you are likely trying to install or |
|
72 | 80 | use IPython from source. You need to checkout the remote 5.x branch. If you are |
|
73 | 81 | using git the following should work:: |
|
74 | 82 | |
|
75 | 83 | $ git fetch origin |
|
76 | 84 | $ git checkout 5.x |
|
77 | 85 | |
|
78 | 86 | If you encounter this error message with a regular install of IPython, then you |
|
79 | 87 | likely need to update your package manager, for example if you are using `pip` |
|
80 | 88 | check the version of pip with:: |
|
81 | 89 | |
|
82 | 90 | $ pip --version |
|
83 | 91 | |
|
84 | 92 | You will need to update pip to the version 9.0.1 or greater. If you are not using |
|
85 | 93 | pip, please inquiry with the maintainers of the package for your package |
|
86 | 94 | manager. |
|
87 | 95 | |
|
88 | 96 | For more information see one of our blog posts: |
|
89 | 97 | |
|
90 | 98 | https://blog.jupyter.org/release-of-ipython-5-0-8ce60b8d2e8e |
|
91 | 99 | |
|
92 | 100 | As well as the following Pull-Request for discussion: |
|
93 | 101 | |
|
94 | 102 | https://github.com/ipython/ipython/pull/9900 |
|
95 | 103 | |
|
96 | 104 | This error does also occur if you are invoking ``setup.py`` directly βΒ which you |
|
97 | 105 | should not βΒ or are using ``easy_install`` If this is the case, use ``pip |
|
98 | 106 | install .`` instead of ``setup.py install`` , and ``pip install -e .`` instead |
|
99 | 107 | of ``setup.py develop`` If you are depending on IPython as a dependency you may |
|
100 | 108 | also want to have a conditional dependency on IPython depending on the Python |
|
101 | 109 | version:: |
|
102 | 110 | |
|
103 | 111 | install_req = ['ipython'] |
|
104 | 112 | if sys.version_info[0] < 3 and 'bdist_wheel' not in sys.argv: |
|
105 | 113 | install_req.remove('ipython') |
|
106 | 114 | install_req.append('ipython<6') |
|
107 | 115 | |
|
108 | 116 | setup( |
|
109 | 117 | ... |
|
110 | 118 | install_requires=install_req |
|
111 | 119 | ) |
@@ -1,263 +1,262 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, 6): | |
|
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.10+ supports Python 3.6 and above, following NEP 29. | |
|
46 | 46 | When using Python 2.7, please install IPython 5.x LTS Long Term Support version. |
|
47 | 47 | Python 3.3 and 3.4 were supported up to IPython 6.x. |
|
48 | Python 3.5 was supported with IPython 7.0 to 7.9. | |
|
48 | 49 | |
|
49 | 50 | See IPython `README.rst` file for more information: |
|
50 | 51 | |
|
51 | 52 | https://github.com/ipython/ipython/blob/master/README.rst |
|
52 | 53 | |
|
53 | 54 | Python {py} detected. |
|
54 | 55 | {pip} |
|
55 | 56 | """.format(py=sys.version_info, pip=pip_message ) |
|
56 | 57 | |
|
57 | 58 | print(error, file=sys.stderr) |
|
58 | 59 | sys.exit(1) |
|
59 | 60 | |
|
60 | 61 | # At least we're on the python version we need, move on. |
|
61 | 62 | |
|
62 | 63 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly |
|
63 | 64 | # update it when the contents of directories change. |
|
64 | 65 | if os.path.exists('MANIFEST'): os.remove('MANIFEST') |
|
65 | 66 | |
|
66 | 67 | from distutils.core import setup |
|
67 | 68 | |
|
68 | 69 | # Our own imports |
|
69 | 70 | from setupbase import target_update |
|
70 | 71 | |
|
71 | 72 | from setupbase import ( |
|
72 | 73 | setup_args, |
|
73 | 74 | find_packages, |
|
74 | 75 | find_package_data, |
|
75 | 76 | check_package_data_first, |
|
76 | 77 | find_entry_points, |
|
77 | 78 | build_scripts_entrypt, |
|
78 | 79 | find_data_files, |
|
79 | 80 | git_prebuild, |
|
80 | 81 | install_symlinked, |
|
81 | 82 | install_lib_symlink, |
|
82 | 83 | install_scripts_for_symlink, |
|
83 | 84 | unsymlink, |
|
84 | 85 | ) |
|
85 | 86 | |
|
86 | 87 | isfile = os.path.isfile |
|
87 | 88 | pjoin = os.path.join |
|
88 | 89 | |
|
89 | 90 | #------------------------------------------------------------------------------- |
|
90 | 91 | # Handle OS specific things |
|
91 | 92 | #------------------------------------------------------------------------------- |
|
92 | 93 | |
|
93 | 94 | if os.name in ('nt','dos'): |
|
94 | 95 | os_name = 'windows' |
|
95 | 96 | else: |
|
96 | 97 | os_name = os.name |
|
97 | 98 | |
|
98 | 99 | # Under Windows, 'sdist' has not been supported. Now that the docs build with |
|
99 | 100 | # Sphinx it might work, but let's not turn it on until someone confirms that it |
|
100 | 101 | # actually works. |
|
101 | 102 | if os_name == 'windows' and 'sdist' in sys.argv: |
|
102 | 103 | print('The sdist command is not available under Windows. Exiting.') |
|
103 | 104 | sys.exit(1) |
|
104 | 105 | |
|
105 | 106 | |
|
106 | 107 | #------------------------------------------------------------------------------- |
|
107 | 108 | # Things related to the IPython documentation |
|
108 | 109 | #------------------------------------------------------------------------------- |
|
109 | 110 | |
|
110 | 111 | # update the manuals when building a source dist |
|
111 | 112 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): |
|
112 | 113 | |
|
113 | 114 | # List of things to be updated. Each entry is a triplet of args for |
|
114 | 115 | # target_update() |
|
115 | 116 | to_update = [ |
|
116 | 117 | ('docs/man/ipython.1.gz', |
|
117 | 118 | ['docs/man/ipython.1'], |
|
118 | 119 | 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'), |
|
119 | 120 | ] |
|
120 | 121 | |
|
121 | 122 | |
|
122 | 123 | [ target_update(*t) for t in to_update ] |
|
123 | 124 | |
|
124 | 125 | #--------------------------------------------------------------------------- |
|
125 | 126 | # Find all the packages, package data, and data_files |
|
126 | 127 | #--------------------------------------------------------------------------- |
|
127 | 128 | |
|
128 | 129 | packages = find_packages() |
|
129 | 130 | package_data = find_package_data() |
|
130 | 131 | |
|
131 | 132 | data_files = find_data_files() |
|
132 | 133 | |
|
133 | 134 | setup_args['packages'] = packages |
|
134 | 135 | setup_args['package_data'] = package_data |
|
135 | 136 | setup_args['data_files'] = data_files |
|
136 | 137 | |
|
137 | 138 | #--------------------------------------------------------------------------- |
|
138 | 139 | # custom distutils commands |
|
139 | 140 | #--------------------------------------------------------------------------- |
|
140 | 141 | # imports here, so they are after setuptools import if there was one |
|
141 | 142 | from distutils.command.sdist import sdist |
|
142 | 143 | |
|
143 | 144 | setup_args['cmdclass'] = { |
|
144 | 145 | 'build_py': \ |
|
145 | 146 | check_package_data_first(git_prebuild('IPython')), |
|
146 | 147 | 'sdist' : git_prebuild('IPython', sdist), |
|
147 | 148 | 'symlink': install_symlinked, |
|
148 | 149 | 'install_lib_symlink': install_lib_symlink, |
|
149 | 150 | 'install_scripts_sym': install_scripts_for_symlink, |
|
150 | 151 | 'unsymlink': unsymlink, |
|
151 | 152 | } |
|
152 | 153 | |
|
153 | 154 | |
|
154 | 155 | #--------------------------------------------------------------------------- |
|
155 | 156 | # Handle scripts, dependencies, and setuptools specific things |
|
156 | 157 | #--------------------------------------------------------------------------- |
|
157 | 158 | |
|
158 | 159 | # For some commands, use setuptools. Note that we do NOT list install here! |
|
159 | 160 | # If you want a setuptools-enhanced install, just run 'setupegg.py install' |
|
160 | 161 | needs_setuptools = {'develop', 'release', 'bdist_egg', 'bdist_rpm', |
|
161 | 162 | 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel', |
|
162 | 163 | 'egg_info', 'easy_install', 'upload', 'install_egg_info', |
|
163 | 164 | } |
|
164 | 165 | |
|
165 | 166 | if len(needs_setuptools.intersection(sys.argv)) > 0: |
|
166 | 167 | import setuptools |
|
167 | 168 | |
|
168 | 169 | # This dict is used for passing extra arguments that are setuptools |
|
169 | 170 | # specific to setup |
|
170 | 171 | setuptools_extra_args = {} |
|
171 | 172 | |
|
172 | 173 | # setuptools requirements |
|
173 | 174 | |
|
174 | 175 | extras_require = dict( |
|
175 | 176 | parallel = ['ipyparallel'], |
|
176 | 177 | qtconsole = ['qtconsole'], |
|
177 | 178 | doc = ['Sphinx>=1.3'], |
|
178 | test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments', 'nbformat', 'ipykernel', 'numpy'], | |
|
179 | test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments', 'nbformat', 'ipykernel', 'numpy>=1.14'], | |
|
179 | 180 | terminal = [], |
|
180 | 181 | kernel = ['ipykernel'], |
|
181 | 182 | nbformat = ['nbformat'], |
|
182 | 183 | notebook = ['notebook', 'ipywidgets'], |
|
183 | 184 | nbconvert = ['nbconvert'], |
|
184 | 185 | ) |
|
185 | 186 | |
|
186 | 187 | install_requires = [ |
|
187 | 188 | 'setuptools>=18.5', |
|
188 | 189 | 'jedi>=0.10', |
|
189 | 190 | 'decorator', |
|
190 | 191 | 'pickleshare', |
|
191 | 192 | 'traitlets>=4.2', |
|
192 | 193 | 'prompt_toolkit>=2.0.0,<2.1.0', |
|
193 | 194 | 'pygments', |
|
194 | 195 | 'backcall', |
|
195 | 196 | ] |
|
196 | 197 | |
|
197 | 198 | # Platform-specific dependencies: |
|
198 | 199 | # This is the correct way to specify these, |
|
199 | 200 | # but requires pip >= 6. pip < 6 ignores these. |
|
200 | 201 | |
|
201 | 202 | extras_require.update({ |
|
202 | ':python_version == "3.4"': ['typing'], | |
|
203 | 203 | ':sys_platform != "win32"': ['pexpect'], |
|
204 | 204 | ':sys_platform == "darwin"': ['appnope'], |
|
205 | 205 | ':sys_platform == "win32"': ['colorama'], |
|
206 | ':sys_platform == "win32" and python_version < "3.6"': ['win_unicode_console>=0.5'], | |
|
207 | 206 | }) |
|
208 | 207 | # FIXME: re-specify above platform dependencies for pip < 6 |
|
209 | 208 | # These would result in non-portable bdists. |
|
210 | 209 | if not any(arg.startswith('bdist') for arg in sys.argv): |
|
211 | 210 | if sys.platform == 'darwin': |
|
212 | 211 | install_requires.extend(['appnope']) |
|
213 | 212 | |
|
214 | 213 | if not sys.platform.startswith('win'): |
|
215 | 214 | install_requires.append('pexpect') |
|
216 | 215 | |
|
217 | 216 | # workaround pypa/setuptools#147, where setuptools misspells |
|
218 | 217 | # platform_python_implementation as python_implementation |
|
219 | 218 | if 'setuptools' in sys.modules: |
|
220 | 219 | for key in list(extras_require): |
|
221 | 220 | if 'platform_python_implementation' in key: |
|
222 | 221 | new_key = key.replace('platform_python_implementation', 'python_implementation') |
|
223 | 222 | extras_require[new_key] = extras_require.pop(key) |
|
224 | 223 | |
|
225 | 224 | everything = set() |
|
226 | 225 | for key, deps in extras_require.items(): |
|
227 | 226 | if ':' not in key: |
|
228 | 227 | everything.update(deps) |
|
229 | 228 | extras_require['all'] = everything |
|
230 | 229 | |
|
231 | 230 | if 'setuptools' in sys.modules: |
|
232 |
setuptools_extra_args['python_requires'] = '>=3. |
|
|
231 | setuptools_extra_args['python_requires'] = '>=3.6' | |
|
233 | 232 | setuptools_extra_args['zip_safe'] = False |
|
234 | 233 | setuptools_extra_args['entry_points'] = { |
|
235 | 234 | 'console_scripts': find_entry_points(), |
|
236 | 235 | 'pygments.lexers': [ |
|
237 | 236 | 'ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer', |
|
238 | 237 | 'ipython = IPython.lib.lexers:IPythonLexer', |
|
239 | 238 | 'ipython3 = IPython.lib.lexers:IPython3Lexer', |
|
240 | 239 | ], |
|
241 | 240 | } |
|
242 | 241 | setup_args['extras_require'] = extras_require |
|
243 | 242 | setup_args['install_requires'] = install_requires |
|
244 | 243 | |
|
245 | 244 | else: |
|
246 | 245 | # scripts has to be a non-empty list, or install_scripts isn't called |
|
247 | 246 | setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()] |
|
248 | 247 | |
|
249 | 248 | setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt |
|
250 | 249 | |
|
251 | 250 | #--------------------------------------------------------------------------- |
|
252 | 251 | # Do the actual setup now |
|
253 | 252 | #--------------------------------------------------------------------------- |
|
254 | 253 | |
|
255 | 254 | setup_args.update(setuptools_extra_args) |
|
256 | 255 | |
|
257 | 256 | |
|
258 | 257 | |
|
259 | 258 | def main(): |
|
260 | 259 | setup(**setup_args) |
|
261 | 260 | |
|
262 | 261 | if __name__ == '__main__': |
|
263 | 262 | main() |
General Comments 0
You need to be logged in to leave comments.
Login now