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