Show More
@@ -1,60 +1,60 b'' | |||||
1 | name: Run tests |
|
1 | name: Run tests | |
2 |
|
2 | |||
3 | on: |
|
3 | on: | |
4 | push: |
|
4 | push: | |
5 | pull_request: |
|
5 | pull_request: | |
6 | # Run weekly on Monday at 1:23 UTC |
|
6 | # Run weekly on Monday at 1:23 UTC | |
7 | schedule: |
|
7 | schedule: | |
8 | - cron: '23 1 * * 1' |
|
8 | - cron: '23 1 * * 1' | |
9 | workflow_dispatch: |
|
9 | workflow_dispatch: | |
10 |
|
10 | |||
11 |
|
11 | |||
12 | jobs: |
|
12 | jobs: | |
13 | test: |
|
13 | test: | |
14 | runs-on: ${{ matrix.os }} |
|
14 | runs-on: ${{ matrix.os }} | |
15 | strategy: |
|
15 | strategy: | |
16 | matrix: |
|
16 | matrix: | |
17 | os: [ubuntu-latest, windows-latest] |
|
17 | os: [ubuntu-latest, windows-latest] | |
18 |
python-version: [ |
|
18 | python-version: ["3.8", "3.9", "3.10"] | |
19 | deps: [test_extra] |
|
19 | deps: [test_extra] | |
20 | # Test all on ubuntu, test ends on macos |
|
20 | # Test all on ubuntu, test ends on macos | |
21 | include: |
|
21 | include: | |
22 | - os: macos-latest |
|
22 | - os: macos-latest | |
23 |
python-version: "3. |
|
23 | python-version: "3.8" | |
24 | deps: test_extra |
|
24 | deps: test_extra | |
25 | - os: macos-latest |
|
25 | - os: macos-latest | |
26 | python-version: "3.10" |
|
26 | python-version: "3.10" | |
27 | deps: test_extra |
|
27 | deps: test_extra | |
28 | # Tests minimal dependencies set |
|
28 | # Tests minimal dependencies set | |
29 | - os: ubuntu-latest |
|
29 | - os: ubuntu-latest | |
30 | python-version: "3.10" |
|
30 | python-version: "3.10" | |
31 | deps: test |
|
31 | deps: test | |
32 | # Tests latest development Python version |
|
32 | # Tests latest development Python version | |
33 | - os: ubuntu-latest |
|
33 | - os: ubuntu-latest | |
34 | python-version: "3.11-dev" |
|
34 | python-version: "3.11-dev" | |
35 | deps: test |
|
35 | deps: test | |
36 |
|
36 | |||
37 | steps: |
|
37 | steps: | |
38 | - uses: actions/checkout@v2 |
|
38 | - uses: actions/checkout@v2 | |
39 | - name: Set up Python ${{ matrix.python-version }} |
|
39 | - name: Set up Python ${{ matrix.python-version }} | |
40 | uses: actions/setup-python@v2 |
|
40 | uses: actions/setup-python@v2 | |
41 | with: |
|
41 | with: | |
42 | python-version: ${{ matrix.python-version }} |
|
42 | python-version: ${{ matrix.python-version }} | |
43 | - name: Install latex |
|
43 | - name: Install latex | |
44 | if: runner.os == 'Linux' && matrix.deps == 'test_extra' |
|
44 | if: runner.os == 'Linux' && matrix.deps == 'test_extra' | |
45 | run: sudo apt-get -yq -o Acquire::Retries=3 --no-install-suggests --no-install-recommends install texlive dvipng |
|
45 | run: sudo apt-get -yq -o Acquire::Retries=3 --no-install-suggests --no-install-recommends install texlive dvipng | |
46 | - name: Install and update Python dependencies |
|
46 | - name: Install and update Python dependencies | |
47 | run: | |
|
47 | run: | | |
48 | python -m pip install --upgrade pip setuptools wheel |
|
48 | python -m pip install --upgrade pip setuptools wheel | |
49 | python -m pip install --upgrade -e .[${{ matrix.deps }}] |
|
49 | python -m pip install --upgrade -e .[${{ matrix.deps }}] | |
50 | python -m pip install --upgrade check-manifest pytest-cov |
|
50 | python -m pip install --upgrade check-manifest pytest-cov | |
51 | - name: Check manifest |
|
51 | - name: Check manifest | |
52 | if: runner.os != 'Windows' # setup.py does not support sdist on Windows |
|
52 | if: runner.os != 'Windows' # setup.py does not support sdist on Windows | |
53 | run: check-manifest |
|
53 | run: check-manifest | |
54 | - name: pytest |
|
54 | - name: pytest | |
55 | env: |
|
55 | env: | |
56 | COLUMNS: 120 |
|
56 | COLUMNS: 120 | |
57 | run: | |
|
57 | run: | | |
58 | pytest --color=yes -ra -v --cov --cov-report=xml |
|
58 | pytest --color=yes -ra -v --cov --cov-report=xml | |
59 | - name: Upload coverage to Codecov |
|
59 | - name: Upload coverage to Codecov | |
60 | uses: codecov/codecov-action@v2 |
|
60 | uses: codecov/codecov-action@v2 |
@@ -1,143 +1,144 b'' | |||||
1 | # encoding: utf-8 |
|
|||
2 |
|
|
1 | """ | |
3 | IPython: tools for interactive and parallel computing in Python. |
|
2 | IPython: tools for interactive and parallel computing in Python. | |
4 |
|
3 | |||
5 | https://ipython.org |
|
4 | https://ipython.org | |
6 | """ |
|
5 | """ | |
7 | #----------------------------------------------------------------------------- |
|
6 | #----------------------------------------------------------------------------- | |
8 | # Copyright (c) 2008-2011, IPython Development Team. |
|
7 | # Copyright (c) 2008-2011, IPython Development Team. | |
9 | # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu> |
|
8 | # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu> | |
10 | # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de> |
|
9 | # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de> | |
11 | # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu> |
|
10 | # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu> | |
12 | # |
|
11 | # | |
13 | # Distributed under the terms of the Modified BSD License. |
|
12 | # Distributed under the terms of the Modified BSD License. | |
14 | # |
|
13 | # | |
15 | # The full license is in the file COPYING.txt, distributed with this software. |
|
14 | # The full license is in the file COPYING.txt, distributed with this software. | |
16 | #----------------------------------------------------------------------------- |
|
15 | #----------------------------------------------------------------------------- | |
17 |
|
16 | |||
18 | #----------------------------------------------------------------------------- |
|
17 | #----------------------------------------------------------------------------- | |
19 | # Imports |
|
18 | # Imports | |
20 | #----------------------------------------------------------------------------- |
|
19 | #----------------------------------------------------------------------------- | |
21 |
|
20 | |||
22 | import os |
|
21 | import os | |
23 | import sys |
|
22 | import sys | |
24 |
|
23 | |||
25 | #----------------------------------------------------------------------------- |
|
24 | #----------------------------------------------------------------------------- | |
26 | # Setup everything |
|
25 | # Setup everything | |
27 | #----------------------------------------------------------------------------- |
|
26 | #----------------------------------------------------------------------------- | |
28 |
|
27 | |||
29 | # Don't forget to also update setup.py when this changes! |
|
28 | # Don't forget to also update setup.py when this changes! | |
30 |
if sys.version_info < (3, |
|
29 | if sys.version_info < (3, 8): | |
31 | raise ImportError( |
|
30 | raise ImportError( | |
32 | """ |
|
31 | """ | |
33 |
IPython |
|
32 | IPython 8+ supports Python 3.8 and above, following NEP 29. | |
34 | When using Python 2.7, please install IPython 5.x LTS Long Term Support version. |
|
33 | When using Python 2.7, please install IPython 5.x LTS Long Term Support version. | |
35 | Python 3.3 and 3.4 were supported up to IPython 6.x. |
|
34 | 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. |
|
35 | Python 3.5 was supported with IPython 7.0 to 7.9. | |
|
36 | Python 3.6 was supported with IPython up to 7.16. | |||
|
37 | Python 3.7 was still supported with the 7.x branch. | |||
37 |
|
38 | |||
38 | See IPython `README.rst` file for more information: |
|
39 | See IPython `README.rst` file for more information: | |
39 |
|
40 | |||
40 | https://github.com/ipython/ipython/blob/master/README.rst |
|
41 | https://github.com/ipython/ipython/blob/master/README.rst | |
41 |
|
42 | |||
42 | """) |
|
43 | """) | |
43 |
|
44 | |||
44 | #----------------------------------------------------------------------------- |
|
45 | #----------------------------------------------------------------------------- | |
45 | # Setup the top level names |
|
46 | # Setup the top level names | |
46 | #----------------------------------------------------------------------------- |
|
47 | #----------------------------------------------------------------------------- | |
47 |
|
48 | |||
48 | from .core.getipython import get_ipython |
|
49 | from .core.getipython import get_ipython | |
49 | from .core import release |
|
50 | from .core import release | |
50 | from .core.application import Application |
|
51 | from .core.application import Application | |
51 | from .terminal.embed import embed |
|
52 | from .terminal.embed import embed | |
52 |
|
53 | |||
53 | from .core.interactiveshell import InteractiveShell |
|
54 | from .core.interactiveshell import InteractiveShell | |
54 | from .utils.sysinfo import sys_info |
|
55 | from .utils.sysinfo import sys_info | |
55 | from .utils.frame import extract_module_locals |
|
56 | from .utils.frame import extract_module_locals | |
56 |
|
57 | |||
57 | # Release data |
|
58 | # Release data | |
58 | __author__ = '%s <%s>' % (release.author, release.author_email) |
|
59 | __author__ = '%s <%s>' % (release.author, release.author_email) | |
59 | __license__ = release.license |
|
60 | __license__ = release.license | |
60 | __version__ = release.version |
|
61 | __version__ = release.version | |
61 | version_info = release.version_info |
|
62 | version_info = release.version_info | |
62 |
|
63 | |||
63 | def embed_kernel(module=None, local_ns=None, **kwargs): |
|
64 | def embed_kernel(module=None, local_ns=None, **kwargs): | |
64 | """Embed and start an IPython kernel in a given scope. |
|
65 | """Embed and start an IPython kernel in a given scope. | |
65 |
|
66 | |||
66 | If you don't want the kernel to initialize the namespace |
|
67 | If you don't want the kernel to initialize the namespace | |
67 | from the scope of the surrounding function, |
|
68 | from the scope of the surrounding function, | |
68 | and/or you want to load full IPython configuration, |
|
69 | and/or you want to load full IPython configuration, | |
69 | you probably want `IPython.start_kernel()` instead. |
|
70 | you probably want `IPython.start_kernel()` instead. | |
70 |
|
71 | |||
71 | Parameters |
|
72 | Parameters | |
72 | ---------- |
|
73 | ---------- | |
73 | module : types.ModuleType, optional |
|
74 | module : types.ModuleType, optional | |
74 | The module to load into IPython globals (default: caller) |
|
75 | The module to load into IPython globals (default: caller) | |
75 | local_ns : dict, optional |
|
76 | local_ns : dict, optional | |
76 | The namespace to load into IPython user namespace (default: caller) |
|
77 | The namespace to load into IPython user namespace (default: caller) | |
77 | **kwargs : various, optional |
|
78 | **kwargs : various, optional | |
78 | Further keyword args are relayed to the IPKernelApp constructor, |
|
79 | Further keyword args are relayed to the IPKernelApp constructor, | |
79 | allowing configuration of the Kernel. Will only have an effect |
|
80 | allowing configuration of the Kernel. Will only have an effect | |
80 | on the first embed_kernel call for a given process. |
|
81 | on the first embed_kernel call for a given process. | |
81 | """ |
|
82 | """ | |
82 |
|
83 | |||
83 | (caller_module, caller_locals) = extract_module_locals(1) |
|
84 | (caller_module, caller_locals) = extract_module_locals(1) | |
84 | if module is None: |
|
85 | if module is None: | |
85 | module = caller_module |
|
86 | module = caller_module | |
86 | if local_ns is None: |
|
87 | if local_ns is None: | |
87 | local_ns = caller_locals |
|
88 | local_ns = caller_locals | |
88 |
|
89 | |||
89 | # Only import .zmq when we really need it |
|
90 | # Only import .zmq when we really need it | |
90 | from ipykernel.embed import embed_kernel as real_embed_kernel |
|
91 | from ipykernel.embed import embed_kernel as real_embed_kernel | |
91 | real_embed_kernel(module=module, local_ns=local_ns, **kwargs) |
|
92 | real_embed_kernel(module=module, local_ns=local_ns, **kwargs) | |
92 |
|
93 | |||
93 | def start_ipython(argv=None, **kwargs): |
|
94 | def start_ipython(argv=None, **kwargs): | |
94 | """Launch a normal IPython instance (as opposed to embedded) |
|
95 | """Launch a normal IPython instance (as opposed to embedded) | |
95 |
|
96 | |||
96 | `IPython.embed()` puts a shell in a particular calling scope, |
|
97 | `IPython.embed()` puts a shell in a particular calling scope, | |
97 | such as a function or method for debugging purposes, |
|
98 | such as a function or method for debugging purposes, | |
98 | which is often not desirable. |
|
99 | which is often not desirable. | |
99 |
|
100 | |||
100 | `start_ipython()` does full, regular IPython initialization, |
|
101 | `start_ipython()` does full, regular IPython initialization, | |
101 | including loading startup files, configuration, etc. |
|
102 | including loading startup files, configuration, etc. | |
102 | much of which is skipped by `embed()`. |
|
103 | much of which is skipped by `embed()`. | |
103 |
|
104 | |||
104 | This is a public API method, and will survive implementation changes. |
|
105 | This is a public API method, and will survive implementation changes. | |
105 |
|
106 | |||
106 | Parameters |
|
107 | Parameters | |
107 | ---------- |
|
108 | ---------- | |
108 | argv : list or None, optional |
|
109 | argv : list or None, optional | |
109 | If unspecified or None, IPython will parse command-line options from sys.argv. |
|
110 | If unspecified or None, IPython will parse command-line options from sys.argv. | |
110 | To prevent any command-line parsing, pass an empty list: `argv=[]`. |
|
111 | To prevent any command-line parsing, pass an empty list: `argv=[]`. | |
111 | user_ns : dict, optional |
|
112 | user_ns : dict, optional | |
112 | specify this dictionary to initialize the IPython user namespace with particular values. |
|
113 | specify this dictionary to initialize the IPython user namespace with particular values. | |
113 | **kwargs : various, optional |
|
114 | **kwargs : various, optional | |
114 | Any other kwargs will be passed to the Application constructor, |
|
115 | Any other kwargs will be passed to the Application constructor, | |
115 | such as `config`. |
|
116 | such as `config`. | |
116 | """ |
|
117 | """ | |
117 | from IPython.terminal.ipapp import launch_new_instance |
|
118 | from IPython.terminal.ipapp import launch_new_instance | |
118 | return launch_new_instance(argv=argv, **kwargs) |
|
119 | return launch_new_instance(argv=argv, **kwargs) | |
119 |
|
120 | |||
120 | def start_kernel(argv=None, **kwargs): |
|
121 | def start_kernel(argv=None, **kwargs): | |
121 | """Launch a normal IPython kernel instance (as opposed to embedded) |
|
122 | """Launch a normal IPython kernel instance (as opposed to embedded) | |
122 |
|
123 | |||
123 | `IPython.embed_kernel()` puts a shell in a particular calling scope, |
|
124 | `IPython.embed_kernel()` puts a shell in a particular calling scope, | |
124 | such as a function or method for debugging purposes, |
|
125 | such as a function or method for debugging purposes, | |
125 | which is often not desirable. |
|
126 | which is often not desirable. | |
126 |
|
127 | |||
127 | `start_kernel()` does full, regular IPython initialization, |
|
128 | `start_kernel()` does full, regular IPython initialization, | |
128 | including loading startup files, configuration, etc. |
|
129 | including loading startup files, configuration, etc. | |
129 | much of which is skipped by `embed()`. |
|
130 | much of which is skipped by `embed()`. | |
130 |
|
131 | |||
131 | Parameters |
|
132 | Parameters | |
132 | ---------- |
|
133 | ---------- | |
133 | argv : list or None, optional |
|
134 | argv : list or None, optional | |
134 | If unspecified or None, IPython will parse command-line options from sys.argv. |
|
135 | If unspecified or None, IPython will parse command-line options from sys.argv. | |
135 | To prevent any command-line parsing, pass an empty list: `argv=[]`. |
|
136 | To prevent any command-line parsing, pass an empty list: `argv=[]`. | |
136 | user_ns : dict, optional |
|
137 | user_ns : dict, optional | |
137 | specify this dictionary to initialize the IPython user namespace with particular values. |
|
138 | specify this dictionary to initialize the IPython user namespace with particular values. | |
138 | **kwargs : various, optional |
|
139 | **kwargs : various, optional | |
139 | Any other kwargs will be passed to the Application constructor, |
|
140 | Any other kwargs will be passed to the Application constructor, | |
140 | such as `config`. |
|
141 | such as `config`. | |
141 | """ |
|
142 | """ | |
142 | from IPython.kernel.zmq.kernelapp import launch_new_instance |
|
143 | from IPython.kernel.zmq.kernelapp import launch_new_instance | |
143 | return launch_new_instance(argv=argv, **kwargs) |
|
144 | return launch_new_instance(argv=argv, **kwargs) |
@@ -1,28 +1,27 b'' | |||||
1 | build: false |
|
1 | build: false | |
2 | matrix: |
|
2 | matrix: | |
3 | fast_finish: true # immediately finish build once one of the jobs fails. |
|
3 | fast_finish: true # immediately finish build once one of the jobs fails. | |
4 |
|
4 | |||
5 | environment: |
|
5 | environment: | |
6 | global: |
|
6 | global: | |
7 | APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022' |
|
7 | APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022' | |
8 | COLUMNS: 120 # Appveyor web viwer window width is 130 chars |
|
8 | COLUMNS: 120 # Appveyor web viwer window width is 130 chars | |
9 |
|
9 | |||
10 | matrix: |
|
10 | matrix: | |
11 |
|
||||
12 | - PYTHON: "C:\\Python38" |
|
11 | - PYTHON: "C:\\Python38" | |
13 | PYTHON_VERSION: "3.8.x" |
|
12 | PYTHON_VERSION: "3.8.x" | |
14 | PYTHON_ARCH: "32" |
|
13 | PYTHON_ARCH: "32" | |
15 |
|
14 | |||
16 | init: |
|
15 | init: | |
17 | - "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%" |
|
16 | - "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%" | |
18 |
|
17 | |||
19 | install: |
|
18 | install: | |
20 | - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" |
|
19 | - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" | |
21 | - python -m pip install --upgrade setuptools pip |
|
20 | - python -m pip install --upgrade setuptools pip | |
22 | - pip install pytest-cov |
|
21 | - pip install pytest-cov | |
23 | - pip install -e .[test_extra] |
|
22 | - pip install -e .[test_extra] | |
24 | test_script: |
|
23 | test_script: | |
25 | - pytest --color=yes -ra --cov --cov-report=xml |
|
24 | - pytest --color=yes -ra --cov --cov-report=xml | |
26 | on_finish: |
|
25 | on_finish: | |
27 | - curl -Os https://uploader.codecov.io/latest/windows/codecov.exe |
|
26 | - curl -Os https://uploader.codecov.io/latest/windows/codecov.exe | |
28 | - codecov -e PYTHON_VERSION,PYTHON_ARCH |
|
27 | - codecov -e PYTHON_VERSION,PYTHON_ARCH |
@@ -1,279 +1,280 b'' | |||||
1 | #!/usr/bin/env python3 |
|
1 | #!/usr/bin/env python3 | |
2 | # -*- coding: utf-8 -*- |
|
2 | # -*- coding: utf-8 -*- | |
3 | """Setup script for IPython. |
|
3 | """Setup script for IPython. | |
4 |
|
4 | |||
5 | Under Posix environments it works like a typical setup.py script. |
|
5 | Under Posix environments it works like a typical setup.py script. | |
6 | Under Windows, the command sdist is not supported, since IPython |
|
6 | Under Windows, the command sdist is not supported, since IPython | |
7 | requires utilities which are not available under Windows.""" |
|
7 | requires utilities which are not available under Windows.""" | |
8 |
|
8 | |||
9 | #----------------------------------------------------------------------------- |
|
9 | #----------------------------------------------------------------------------- | |
10 | # Copyright (c) 2008-2011, IPython Development Team. |
|
10 | # Copyright (c) 2008-2011, IPython Development Team. | |
11 | # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu> |
|
11 | # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu> | |
12 | # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de> |
|
12 | # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de> | |
13 | # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu> |
|
13 | # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu> | |
14 | # |
|
14 | # | |
15 | # Distributed under the terms of the Modified BSD License. |
|
15 | # Distributed under the terms of the Modified BSD License. | |
16 | # |
|
16 | # | |
17 | # The full license is in the file COPYING.rst, distributed with this software. |
|
17 | # The full license is in the file COPYING.rst, distributed with this software. | |
18 | #----------------------------------------------------------------------------- |
|
18 | #----------------------------------------------------------------------------- | |
19 |
|
19 | |||
20 | import os |
|
20 | import os | |
21 | import sys |
|
21 | import sys | |
22 | from pathlib import Path |
|
22 | from pathlib import Path | |
23 |
|
23 | |||
24 | # **Python version check** |
|
24 | # **Python version check** | |
25 | # |
|
25 | # | |
26 | # This check is also made in IPython/__init__, don't forget to update both when |
|
26 | # This check is also made in IPython/__init__, don't forget to update both when | |
27 | # changing Python version requirements. |
|
27 | # changing Python version requirements. | |
28 |
if sys.version_info < (3, |
|
28 | if sys.version_info < (3, 8): | |
29 | pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.' |
|
29 | pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.' | |
30 | try: |
|
30 | try: | |
31 | import pip |
|
31 | import pip | |
32 | pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]]) |
|
32 | pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]]) | |
33 | if pip_version < (9, 0, 1) : |
|
33 | if pip_version < (9, 0, 1) : | |
34 | pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\ |
|
34 | pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\ | |
35 | 'pip {} detected.'.format(pip.__version__) |
|
35 | 'pip {} detected.'.format(pip.__version__) | |
36 | else: |
|
36 | else: | |
37 | # pip is new enough - it must be something else |
|
37 | # pip is new enough - it must be something else | |
38 | pip_message = '' |
|
38 | pip_message = '' | |
39 | except Exception: |
|
39 | except Exception: | |
40 | pass |
|
40 | pass | |
41 |
|
41 | |||
42 |
|
42 | |||
43 | error = """ |
|
43 | error = """ | |
44 |
IPython |
|
44 | IPython 8+ supports Python 3.8 and above, following NEP 29. | |
45 | When using Python 2.7, please install IPython 5.x LTS Long Term Support version. |
|
45 | When using Python 2.7, please install IPython 5.x LTS Long Term Support version. | |
46 | Python 3.3 and 3.4 were supported up to IPython 6.x. |
|
46 | Python 3.3 and 3.4 were supported up to IPython 6.x. | |
47 | Python 3.5 was supported with IPython 7.0 to 7.9. |
|
47 | Python 3.5 was supported with IPython 7.0 to 7.9. | |
48 | Python 3.6 was supported with IPython up to 7.16. |
|
48 | Python 3.6 was supported with IPython up to 7.16. | |
|
49 | Python 3.7 was still supported with the 7.x branch. | |||
49 |
|
50 | |||
50 | See IPython `README.rst` file for more information: |
|
51 | See IPython `README.rst` file for more information: | |
51 |
|
52 | |||
52 | https://github.com/ipython/ipython/blob/master/README.rst |
|
53 | https://github.com/ipython/ipython/blob/master/README.rst | |
53 |
|
54 | |||
54 | Python {py} detected. |
|
55 | Python {py} detected. | |
55 | {pip} |
|
56 | {pip} | |
56 | """.format(py=sys.version_info, pip=pip_message ) |
|
57 | """.format(py=sys.version_info, pip=pip_message ) | |
57 |
|
58 | |||
58 | print(error, file=sys.stderr) |
|
59 | print(error, file=sys.stderr) | |
59 | sys.exit(1) |
|
60 | sys.exit(1) | |
60 |
|
61 | |||
61 | # At least we're on the python version we need, move on. |
|
62 | # At least we're on the python version we need, move on. | |
62 |
|
63 | |||
63 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly |
|
64 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly | |
64 | # update it when the contents of directories change. |
|
65 | # update it when the contents of directories change. | |
65 | if Path("MANIFEST").exists(): |
|
66 | if Path("MANIFEST").exists(): | |
66 | Path("MANIFEST").unlink() |
|
67 | Path("MANIFEST").unlink() | |
67 |
|
68 | |||
68 | from distutils.core import setup |
|
69 | from distutils.core import setup | |
69 |
|
70 | |||
70 | # Our own imports |
|
71 | # Our own imports | |
71 | from setupbase import target_update |
|
72 | from setupbase import target_update | |
72 |
|
73 | |||
73 | from setupbase import ( |
|
74 | from setupbase import ( | |
74 | setup_args, |
|
75 | setup_args, | |
75 | find_packages, |
|
76 | find_packages, | |
76 | find_package_data, |
|
77 | find_package_data, | |
77 | check_package_data_first, |
|
78 | check_package_data_first, | |
78 | find_entry_points, |
|
79 | find_entry_points, | |
79 | build_scripts_entrypt, |
|
80 | build_scripts_entrypt, | |
80 | find_data_files, |
|
81 | find_data_files, | |
81 | git_prebuild, |
|
82 | git_prebuild, | |
82 | install_symlinked, |
|
83 | install_symlinked, | |
83 | install_lib_symlink, |
|
84 | install_lib_symlink, | |
84 | install_scripts_for_symlink, |
|
85 | install_scripts_for_symlink, | |
85 | unsymlink, |
|
86 | unsymlink, | |
86 | ) |
|
87 | ) | |
87 |
|
88 | |||
88 | #------------------------------------------------------------------------------- |
|
89 | #------------------------------------------------------------------------------- | |
89 | # Handle OS specific things |
|
90 | # Handle OS specific things | |
90 | #------------------------------------------------------------------------------- |
|
91 | #------------------------------------------------------------------------------- | |
91 |
|
92 | |||
92 | if os.name in ('nt','dos'): |
|
93 | if os.name in ('nt','dos'): | |
93 | os_name = 'windows' |
|
94 | os_name = 'windows' | |
94 | else: |
|
95 | else: | |
95 | os_name = os.name |
|
96 | os_name = os.name | |
96 |
|
97 | |||
97 | # Under Windows, 'sdist' has not been supported. Now that the docs build with |
|
98 | # Under Windows, 'sdist' has not been supported. Now that the docs build with | |
98 | # Sphinx it might work, but let's not turn it on until someone confirms that it |
|
99 | # Sphinx it might work, but let's not turn it on until someone confirms that it | |
99 | # actually works. |
|
100 | # actually works. | |
100 | if os_name == 'windows' and 'sdist' in sys.argv: |
|
101 | if os_name == 'windows' and 'sdist' in sys.argv: | |
101 | print('The sdist command is not available under Windows. Exiting.') |
|
102 | print('The sdist command is not available under Windows. Exiting.') | |
102 | sys.exit(1) |
|
103 | sys.exit(1) | |
103 |
|
104 | |||
104 |
|
105 | |||
105 | #------------------------------------------------------------------------------- |
|
106 | #------------------------------------------------------------------------------- | |
106 | # Things related to the IPython documentation |
|
107 | # Things related to the IPython documentation | |
107 | #------------------------------------------------------------------------------- |
|
108 | #------------------------------------------------------------------------------- | |
108 |
|
109 | |||
109 | # update the manuals when building a source dist |
|
110 | # update the manuals when building a source dist | |
110 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): |
|
111 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): | |
111 |
|
112 | |||
112 | # List of things to be updated. Each entry is a triplet of args for |
|
113 | # List of things to be updated. Each entry is a triplet of args for | |
113 | # target_update() |
|
114 | # target_update() | |
114 | to_update = [ |
|
115 | to_update = [ | |
115 | ('docs/man/ipython.1.gz', |
|
116 | ('docs/man/ipython.1.gz', | |
116 | ['docs/man/ipython.1'], |
|
117 | ['docs/man/ipython.1'], | |
117 | 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'), |
|
118 | 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'), | |
118 | ] |
|
119 | ] | |
119 |
|
120 | |||
120 |
|
121 | |||
121 | [ target_update(*t) for t in to_update ] |
|
122 | [ target_update(*t) for t in to_update ] | |
122 |
|
123 | |||
123 | #--------------------------------------------------------------------------- |
|
124 | #--------------------------------------------------------------------------- | |
124 | # Find all the packages, package data, and data_files |
|
125 | # Find all the packages, package data, and data_files | |
125 | #--------------------------------------------------------------------------- |
|
126 | #--------------------------------------------------------------------------- | |
126 |
|
127 | |||
127 | packages = find_packages() |
|
128 | packages = find_packages() | |
128 | package_data = find_package_data() |
|
129 | package_data = find_package_data() | |
129 |
|
130 | |||
130 | data_files = find_data_files() |
|
131 | data_files = find_data_files() | |
131 |
|
132 | |||
132 | setup_args['packages'] = packages |
|
133 | setup_args['packages'] = packages | |
133 | setup_args['package_data'] = package_data |
|
134 | setup_args['package_data'] = package_data | |
134 | setup_args['data_files'] = data_files |
|
135 | setup_args['data_files'] = data_files | |
135 |
|
136 | |||
136 | #--------------------------------------------------------------------------- |
|
137 | #--------------------------------------------------------------------------- | |
137 | # custom distutils commands |
|
138 | # custom distutils commands | |
138 | #--------------------------------------------------------------------------- |
|
139 | #--------------------------------------------------------------------------- | |
139 | # imports here, so they are after setuptools import if there was one |
|
140 | # imports here, so they are after setuptools import if there was one | |
140 | from distutils.command.sdist import sdist |
|
141 | from distutils.command.sdist import sdist | |
141 |
|
142 | |||
142 | setup_args['cmdclass'] = { |
|
143 | setup_args['cmdclass'] = { | |
143 | 'build_py': \ |
|
144 | 'build_py': \ | |
144 | check_package_data_first(git_prebuild('IPython')), |
|
145 | check_package_data_first(git_prebuild('IPython')), | |
145 | 'sdist' : git_prebuild('IPython', sdist), |
|
146 | 'sdist' : git_prebuild('IPython', sdist), | |
146 | 'symlink': install_symlinked, |
|
147 | 'symlink': install_symlinked, | |
147 | 'install_lib_symlink': install_lib_symlink, |
|
148 | 'install_lib_symlink': install_lib_symlink, | |
148 | 'install_scripts_sym': install_scripts_for_symlink, |
|
149 | 'install_scripts_sym': install_scripts_for_symlink, | |
149 | 'unsymlink': unsymlink, |
|
150 | 'unsymlink': unsymlink, | |
150 | } |
|
151 | } | |
151 |
|
152 | |||
152 |
|
153 | |||
153 | #--------------------------------------------------------------------------- |
|
154 | #--------------------------------------------------------------------------- | |
154 | # Handle scripts, dependencies, and setuptools specific things |
|
155 | # Handle scripts, dependencies, and setuptools specific things | |
155 | #--------------------------------------------------------------------------- |
|
156 | #--------------------------------------------------------------------------- | |
156 |
|
157 | |||
157 | # For some commands, use setuptools. Note that we do NOT list install here! |
|
158 | # For some commands, use setuptools. Note that we do NOT list install here! | |
158 | # If you want a setuptools-enhanced install, just run 'setupegg.py install' |
|
159 | # If you want a setuptools-enhanced install, just run 'setupegg.py install' | |
159 | needs_setuptools = {'develop', 'release', 'bdist_egg', 'bdist_rpm', |
|
160 | needs_setuptools = {'develop', 'release', 'bdist_egg', 'bdist_rpm', | |
160 | 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel', |
|
161 | 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel', | |
161 | 'egg_info', 'easy_install', 'upload', 'install_egg_info', |
|
162 | 'egg_info', 'easy_install', 'upload', 'install_egg_info', | |
162 | } |
|
163 | } | |
163 |
|
164 | |||
164 | if len(needs_setuptools.intersection(sys.argv)) > 0: |
|
165 | if len(needs_setuptools.intersection(sys.argv)) > 0: | |
165 | import setuptools |
|
166 | import setuptools | |
166 |
|
167 | |||
167 | # This dict is used for passing extra arguments that are setuptools |
|
168 | # This dict is used for passing extra arguments that are setuptools | |
168 | # specific to setup |
|
169 | # specific to setup | |
169 | setuptools_extra_args = {} |
|
170 | setuptools_extra_args = {} | |
170 |
|
171 | |||
171 | # setuptools requirements |
|
172 | # setuptools requirements | |
172 |
|
173 | |||
173 | extras_require = dict( |
|
174 | extras_require = dict( | |
174 | parallel=["ipyparallel"], |
|
175 | parallel=["ipyparallel"], | |
175 | qtconsole=["qtconsole"], |
|
176 | qtconsole=["qtconsole"], | |
176 | doc=["Sphinx>=1.3"], |
|
177 | doc=["Sphinx>=1.3"], | |
177 | test=[ |
|
178 | test=[ | |
178 | "pytest", |
|
179 | "pytest", | |
179 | "testpath", |
|
180 | "testpath", | |
180 | "pygments", |
|
181 | "pygments", | |
181 | ], |
|
182 | ], | |
182 | test_extra=[ |
|
183 | test_extra=[ | |
183 | "pytest", |
|
184 | "pytest", | |
184 | "testpath", |
|
185 | "testpath", | |
185 | "curio", |
|
186 | "curio", | |
186 | "matplotlib!=3.2.0", |
|
187 | "matplotlib!=3.2.0", | |
187 | "nbformat", |
|
188 | "nbformat", | |
188 | "numpy>=1.17", |
|
189 | "numpy>=1.17", | |
189 | "pandas", |
|
190 | "pandas", | |
190 | "pygments", |
|
191 | "pygments", | |
191 | "trio", |
|
192 | "trio", | |
192 | ], |
|
193 | ], | |
193 | terminal=[], |
|
194 | terminal=[], | |
194 | kernel=["ipykernel"], |
|
195 | kernel=["ipykernel"], | |
195 | nbformat=["nbformat"], |
|
196 | nbformat=["nbformat"], | |
196 | notebook=["notebook", "ipywidgets"], |
|
197 | notebook=["notebook", "ipywidgets"], | |
197 | nbconvert=["nbconvert"], |
|
198 | nbconvert=["nbconvert"], | |
198 | ) |
|
199 | ) | |
199 |
|
200 | |||
200 | install_requires = [ |
|
201 | install_requires = [ | |
201 | "setuptools>=18.5", |
|
202 | "setuptools>=18.5", | |
202 | "jedi>=0.16", |
|
203 | "jedi>=0.16", | |
203 | "decorator", |
|
204 | "decorator", | |
204 | "pickleshare", |
|
205 | "pickleshare", | |
205 | "traitlets>=4.2", |
|
206 | "traitlets>=4.2", | |
206 | "prompt_toolkit>=2.0.0,<3.1.0,!=3.0.0,!=3.0.1", |
|
207 | "prompt_toolkit>=2.0.0,<3.1.0,!=3.0.0,!=3.0.1", | |
207 | "pygments", |
|
208 | "pygments", | |
208 | "backcall", |
|
209 | "backcall", | |
209 | "stack_data", |
|
210 | "stack_data", | |
210 | "matplotlib-inline", |
|
211 | "matplotlib-inline", | |
211 | ] |
|
212 | ] | |
212 |
|
213 | |||
213 | # Platform-specific dependencies: |
|
214 | # Platform-specific dependencies: | |
214 | # This is the correct way to specify these, |
|
215 | # This is the correct way to specify these, | |
215 | # but requires pip >= 6. pip < 6 ignores these. |
|
216 | # but requires pip >= 6. pip < 6 ignores these. | |
216 |
|
217 | |||
217 | extras_require.update( |
|
218 | extras_require.update( | |
218 | { |
|
219 | { | |
219 | ':sys_platform != "win32"': ["pexpect>4.3"], |
|
220 | ':sys_platform != "win32"': ["pexpect>4.3"], | |
220 | ':sys_platform == "darwin"': ["appnope"], |
|
221 | ':sys_platform == "darwin"': ["appnope"], | |
221 | ':sys_platform == "win32"': ["colorama"], |
|
222 | ':sys_platform == "win32"': ["colorama"], | |
222 | } |
|
223 | } | |
223 | ) |
|
224 | ) | |
224 | # FIXME: re-specify above platform dependencies for pip < 6 |
|
225 | # FIXME: re-specify above platform dependencies for pip < 6 | |
225 | # These would result in non-portable bdists. |
|
226 | # These would result in non-portable bdists. | |
226 | if not any(arg.startswith('bdist') for arg in sys.argv): |
|
227 | if not any(arg.startswith('bdist') for arg in sys.argv): | |
227 | if sys.platform == 'darwin': |
|
228 | if sys.platform == 'darwin': | |
228 | install_requires.extend(['appnope']) |
|
229 | install_requires.extend(['appnope']) | |
229 |
|
230 | |||
230 | if not sys.platform.startswith("win"): |
|
231 | if not sys.platform.startswith("win"): | |
231 | install_requires.append("pexpect>4.3") |
|
232 | install_requires.append("pexpect>4.3") | |
232 |
|
233 | |||
233 | # workaround pypa/setuptools#147, where setuptools misspells |
|
234 | # workaround pypa/setuptools#147, where setuptools misspells | |
234 | # platform_python_implementation as python_implementation |
|
235 | # platform_python_implementation as python_implementation | |
235 | if 'setuptools' in sys.modules: |
|
236 | if 'setuptools' in sys.modules: | |
236 | for key in list(extras_require): |
|
237 | for key in list(extras_require): | |
237 | if 'platform_python_implementation' in key: |
|
238 | if 'platform_python_implementation' in key: | |
238 | new_key = key.replace('platform_python_implementation', 'python_implementation') |
|
239 | new_key = key.replace('platform_python_implementation', 'python_implementation') | |
239 | extras_require[new_key] = extras_require.pop(key) |
|
240 | extras_require[new_key] = extras_require.pop(key) | |
240 |
|
241 | |||
241 | everything = set() |
|
242 | everything = set() | |
242 | for key, deps in extras_require.items(): |
|
243 | for key, deps in extras_require.items(): | |
243 | if ':' not in key: |
|
244 | if ':' not in key: | |
244 | everything.update(deps) |
|
245 | everything.update(deps) | |
245 | extras_require['all'] = list(sorted(everything)) |
|
246 | extras_require['all'] = list(sorted(everything)) | |
246 |
|
247 | |||
247 |
if |
|
248 | if "setuptools" in sys.modules: | |
248 |
setuptools_extra_args[ |
|
249 | setuptools_extra_args["python_requires"] = ">=3.8" | |
249 |
setuptools_extra_args[ |
|
250 | setuptools_extra_args["zip_safe"] = False | |
250 |
setuptools_extra_args[ |
|
251 | setuptools_extra_args["entry_points"] = { | |
251 |
|
|
252 | "console_scripts": find_entry_points(), | |
252 |
|
|
253 | "pygments.lexers": [ | |
253 |
|
|
254 | "ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer", | |
254 |
|
|
255 | "ipython = IPython.lib.lexers:IPythonLexer", | |
255 |
|
|
256 | "ipython3 = IPython.lib.lexers:IPython3Lexer", | |
256 | ], |
|
257 | ], | |
257 | } |
|
258 | } | |
258 | setup_args['extras_require'] = extras_require |
|
259 | setup_args['extras_require'] = extras_require | |
259 | setup_args['install_requires'] = install_requires |
|
260 | setup_args['install_requires'] = install_requires | |
260 |
|
261 | |||
261 | else: |
|
262 | else: | |
262 | # scripts has to be a non-empty list, or install_scripts isn't called |
|
263 | # scripts has to be a non-empty list, or install_scripts isn't called | |
263 | setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()] |
|
264 | setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()] | |
264 |
|
265 | |||
265 | setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt |
|
266 | setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt | |
266 |
|
267 | |||
267 | #--------------------------------------------------------------------------- |
|
268 | #--------------------------------------------------------------------------- | |
268 | # Do the actual setup now |
|
269 | # Do the actual setup now | |
269 | #--------------------------------------------------------------------------- |
|
270 | #--------------------------------------------------------------------------- | |
270 |
|
271 | |||
271 | setup_args.update(setuptools_extra_args) |
|
272 | setup_args.update(setuptools_extra_args) | |
272 |
|
273 | |||
273 |
|
274 | |||
274 |
|
275 | |||
275 | def main(): |
|
276 | def main(): | |
276 | setup(**setup_args) |
|
277 | setup(**setup_args) | |
277 |
|
278 | |||
278 | if __name__ == '__main__': |
|
279 | if __name__ == '__main__': | |
279 | main() |
|
280 | main() |
General Comments 0
You need to be logged in to leave comments.
Login now