Show More
@@ -1,146 +1,146 b'' | |||
|
1 | 1 | # encoding: utf-8 |
|
2 | 2 | """ |
|
3 | 3 | IPython: tools for interactive and parallel computing in Python. |
|
4 | 4 | |
|
5 | 5 | http://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 | from __future__ import absolute_import |
|
22 | 22 | |
|
23 | 23 | import os |
|
24 | 24 | import sys |
|
25 | 25 | import warnings |
|
26 | 26 | |
|
27 | 27 | #----------------------------------------------------------------------------- |
|
28 | 28 | # Setup everything |
|
29 | 29 | #----------------------------------------------------------------------------- |
|
30 | 30 | |
|
31 | 31 | # Don't forget to also update setup.py when this changes! |
|
32 | 32 | v = sys.version_info |
|
33 | if v[:2] < (2,7) or (v[0] >= 3 and v[:2] < (3,3)): | |
|
34 |
raise ImportError('IPython requires Python version |
|
|
33 | if v[:2] < (3,3): | |
|
34 | raise ImportError('IPython requires Python version 3.3 or above.') | |
|
35 | 35 | del v |
|
36 | 36 | |
|
37 | 37 | # Make it easy to import extensions - they are always directly on pythonpath. |
|
38 | 38 | # Therefore, non-IPython modules can be added to extensions directory. |
|
39 | 39 | # This should probably be in ipapp.py. |
|
40 | 40 | sys.path.append(os.path.join(os.path.dirname(__file__), "extensions")) |
|
41 | 41 | |
|
42 | 42 | #----------------------------------------------------------------------------- |
|
43 | 43 | # Setup the top level names |
|
44 | 44 | #----------------------------------------------------------------------------- |
|
45 | 45 | |
|
46 | 46 | from .core.getipython import get_ipython |
|
47 | 47 | from .core import release |
|
48 | 48 | from .core.application import Application |
|
49 | 49 | from .terminal.embed import embed |
|
50 | 50 | |
|
51 | 51 | from .core.interactiveshell import InteractiveShell |
|
52 | 52 | from .testing import test |
|
53 | 53 | from .utils.sysinfo import sys_info |
|
54 | 54 | from .utils.frame import extract_module_locals |
|
55 | 55 | |
|
56 | 56 | # Release data |
|
57 | 57 | __author__ = '%s <%s>' % (release.author, release.author_email) |
|
58 | 58 | __license__ = release.license |
|
59 | 59 | __version__ = release.version |
|
60 | 60 | version_info = release.version_info |
|
61 | 61 | |
|
62 | 62 | def embed_kernel(module=None, local_ns=None, **kwargs): |
|
63 | 63 | """Embed and start an IPython kernel in a given scope. |
|
64 | 64 | |
|
65 | 65 | If you don't want the kernel to initialize the namespace |
|
66 | 66 | from the scope of the surrounding function, |
|
67 | 67 | and/or you want to load full IPython configuration, |
|
68 | 68 | you probably want `IPython.start_kernel()` instead. |
|
69 | 69 | |
|
70 | 70 | Parameters |
|
71 | 71 | ---------- |
|
72 | 72 | module : ModuleType, optional |
|
73 | 73 | The module to load into IPython globals (default: caller) |
|
74 | 74 | local_ns : dict, optional |
|
75 | 75 | The namespace to load into IPython user namespace (default: caller) |
|
76 | 76 | |
|
77 | 77 | kwargs : various, optional |
|
78 | 78 | Further keyword args are relayed to the IPKernelApp constructor, |
|
79 | 79 | allowing configuration of the Kernel. Will only have an effect |
|
80 | 80 | on the first embed_kernel call for a given process. |
|
81 | 81 | """ |
|
82 | 82 | |
|
83 | 83 | (caller_module, caller_locals) = extract_module_locals(1) |
|
84 | 84 | if module is None: |
|
85 | 85 | module = caller_module |
|
86 | 86 | if local_ns is None: |
|
87 | 87 | local_ns = caller_locals |
|
88 | 88 | |
|
89 | 89 | # Only import .zmq when we really need it |
|
90 | 90 | from ipykernel.embed import embed_kernel as real_embed_kernel |
|
91 | 91 | real_embed_kernel(module=module, local_ns=local_ns, **kwargs) |
|
92 | 92 | |
|
93 | 93 | def start_ipython(argv=None, **kwargs): |
|
94 | 94 | """Launch a normal IPython instance (as opposed to embedded) |
|
95 | 95 | |
|
96 | 96 | `IPython.embed()` puts a shell in a particular calling scope, |
|
97 | 97 | such as a function or method for debugging purposes, |
|
98 | 98 | which is often not desirable. |
|
99 | 99 | |
|
100 | 100 | `start_ipython()` does full, regular IPython initialization, |
|
101 | 101 | including loading startup files, configuration, etc. |
|
102 | 102 | much of which is skipped by `embed()`. |
|
103 | 103 | |
|
104 | 104 | This is a public API method, and will survive implementation changes. |
|
105 | 105 | |
|
106 | 106 | Parameters |
|
107 | 107 | ---------- |
|
108 | 108 | |
|
109 | 109 | argv : list or None, optional |
|
110 | 110 | If unspecified or None, IPython will parse command-line options from sys.argv. |
|
111 | 111 | To prevent any command-line parsing, pass an empty list: `argv=[]`. |
|
112 | 112 | user_ns : dict, optional |
|
113 | 113 | specify this dictionary to initialize the IPython user namespace with particular values. |
|
114 | 114 | kwargs : various, optional |
|
115 | 115 | Any other kwargs will be passed to the Application constructor, |
|
116 | 116 | such as `config`. |
|
117 | 117 | """ |
|
118 | 118 | from IPython.terminal.ipapp import launch_new_instance |
|
119 | 119 | return launch_new_instance(argv=argv, **kwargs) |
|
120 | 120 | |
|
121 | 121 | def start_kernel(argv=None, **kwargs): |
|
122 | 122 | """Launch a normal IPython kernel instance (as opposed to embedded) |
|
123 | 123 | |
|
124 | 124 | `IPython.embed_kernel()` puts a shell in a particular calling scope, |
|
125 | 125 | such as a function or method for debugging purposes, |
|
126 | 126 | which is often not desirable. |
|
127 | 127 | |
|
128 | 128 | `start_kernel()` does full, regular IPython initialization, |
|
129 | 129 | including loading startup files, configuration, etc. |
|
130 | 130 | much of which is skipped by `embed()`. |
|
131 | 131 | |
|
132 | 132 | Parameters |
|
133 | 133 | ---------- |
|
134 | 134 | |
|
135 | 135 | argv : list or None, optional |
|
136 | 136 | If unspecified or None, IPython will parse command-line options from sys.argv. |
|
137 | 137 | To prevent any command-line parsing, pass an empty list: `argv=[]`. |
|
138 | 138 | user_ns : dict, optional |
|
139 | 139 | specify this dictionary to initialize the IPython user namespace with particular values. |
|
140 | 140 | kwargs : various, optional |
|
141 | 141 | Any other kwargs will be passed to the Application constructor, |
|
142 | 142 | such as `config`. |
|
143 | 143 | """ |
|
144 | 144 | from IPython.kernel.zmq.kernelapp import launch_new_instance |
|
145 | 145 | return launch_new_instance(argv=argv, **kwargs) |
|
146 | 146 |
@@ -1,51 +1,51 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/dm/IPython.svg |
|
5 | 5 | :target: https://pypi.python.org/pypi/ipython |
|
6 | 6 | |
|
7 | 7 | .. image:: https://img.shields.io/pypi/v/IPython.svg |
|
8 | 8 | :target: https://pypi.python.org/pypi/ipython |
|
9 | 9 | |
|
10 | 10 | .. image:: https://img.shields.io/travis/ipython/ipython.svg |
|
11 | 11 | :target: https://travis-ci.org/ipython/ipython |
|
12 | 12 | |
|
13 | 13 | |
|
14 | 14 | =========================================== |
|
15 | 15 | IPython: Productive Interactive Computing |
|
16 | 16 | =========================================== |
|
17 | 17 | |
|
18 | 18 | Overview |
|
19 | 19 | ======== |
|
20 | 20 | |
|
21 | 21 | Welcome to IPython. Our full documentation is available on `ipython.readthedocs.io |
|
22 | 22 | <https://ipython.readthedocs.io/en/stable/>`_ and contain information on how to install, use |
|
23 | 23 | contribute to the project. |
|
24 | 24 | |
|
25 |
Officially, IPython requires Python version |
|
|
26 |
IPython |
|
|
25 | Officially, IPython requires Python version 3.3 and above. | |
|
26 | IPython 5.x is the last IPython version to support Python 2.7. | |
|
27 | 27 | |
|
28 | 28 | The Notebook, Qt console and a number of other pieces are now parts of *Jupyter*. |
|
29 | 29 | See the `Jupyter installation docs <http://jupyter.readthedocs.io/en/latest/install.html>`__ |
|
30 | 30 | if you want to use these. |
|
31 | 31 | |
|
32 | 32 | |
|
33 | 33 | |
|
34 | 34 | |
|
35 | 35 | Developement and Instant runnimg |
|
36 | 36 | ================================ |
|
37 | 37 | |
|
38 | 38 | You can find the latest version of the development documentation on `readthedocs |
|
39 | 39 | <http://ipython.readthedocs.io/en/latest/>`_. |
|
40 | 40 | |
|
41 | 41 | You can run IPython from this directory without even installing it system-wide |
|
42 | 42 | by typing at the terminal:: |
|
43 | 43 | |
|
44 | 44 | $ python -m IPython |
|
45 | 45 | |
|
46 | 46 | Or see the `developement installation docs |
|
47 | 47 | <http://ipython.readthedocs.io/en/latest/install/install.html#installing-the-development-version>`_ |
|
48 | 48 | for the latest revision on read the docs. |
|
49 | 49 | |
|
50 | 50 | Documentation and installation instructions for older version of IPython can be |
|
51 | 51 | found on the `IPython website <http://ipython.org/documentation.html>`_ |
@@ -1,144 +1,144 b'' | |||
|
1 | 1 | .. _install: |
|
2 | 2 | |
|
3 | 3 | Installing IPython |
|
4 | 4 | ================== |
|
5 | 5 | |
|
6 | 6 | |
|
7 | IPython requires Python 2.7 or β₯ 3.3. | |
|
7 | IPython 6 requires Python β₯ 3.3. IPython 5.x can be installed on Python 2. | |
|
8 | 8 | |
|
9 | 9 | |
|
10 | 10 | Quick Install |
|
11 | 11 | ------------- |
|
12 | 12 | |
|
13 | 13 | With ``pip`` already installed : |
|
14 | 14 | |
|
15 | 15 | .. code-block:: bash |
|
16 | 16 | |
|
17 | 17 | $ pip install ipython |
|
18 | 18 | |
|
19 | 19 | This installs IPython as well as its dependencies. |
|
20 | 20 | |
|
21 | 21 | If you want to use IPython with notebooks or the Qt console, you should also |
|
22 | 22 | install Jupyter ``pip install jupyter``. |
|
23 | 23 | |
|
24 | 24 | |
|
25 | 25 | |
|
26 | 26 | Overview |
|
27 | 27 | -------- |
|
28 | 28 | |
|
29 | 29 | This document describes in detail the steps required to install IPython. For a |
|
30 | 30 | few quick ways to get started with package managers or full Python |
|
31 | 31 | distributions, see `the install page <http://ipython.org/install.html>`_ of the |
|
32 | 32 | IPython website. |
|
33 | 33 | |
|
34 | 34 | Please let us know if you have problems installing IPython or any of its |
|
35 | 35 | dependencies. |
|
36 | 36 | |
|
37 | 37 | IPython and most dependencies should be installed via :command:`pip`. |
|
38 | 38 | In many scenarios, this is the simplest method of installing Python packages. |
|
39 | 39 | More information about :mod:`pip` can be found on |
|
40 | 40 | `its PyPI page <https://pip.pypa.io>`__. |
|
41 | 41 | |
|
42 | 42 | |
|
43 | 43 | More general information about installing Python packages can be found in |
|
44 | 44 | `Python's documentation <http://docs.python.org>`_. |
|
45 | 45 | |
|
46 | 46 | .. _dependencies: |
|
47 | 47 | |
|
48 | 48 | Dependencies |
|
49 | 49 | ~~~~~~~~~~~~ |
|
50 | 50 | |
|
51 | 51 | IPython relies on a number of other Python packages. Installing using a package |
|
52 | 52 | manager like pip or conda will ensure the necessary packages are installed. |
|
53 | 53 | Manual installation without dependencies is possible, but not recommended. |
|
54 | 54 | The dependencies can be viewed with package manager commands, |
|
55 | 55 | such as :command:`pip show ipython` or :command:`conda info ipython`. |
|
56 | 56 | |
|
57 | 57 | |
|
58 | 58 | Installing IPython itself |
|
59 | 59 | ~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
60 | 60 | |
|
61 | 61 | IPython requires several dependencies to work correctly, it is not recommended |
|
62 | 62 | to install IPython and all its dependencies manually as this can be quite long |
|
63 | 63 | and troublesome. You should use the python package manager ``pip``. |
|
64 | 64 | |
|
65 | 65 | Installation using pip |
|
66 | 66 | ~~~~~~~~~~~~~~~~~~~~~~ |
|
67 | 67 | |
|
68 | 68 | Make sure you have the latest version of :mod:`pip` (the Python package |
|
69 | 69 | manager) installed. If you do not, head to `Pip documentation |
|
70 | 70 | <https://pip.pypa.io/en/stable/installing/>`_ and install :mod:`pip` first. |
|
71 | 71 | |
|
72 | 72 | The quickest way to get up and running with IPython is to install it with pip: |
|
73 | 73 | |
|
74 | 74 | .. code-block:: bash |
|
75 | 75 | |
|
76 | 76 | $ pip install ipython |
|
77 | 77 | |
|
78 | 78 | That's it. |
|
79 | 79 | |
|
80 | 80 | |
|
81 | 81 | Installation from source |
|
82 | 82 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
|
83 | 83 | |
|
84 | 84 | If you don't want to use :command:`pip`, or don't have it installed, |
|
85 | 85 | grab the latest stable tarball of IPython `from PyPI |
|
86 | 86 | <https://pypi.python.org/pypi/ipython>`__. Then do the following: |
|
87 | 87 | |
|
88 | 88 | .. code-block:: bash |
|
89 | 89 | |
|
90 | 90 | $ tar -xzf ipython.tar.gz |
|
91 | 91 | $ cd ipython |
|
92 | 92 | $ pip install . |
|
93 | 93 | |
|
94 | 94 | Do not invoke ``setup.py`` directly as this can have undesirable consequences |
|
95 | 95 | for further upgrades. Try to also avoid any usage of ``easy_install`` that can |
|
96 | 96 | have similar undesirable consequences. |
|
97 | 97 | |
|
98 | 98 | If you are installing to a location (like ``/usr/local``) that requires higher |
|
99 | 99 | permissions, you may need to run the last command with :command:`sudo`. You can |
|
100 | 100 | also install in user specific location by using the ``--user`` flag in |
|
101 | 101 | conjunction with pip. |
|
102 | 102 | |
|
103 | 103 | To run IPython's test suite, use the :command:`iptest` command from outside of |
|
104 | 104 | the IPython source tree: |
|
105 | 105 | |
|
106 | 106 | .. code-block:: bash |
|
107 | 107 | |
|
108 | 108 | $ iptest |
|
109 | 109 | |
|
110 | 110 | .. _devinstall: |
|
111 | 111 | |
|
112 | 112 | Installing the development version |
|
113 | 113 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
114 | 114 | |
|
115 | 115 | It is also possible to install the development version of IPython from our |
|
116 | 116 | `Git <http://git-scm.com/>`_ source code repository. To do this you will |
|
117 | 117 | need to have Git installed on your system. |
|
118 | 118 | |
|
119 | 119 | |
|
120 | 120 | Then do: |
|
121 | 121 | |
|
122 | 122 | .. code-block:: bash |
|
123 | 123 | |
|
124 | 124 | $ git clone https://github.com/ipython/ipython.git |
|
125 | 125 | $ cd ipython |
|
126 | 126 | $ pip install -e . |
|
127 | 127 | |
|
128 | 128 | The :command:`pip install -e .` command allows users and developers to follow |
|
129 | 129 | the development branch as it changes by creating links in the right places and |
|
130 | 130 | installing the command line scripts to the appropriate locations. |
|
131 | 131 | |
|
132 | 132 | Then, if you want to update your IPython at any time, do: |
|
133 | 133 | |
|
134 | 134 | .. code-block:: bash |
|
135 | 135 | |
|
136 | 136 | $ git pull |
|
137 | 137 | |
|
138 | 138 | If the dependencies or entrypoints have changed, you may have to run |
|
139 | 139 | |
|
140 | 140 | .. code-block:: bash |
|
141 | 141 | |
|
142 | 142 | $ pip install -e . |
|
143 | 143 | |
|
144 | 144 | again, but this is infrequent. |
@@ -1,288 +1,289 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
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 | #----------------------------------------------------------------------------- |
|
21 | 21 | # Minimal Python version sanity check |
|
22 | 22 | #----------------------------------------------------------------------------- |
|
23 | 23 | from __future__ import print_function |
|
24 | 24 | |
|
25 | 25 | import sys |
|
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 | 29 | v = sys.version_info |
|
30 | if v[:2] < (2,7) or (v[0] >= 3 and v[:2] < (3,3)): | |
|
31 |
error = "ERROR: IPython requires Python version |
|
|
30 | if v[:2] < (3,3): | |
|
31 | error = "ERROR: IPython requires Python version 3.3 or above." | |
|
32 | 32 | print(error, file=sys.stderr) |
|
33 | 33 | sys.exit(1) |
|
34 | 34 | |
|
35 | 35 | PY3 = (sys.version_info[0] >= 3) |
|
36 | 36 | |
|
37 | 37 | # At least we're on the python version we need, move on. |
|
38 | 38 | |
|
39 | 39 | #------------------------------------------------------------------------------- |
|
40 | 40 | # Imports |
|
41 | 41 | #------------------------------------------------------------------------------- |
|
42 | 42 | |
|
43 | 43 | # Stdlib imports |
|
44 | 44 | import os |
|
45 | 45 | |
|
46 | 46 | from glob import glob |
|
47 | 47 | |
|
48 | 48 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly |
|
49 | 49 | # update it when the contents of directories change. |
|
50 | 50 | if os.path.exists('MANIFEST'): os.remove('MANIFEST') |
|
51 | 51 | |
|
52 | 52 | from distutils.core import setup |
|
53 | 53 | |
|
54 | 54 | # Our own imports |
|
55 | 55 | from setupbase import target_update |
|
56 | 56 | |
|
57 | 57 | from setupbase import ( |
|
58 | 58 | setup_args, |
|
59 | 59 | find_packages, |
|
60 | 60 | find_package_data, |
|
61 | 61 | check_package_data_first, |
|
62 | 62 | find_entry_points, |
|
63 | 63 | build_scripts_entrypt, |
|
64 | 64 | find_data_files, |
|
65 | 65 | git_prebuild, |
|
66 | 66 | install_symlinked, |
|
67 | 67 | install_lib_symlink, |
|
68 | 68 | install_scripts_for_symlink, |
|
69 | 69 | unsymlink, |
|
70 | 70 | ) |
|
71 | 71 | |
|
72 | 72 | isfile = os.path.isfile |
|
73 | 73 | pjoin = os.path.join |
|
74 | 74 | |
|
75 | 75 | #------------------------------------------------------------------------------- |
|
76 | 76 | # Handle OS specific things |
|
77 | 77 | #------------------------------------------------------------------------------- |
|
78 | 78 | |
|
79 | 79 | if os.name in ('nt','dos'): |
|
80 | 80 | os_name = 'windows' |
|
81 | 81 | else: |
|
82 | 82 | os_name = os.name |
|
83 | 83 | |
|
84 | 84 | # Under Windows, 'sdist' has not been supported. Now that the docs build with |
|
85 | 85 | # Sphinx it might work, but let's not turn it on until someone confirms that it |
|
86 | 86 | # actually works. |
|
87 | 87 | if os_name == 'windows' and 'sdist' in sys.argv: |
|
88 | 88 | print('The sdist command is not available under Windows. Exiting.') |
|
89 | 89 | sys.exit(1) |
|
90 | 90 | |
|
91 | 91 | |
|
92 | 92 | #------------------------------------------------------------------------------- |
|
93 | 93 | # Things related to the IPython documentation |
|
94 | 94 | #------------------------------------------------------------------------------- |
|
95 | 95 | |
|
96 | 96 | # update the manuals when building a source dist |
|
97 | 97 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): |
|
98 | 98 | |
|
99 | 99 | # List of things to be updated. Each entry is a triplet of args for |
|
100 | 100 | # target_update() |
|
101 | 101 | to_update = [ |
|
102 | 102 | ('docs/man/ipython.1.gz', |
|
103 | 103 | ['docs/man/ipython.1'], |
|
104 | 104 | 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'), |
|
105 | 105 | ] |
|
106 | 106 | |
|
107 | 107 | |
|
108 | 108 | [ target_update(*t) for t in to_update ] |
|
109 | 109 | |
|
110 | 110 | #--------------------------------------------------------------------------- |
|
111 | 111 | # Find all the packages, package data, and data_files |
|
112 | 112 | #--------------------------------------------------------------------------- |
|
113 | 113 | |
|
114 | 114 | packages = find_packages() |
|
115 | 115 | package_data = find_package_data() |
|
116 | 116 | |
|
117 | 117 | data_files = find_data_files() |
|
118 | 118 | |
|
119 | 119 | setup_args['packages'] = packages |
|
120 | 120 | setup_args['package_data'] = package_data |
|
121 | 121 | setup_args['data_files'] = data_files |
|
122 | 122 | |
|
123 | 123 | #--------------------------------------------------------------------------- |
|
124 | 124 | # custom distutils commands |
|
125 | 125 | #--------------------------------------------------------------------------- |
|
126 | 126 | # imports here, so they are after setuptools import if there was one |
|
127 | 127 | from distutils.command.sdist import sdist |
|
128 | 128 | from distutils.command.upload import upload |
|
129 | 129 | |
|
130 | 130 | class UploadWindowsInstallers(upload): |
|
131 | 131 | |
|
132 | 132 | description = "Upload Windows installers to PyPI (only used from tools/release_windows.py)" |
|
133 | 133 | user_options = upload.user_options + [ |
|
134 | 134 | ('files=', 'f', 'exe file (or glob) to upload') |
|
135 | 135 | ] |
|
136 | 136 | def initialize_options(self): |
|
137 | 137 | upload.initialize_options(self) |
|
138 | 138 | meta = self.distribution.metadata |
|
139 | 139 | base = '{name}-{version}'.format( |
|
140 | 140 | name=meta.get_name(), |
|
141 | 141 | version=meta.get_version() |
|
142 | 142 | ) |
|
143 | 143 | self.files = os.path.join('dist', '%s.*.exe' % base) |
|
144 | 144 | |
|
145 | 145 | def run(self): |
|
146 | 146 | for dist_file in glob(self.files): |
|
147 | 147 | self.upload_file('bdist_wininst', 'any', dist_file) |
|
148 | 148 | |
|
149 | 149 | setup_args['cmdclass'] = { |
|
150 | 150 | 'build_py': \ |
|
151 | 151 | check_package_data_first(git_prebuild('IPython')), |
|
152 | 152 | 'sdist' : git_prebuild('IPython', sdist), |
|
153 | 153 | 'upload_wininst' : UploadWindowsInstallers, |
|
154 | 154 | 'symlink': install_symlinked, |
|
155 | 155 | 'install_lib_symlink': install_lib_symlink, |
|
156 | 156 | 'install_scripts_sym': install_scripts_for_symlink, |
|
157 | 157 | 'unsymlink': unsymlink, |
|
158 | 158 | } |
|
159 | 159 | |
|
160 | 160 | |
|
161 | 161 | #--------------------------------------------------------------------------- |
|
162 | 162 | # Handle scripts, dependencies, and setuptools specific things |
|
163 | 163 | #--------------------------------------------------------------------------- |
|
164 | 164 | |
|
165 | 165 | # For some commands, use setuptools. Note that we do NOT list install here! |
|
166 | 166 | # If you want a setuptools-enhanced install, just run 'setupegg.py install' |
|
167 | 167 | needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm', |
|
168 | 168 | 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel', |
|
169 | 169 | 'egg_info', 'easy_install', 'upload', 'install_egg_info', |
|
170 | 170 | )) |
|
171 | 171 | |
|
172 | 172 | if len(needs_setuptools.intersection(sys.argv)) > 0: |
|
173 | 173 | import setuptools |
|
174 | 174 | |
|
175 | 175 | # This dict is used for passing extra arguments that are setuptools |
|
176 | 176 | # specific to setup |
|
177 | 177 | setuptools_extra_args = {} |
|
178 | 178 | |
|
179 | 179 | # setuptools requirements |
|
180 | 180 | |
|
181 | 181 | extras_require = dict( |
|
182 | 182 | parallel = ['ipyparallel'], |
|
183 | 183 | qtconsole = ['qtconsole'], |
|
184 | 184 | doc = ['Sphinx>=1.3'], |
|
185 | 185 | test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments', 'nbformat', 'ipykernel', 'numpy'], |
|
186 | 186 | terminal = [], |
|
187 | 187 | kernel = ['ipykernel'], |
|
188 | 188 | nbformat = ['nbformat'], |
|
189 | 189 | notebook = ['notebook', 'ipywidgets'], |
|
190 | 190 | nbconvert = ['nbconvert'], |
|
191 | 191 | ) |
|
192 | 192 | |
|
193 | 193 | install_requires = [ |
|
194 | 194 | 'setuptools>=18.5', |
|
195 | 195 | 'decorator', |
|
196 | 196 | 'pickleshare', |
|
197 | 197 | 'simplegeneric>0.8', |
|
198 | 198 | 'traitlets>=4.2', |
|
199 | 199 | 'prompt_toolkit>=1.0.3,<2.0.0', |
|
200 | 200 | 'pygments', |
|
201 | 201 | ] |
|
202 | 202 | |
|
203 | 203 | # Platform-specific dependencies: |
|
204 | 204 | # This is the correct way to specify these, |
|
205 | 205 | # but requires pip >= 6. pip < 6 ignores these. |
|
206 | 206 | |
|
207 | 207 | extras_require.update({ |
|
208 | 208 | ':python_version == "2.7"': ['backports.shutil_get_terminal_size'], |
|
209 | 209 | ':python_version == "2.7" or python_version == "3.3"': ['pathlib2'], |
|
210 | 210 | ':sys_platform != "win32"': ['pexpect'], |
|
211 | 211 | ':sys_platform == "darwin"': ['appnope'], |
|
212 | 212 | ':sys_platform == "win32"': ['colorama', 'win_unicode_console>=0.5'], |
|
213 | 213 | 'test:python_version == "2.7"': ['mock'], |
|
214 | 214 | }) |
|
215 | 215 | # FIXME: re-specify above platform dependencies for pip < 6 |
|
216 | 216 | # These would result in non-portable bdists. |
|
217 | 217 | if not any(arg.startswith('bdist') for arg in sys.argv): |
|
218 | 218 | if sys.version_info < (3, 3): |
|
219 | 219 | extras_require['test'].append('mock') |
|
220 | 220 | |
|
221 | 221 | if sys.platform == 'darwin': |
|
222 | 222 | install_requires.extend(['appnope']) |
|
223 | 223 | |
|
224 | 224 | if not sys.platform.startswith('win'): |
|
225 | 225 | install_requires.append('pexpect') |
|
226 | 226 | |
|
227 | 227 | # workaround pypa/setuptools#147, where setuptools misspells |
|
228 | 228 | # platform_python_implementation as python_implementation |
|
229 | 229 | if 'setuptools' in sys.modules: |
|
230 | 230 | for key in list(extras_require): |
|
231 | 231 | if 'platform_python_implementation' in key: |
|
232 | 232 | new_key = key.replace('platform_python_implementation', 'python_implementation') |
|
233 | 233 | extras_require[new_key] = extras_require.pop(key) |
|
234 | 234 | |
|
235 | 235 | everything = set() |
|
236 | 236 | for key, deps in extras_require.items(): |
|
237 | 237 | if ':' not in key: |
|
238 | 238 | everything.update(deps) |
|
239 | 239 | extras_require['all'] = everything |
|
240 | 240 | |
|
241 | 241 | if 'setuptools' in sys.modules: |
|
242 | setuptools_extra_args['python_requires'] = '>=3.3' | |
|
242 | 243 | setuptools_extra_args['zip_safe'] = False |
|
243 | 244 | setuptools_extra_args['entry_points'] = { |
|
244 | 245 | 'console_scripts': find_entry_points(), |
|
245 | 246 | 'pygments.lexers': [ |
|
246 | 247 | 'ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer', |
|
247 | 248 | 'ipython = IPython.lib.lexers:IPythonLexer', |
|
248 | 249 | 'ipython3 = IPython.lib.lexers:IPython3Lexer', |
|
249 | 250 | ], |
|
250 | 251 | } |
|
251 | 252 | setup_args['extras_require'] = extras_require |
|
252 | 253 | requires = setup_args['install_requires'] = install_requires |
|
253 | 254 | |
|
254 | 255 | # Script to be run by the windows binary installer after the default setup |
|
255 | 256 | # routine, to add shortcuts and similar windows-only things. Windows |
|
256 | 257 | # post-install scripts MUST reside in the scripts/ dir, otherwise distutils |
|
257 | 258 | # doesn't find them. |
|
258 | 259 | if 'bdist_wininst' in sys.argv: |
|
259 | 260 | if len(sys.argv) > 2 and \ |
|
260 | 261 | ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): |
|
261 | 262 | print("ERROR: bdist_wininst must be run alone. Exiting.", file=sys.stderr) |
|
262 | 263 | sys.exit(1) |
|
263 | 264 | setup_args['data_files'].append( |
|
264 | 265 | ['Scripts', ('scripts/ipython.ico', 'scripts/ipython_nb.ico')]) |
|
265 | 266 | setup_args['scripts'] = [pjoin('scripts','ipython_win_post_install.py')] |
|
266 | 267 | setup_args['options'] = {"bdist_wininst": |
|
267 | 268 | {"install_script": |
|
268 | 269 | "ipython_win_post_install.py"}} |
|
269 | 270 | |
|
270 | 271 | else: |
|
271 | 272 | # scripts has to be a non-empty list, or install_scripts isn't called |
|
272 | 273 | setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()] |
|
273 | 274 | |
|
274 | 275 | setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt |
|
275 | 276 | |
|
276 | 277 | #--------------------------------------------------------------------------- |
|
277 | 278 | # Do the actual setup now |
|
278 | 279 | #--------------------------------------------------------------------------- |
|
279 | 280 | |
|
280 | 281 | setup_args.update(setuptools_extra_args) |
|
281 | 282 | |
|
282 | 283 | |
|
283 | 284 | |
|
284 | 285 | def main(): |
|
285 | 286 | setup(**setup_args) |
|
286 | 287 | |
|
287 | 288 | if __name__ == '__main__': |
|
288 | 289 | main() |
@@ -1,57 +1,56 b'' | |||
|
1 | 1 | """Various utilities common to IPython release and maintenance tools. |
|
2 | 2 | """ |
|
3 | 3 | from __future__ import print_function |
|
4 | 4 | |
|
5 | 5 | # Library imports |
|
6 | 6 | import os |
|
7 | 7 | |
|
8 | 8 | # Useful shorthands |
|
9 | 9 | pjoin = os.path.join |
|
10 | 10 | cd = os.chdir |
|
11 | 11 | |
|
12 | 12 | # Constants |
|
13 | 13 | |
|
14 | 14 | # SSH root address of the archive site |
|
15 | 15 | archive_user = 'ipython@archive.ipython.org' |
|
16 | 16 | archive_dir = 'archive.ipython.org' |
|
17 | 17 | archive = '%s:%s' % (archive_user, archive_dir) |
|
18 | 18 | |
|
19 | 19 | # Build commands |
|
20 | 20 | # Source dists |
|
21 | 21 | sdists = './setup.py sdist --formats=gztar,zip' |
|
22 | 22 | # Binary dists |
|
23 | 23 | def buildwheels(): |
|
24 | for py in ('2', '3'): | |
|
25 | sh('python%s setupegg.py bdist_wheel' % py) | |
|
24 | sh('python3 setupegg.py bdist_wheel' % py) | |
|
26 | 25 | |
|
27 | 26 | # Utility functions |
|
28 | 27 | def sh(cmd): |
|
29 | 28 | """Run system command in shell, raise SystemExit if it returns an error.""" |
|
30 | 29 | print("$", cmd) |
|
31 | 30 | stat = os.system(cmd) |
|
32 | 31 | #stat = 0 # Uncomment this and comment previous to run in debug mode |
|
33 | 32 | if stat: |
|
34 | 33 | raise SystemExit("Command %s failed with code: %s" % (cmd, stat)) |
|
35 | 34 | |
|
36 | 35 | # Backwards compatibility |
|
37 | 36 | c = sh |
|
38 | 37 | |
|
39 | 38 | def get_ipdir(): |
|
40 | 39 | """Get IPython directory from command line, or assume it's the one above.""" |
|
41 | 40 | |
|
42 | 41 | # Initialize arguments and check location |
|
43 | 42 | ipdir = pjoin(os.path.dirname(__file__), os.pardir) |
|
44 | 43 | |
|
45 | 44 | ipdir = os.path.abspath(ipdir) |
|
46 | 45 | |
|
47 | 46 | cd(ipdir) |
|
48 | 47 | if not os.path.isdir('IPython') and os.path.isfile('setup.py'): |
|
49 | 48 | raise SystemExit('Invalid ipython directory: %s' % ipdir) |
|
50 | 49 | return ipdir |
|
51 | 50 | |
|
52 | 51 | try: |
|
53 | 52 | execfile = execfile |
|
54 | 53 | except NameError: |
|
55 | 54 | def execfile(fname, globs, locs=None): |
|
56 | 55 | locs = locs or globs |
|
57 | 56 | exec(compile(open(fname).read(), fname, "exec"), globs, locs) |
General Comments 0
You need to be logged in to leave comments.
Login now