New upstream version 6.4.0
Gordon Ball
2 years ago
0 | 0 | [bumpversion] |
1 | current_version = 6.2.0 | |
1 | current_version = 6.4.0 | |
2 | 2 | parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(.(?P<suffix>.+))? |
3 | 3 | serialize = |
4 | 4 | {major}.{minor}.{patch}.{suffix} |
15 | 15 | serialize = |
16 | 16 | {major}, {minor}, {patch}, '{suffix}' |
17 | 17 | {major}, {minor}, {patch} |
18 |
24 | 24 | python-version: ${{ matrix.python-version }} |
25 | 25 | - name: Install dependencies |
26 | 26 | run: | |
27 | python -m pip install --upgrade pip | |
28 | pip install pytest nose | |
27 | python -m pip install --upgrade pip check-manifest | |
28 | pip install pytest pytest-cov | |
29 | 29 | pip install . |
30 | 30 | python -m ipykernel.kernelspec --user |
31 | 31 | - name: Test with pytest |
32 | 32 | run: | |
33 | pytest | |
33 | pytest --cov jupyter_console | |
34 | - name: Check Manifest | |
35 | run: | | |
36 | check-manifest |
0 | language: python | |
1 | python: | |
2 | - 3.7 | |
3 | - 3.8 | |
4 | before_install: | |
5 | - git clone --quiet --depth 1 https://github.com/minrk/travis-wheels travis-wheels | |
6 | install: | |
7 | - pip install --upgrade pip | |
8 | - pip install --upgrade setuptools | |
9 | - pip install mypy darker pep517 check-manifest | |
10 | - pip install -f travis-wheels/wheelhouse --pre -e . coveralls | |
11 | - python -m ipykernel.kernelspec --user | |
12 | script: | |
13 | - python -m pep517.build . | |
14 | - check-manifest | |
15 | - nosetests --with-coverage --cover-package=jupyter_console jupyter_console | |
16 | - darker -r ac4cf65598ea417f6b69a80c162904bbce7547b3 jupyter_console | |
17 | - mypy jupyter_console | |
18 | after_success: | |
19 | - coveralls |
0 | Metadata-Version: 2.1 | |
1 | Name: jupyter_console | |
2 | Version: 6.2.0 | |
3 | Summary: Jupyter terminal console | |
4 | Home-page: https://jupyter.org | |
5 | Author: Jupyter Development Team | |
6 | Author-email: jupyter@googlegroups.com | |
7 | License: BSD | |
8 | Description: An IPython-like terminal frontend for Jupyter kernels in any language. | |
9 | Keywords: Interactive,Interpreter,Shell,Web | |
10 | Platform: Linux | |
11 | Platform: Mac OS X | |
12 | Platform: Windows | |
13 | Classifier: Intended Audience :: Developers | |
14 | Classifier: Intended Audience :: System Administrators | |
15 | Classifier: Intended Audience :: Science/Research | |
16 | Classifier: License :: OSI Approved :: BSD License | |
17 | Classifier: Programming Language :: Python | |
18 | Classifier: Programming Language :: Python :: 3 | |
19 | Requires-Python: >=3.6 | |
20 | Provides-Extra: test |
4 | 4 | See PEP 440 https://www.python.org/dev/peps/pep-0440/ |
5 | 5 | """ |
6 | 6 | |
7 | version_info = (6, 2, 0) | |
7 | version_info = (6, 4, 0) | |
8 | 8 | |
9 | 9 | __version__ = '.'.join(map(str, version_info[:3])) + ''.join(version_info[3:]) |
8 | 8 | |
9 | 9 | from __future__ import print_function |
10 | 10 | |
11 | import logging | |
12 | 11 | import signal |
13 | 12 | import sys |
14 | 13 | |
17 | 16 | ) |
18 | 17 | from traitlets.config import catch_config_error, boolean_flag |
19 | 18 | |
20 | from jupyter_core.application import JupyterApp, base_aliases, base_flags, NoStart | |
19 | from jupyter_core.application import JupyterApp, base_aliases, base_flags | |
21 | 20 | from jupyter_client.consoleapp import ( |
22 | 21 | JupyterConsoleApp, app_aliases, app_flags, |
23 | 22 | ) |
140 | 139 | def init_banner(self): |
141 | 140 | """optionally display the banner""" |
142 | 141 | self.shell.show_banner() |
143 | # Make sure there is a space below the banner. | |
144 | #if self.log_level <= logging.INFO: print() | |
145 | 142 | |
146 | 143 | def start(self): |
147 | 144 | # JupyterApp.start dispatches on NoStart |
10 | 10 | import signal |
11 | 11 | import subprocess |
12 | 12 | import sys |
13 | from tempfile import TemporaryDirectory | |
13 | 14 | import time |
14 | 15 | from warnings import warn |
15 | 16 | |
17 | 18 | |
18 | 19 | from zmq import ZMQError |
19 | 20 | from IPython.core import page |
20 | from ipython_genutils.tempdir import NamedFileInTemporaryDirectory | |
21 | 21 | from traitlets import ( |
22 | 22 | Bool, |
23 | 23 | Integer, |
55 | 55 | is_done, |
56 | 56 | ) |
57 | 57 | from prompt_toolkit.history import InMemoryHistory |
58 | from prompt_toolkit.patch_stdout import patch_stdout | |
59 | 58 | from prompt_toolkit.shortcuts.prompt import PromptSession |
60 | 59 | from prompt_toolkit.shortcuts import print_formatted_text, CompleteStyle |
61 | 60 | from prompt_toolkit.key_binding import KeyBindings |
67 | 66 | from prompt_toolkit.styles import merge_styles |
68 | 67 | from prompt_toolkit.styles.pygments import (style_from_pygments_cls, |
69 | 68 | style_from_pygments_dict) |
70 | from prompt_toolkit.formatted_text import PygmentsTokens, FormattedText | |
69 | from prompt_toolkit.formatted_text import PygmentsTokens | |
71 | 70 | from prompt_toolkit.output import ColorDepth |
72 | 71 | from prompt_toolkit.utils import suspend_to_background_supported |
73 | 72 | |
159 | 158 | ): |
160 | 159 | new_meta[c] = m["type"] |
161 | 160 | meta = new_meta |
162 | except: | |
161 | except Exception: | |
163 | 162 | pass |
164 | 163 | |
165 | 164 | start_pos = content["cursor_start"] - document.cursor_position |
747 | 746 | content = msg["content"] |
748 | 747 | status = content['status'] |
749 | 748 | |
750 | if status == 'aborted': | |
751 | self.write('Aborted\n') | |
749 | if status == "aborted": | |
750 | sys.stdout.write("Aborted\n") | |
752 | 751 | return |
753 | 752 | elif status == 'ok': |
754 | 753 | # handle payloads |
852 | 851 | while self.client.iopub_channel.msg_ready(): |
853 | 852 | sub_msg = self.client.iopub_channel.get_msg() |
854 | 853 | msg_type = sub_msg['header']['msg_type'] |
855 | parent = sub_msg["parent_header"] | |
856 | 854 | |
857 | 855 | # Update execution_count in case it changed in another session |
858 | 856 | if msg_type == "execute_input": |
976 | 974 | imageformat = self._imagemime[mime] |
977 | 975 | fmt = dict(format=imageformat) |
978 | 976 | args = [s.format(**fmt) for s in self.stream_image_handler] |
979 | with open(os.devnull, 'w') as devnull: | |
980 | proc = subprocess.Popen( | |
981 | args, stdin=subprocess.PIPE, | |
982 | stdout=devnull, stderr=devnull) | |
977 | with subprocess.Popen(args, stdin=subprocess.PIPE, | |
978 | stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) as proc: | |
983 | 979 | proc.communicate(raw) |
984 | return (proc.returncode == 0) | |
980 | return (proc.returncode == 0) | |
985 | 981 | |
986 | 982 | def handle_image_tempfile(self, data, mime): |
987 | 983 | raw = base64.decodebytes(data[mime].encode('ascii')) |
988 | 984 | imageformat = self._imagemime[mime] |
989 | 985 | filename = 'tmp.{0}'.format(imageformat) |
990 | with NamedFileInTemporaryDirectory(filename) as f, \ | |
991 | open(os.devnull, 'w') as devnull: | |
992 | f.write(raw) | |
993 | f.flush() | |
994 | fmt = dict(file=f.name, format=imageformat) | |
986 | with TemporaryDirectory() as tempdir: | |
987 | fullpath = os.path.join(tempdir, filename) | |
988 | with open(fullpath, 'wb') as f: | |
989 | f.write(raw) | |
990 | fmt = dict(file=fullpath, format=imageformat) | |
995 | 991 | args = [s.format(**fmt) for s in self.tempfile_image_handler] |
996 | rc = subprocess.call(args, stdout=devnull, stderr=devnull) | |
992 | rc = subprocess.call(args, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) | |
997 | 993 | return (rc == 0) |
998 | 994 | |
999 | 995 | def handle_image_callable(self, data, mime): |
8 | 8 | import tempfile |
9 | 9 | from subprocess import check_output |
10 | 10 | |
11 | from nose import SkipTest | |
11 | import pytest | |
12 | 12 | |
13 | 13 | from traitlets.tests.utils import check_help_all_output |
14 | from ipython_genutils.testing import decorators as dec | |
15 | 14 | |
16 | @dec.skip_win32 | |
15 | ||
16 | @pytest.mark.xfail | |
17 | @pytest.mark.skipif(sys.platform == "win32", reason="skip on windows") | |
17 | 18 | def test_console_starts(): |
18 | 19 | """test that `jupyter console` starts a terminal""" |
19 | 20 | p, pexpect, t = start_console() |
20 | p.sendline('5') | |
21 | idx = p.expect([r'Out\[\d+\]: 5', pexpect.EOF], timeout=t) | |
22 | idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=t) | |
21 | p.sendline("5") | |
22 | p.expect([r"Out\[\d+\]: 5", pexpect.EOF], timeout=t) | |
23 | p.expect([r"In \[\d+\]", pexpect.EOF], timeout=t) | |
23 | 24 | stop_console(p, pexpect, t) |
24 | 25 | |
25 | 26 | def test_help_output(): |
26 | 27 | """jupyter console --help-all works""" |
27 | 28 | check_help_all_output('jupyter_console') |
28 | 29 | |
30 | @pytest.mark.xfail | |
29 | 31 | def test_display_text(): |
30 | 32 | "Ensure display protocol plain/text key is supported" |
31 | 33 | # equivalent of: |
63 | 65 | try: |
64 | 66 | p = pexpect.spawn(cmd, args=args, env=env) |
65 | 67 | except IOError: |
66 | raise SkipTest("Couldn't find command %s" % cmd) | |
68 | pytest.skip("Couldn't find command %s" % cmd) | |
67 | 69 | |
68 | 70 | # timeout after one minute |
69 | 71 | t = 60 |
70 | idx = p.expect(r'In \[\d+\]', timeout=t) | |
72 | p.expect(r"In \[\d+\]", timeout=t) | |
71 | 73 | return p, pexpect, t |
72 | 74 | |
73 | 75 |
0 | 0 | # Copyright (c) IPython Development Team. |
1 | 1 | # Distributed under the terms of the Modified BSD License. |
2 | 2 | |
3 | import base64 | |
3 | 4 | import os |
4 | 5 | import sys |
6 | from tempfile import TemporaryDirectory | |
5 | 7 | import unittest |
6 | import base64 | |
7 | ||
8 | 8 | from unittest.mock import patch |
9 | 9 | |
10 | import pytest | |
11 | ||
10 | 12 | from jupyter_console.ptshell import ZMQTerminalInteractiveShell |
11 | from ipython_genutils.tempdir import TemporaryDirectory | |
12 | from ipython_genutils.testing.decorators import skip_without | |
13 | from ipython_genutils.ipstruct import Struct | |
14 | 13 | |
15 | 14 | |
16 | 15 | SCRIPT_PATH = os.path.join( |
32 | 31 | |
33 | 32 | def test_call_pil_by_default(self): |
34 | 33 | pil_called_with = [] |
34 | ||
35 | 35 | def pil_called(data, mime): |
36 | 36 | pil_called_with.append(data) |
37 | 37 | |
47 | 47 | shell.handle_image(None, None) # arguments are dummy |
48 | 48 | assert len(pil_called_with) == 1 |
49 | 49 | |
50 | @skip_without('PIL') | |
51 | 50 | def test_handle_image_PIL(self): |
51 | pytest.importorskip('PIL') | |
52 | 52 | from PIL import Image, ImageShow |
53 | 53 | |
54 | 54 | open_called_with = [] |
0 | Metadata-Version: 2.1 | |
1 | Name: jupyter-console | |
2 | Version: 6.2.0 | |
3 | Summary: Jupyter terminal console | |
4 | Home-page: https://jupyter.org | |
5 | Author: Jupyter Development Team | |
6 | Author-email: jupyter@googlegroups.com | |
7 | License: BSD | |
8 | Description: An IPython-like terminal frontend for Jupyter kernels in any language. | |
9 | Keywords: Interactive,Interpreter,Shell,Web | |
10 | Platform: Linux | |
11 | Platform: Mac OS X | |
12 | Platform: Windows | |
13 | Classifier: Intended Audience :: Developers | |
14 | Classifier: Intended Audience :: System Administrators | |
15 | Classifier: Intended Audience :: Science/Research | |
16 | Classifier: License :: OSI Approved :: BSD License | |
17 | Classifier: Programming Language :: Python | |
18 | Classifier: Programming Language :: Python :: 3 | |
19 | Requires-Python: >=3.6 | |
20 | Provides-Extra: test |
0 | .bumpversion.cfg | |
1 | .gitignore | |
2 | .mailmap | |
3 | .travis.yml | |
4 | CONTRIBUTING.md | |
5 | COPYING.md | |
6 | MANIFEST.in | |
7 | README.md | |
8 | RELEASING.md | |
9 | mypy.ini | |
10 | pyproject.toml | |
11 | pytest.ini | |
12 | readthedocs.yml | |
13 | setup.cfg | |
14 | setup.py | |
15 | .github/workflows/python-package.yml | |
16 | docs/Makefile | |
17 | docs/autogen_config.py | |
18 | docs/changelog.rst | |
19 | docs/conf.py | |
20 | docs/environment.yml | |
21 | docs/index.rst | |
22 | docs/make.bat | |
23 | docs/release.rst | |
24 | docs/requirements.txt | |
25 | jupyter_console/__init__.py | |
26 | jupyter_console/__main__.py | |
27 | jupyter_console/_version.py | |
28 | jupyter_console/app.py | |
29 | jupyter_console/completer.py | |
30 | jupyter_console/ptshell.py | |
31 | jupyter_console/zmqhistory.py | |
32 | jupyter_console.egg-info/PKG-INFO | |
33 | jupyter_console.egg-info/SOURCES.txt | |
34 | jupyter_console.egg-info/dependency_links.txt | |
35 | jupyter_console.egg-info/entry_points.txt | |
36 | jupyter_console.egg-info/requires.txt | |
37 | jupyter_console.egg-info/top_level.txt | |
38 | jupyter_console/tests/__init__.py | |
39 | jupyter_console/tests/conftest.py | |
40 | jupyter_console/tests/test_console.py | |
41 | jupyter_console/tests/test_image_handler.py | |
42 | jupyter_console/tests/writetofile.py | |
43 | scripts/jupyter-console⏎ |
0 | jupyter_client | |
1 | ipython | |
2 | ipykernel | |
3 | prompt_toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 | |
4 | pygments | |
5 | ||
6 | [test:sys_platform != "win32"] | |
7 | pexpect |
0 | 0 | [flake8] |
1 | 1 | max-line-length = 99 |
2 | ignore = W291, E266, E265, E128, E251, E402, E124, E302, W293, E231, E222, W503, E126, E121, W391, E226, E127, W504 | |
2 | 3 | |
3 | 4 | [metadata] |
4 | 5 | license_file = COPYING.md |
5 | ||
6 | [egg_info] | |
7 | tag_build = | |
8 | tag_date = 0 | |
9 |
31 | 31 | |
32 | 32 | |
33 | 33 | error = """ |
34 | Jupyter_Console 6.0+ supports Python 3.5 and above. | |
34 | Jupyter_Console 6.2+ supports Python 3.6 and above. | |
35 | 35 | When using Python 2.7, please install and older version of Jupyter Console |
36 | 36 | Python 3.3 and 3.4 were supported up to Jupyter Console 5.x. |
37 | Python 3.5 was supported up to Jupyter Console 6.1.0. | |
37 | 38 | |
38 | 39 | Python {py} detected. |
39 | 40 | {pip} |
48 | 49 | #----------------------------------------------------------------------------- |
49 | 50 | |
50 | 51 | import os |
51 | from glob import glob | |
52 | 52 | |
53 | 53 | from setuptools import setup |
54 | 54 | |
69 | 69 | setup_args = dict( |
70 | 70 | name = name, |
71 | 71 | version = version_ns['__version__'], |
72 | scripts = glob(pjoin('scripts', '*')), | |
73 | 72 | packages = packages, |
74 | 73 | description = "Jupyter terminal console", |
75 | 74 | long_description= "An IPython-like terminal frontend for Jupyter kernels in any language.", |
87 | 86 | 'Programming Language :: Python', |
88 | 87 | 'Programming Language :: Python :: 3', |
89 | 88 | ], |
90 | ) | |
91 | ||
92 | if 'develop' in sys.argv or any(a.startswith('bdist') for a in sys.argv): | |
93 | import setuptools | |
94 | ||
95 | setuptools_args = {} | |
96 | install_requires = setuptools_args['install_requires'] = [ | |
97 | 'jupyter_client', | |
98 | 'ipython', | |
99 | 'ipykernel', # bless IPython kernel for now | |
100 | 'prompt_toolkit>=2.0.0,<3.1.0,!=3.0.0,!=3.0.1', | |
101 | 'pygments', | |
102 | ] | |
103 | ||
104 | extras_require = setuptools_args['extras_require'] = { | |
105 | 'test:sys_platform != "win32"': ['pexpect'], | |
106 | ||
107 | ||
108 | } | |
109 | ||
110 | setuptools_args['python_requires'] = '>=3.6' | |
111 | ||
112 | ||
113 | setuptools_args['entry_points'] = { | |
89 | install_requires=[ | |
90 | 'jupyter_client', | |
91 | 'ipython', | |
92 | 'ipykernel', # bless IPython kernel for now | |
93 | 'prompt_toolkit>=2.0.0,<3.1.0,!=3.0.0,!=3.0.1', | |
94 | 'pygments', | |
95 | ], | |
96 | extras_require={ | |
97 | 'test:sys_platform != "win32"': ['pexpect'], | |
98 | }, | |
99 | python_requires='>=3.6', | |
100 | entry_points={ | |
114 | 101 | 'console_scripts': [ |
115 | 102 | 'jupyter-console = jupyter_console.app:main', |
116 | 103 | ] |
117 | } | |
118 | ||
119 | if 'setuptools' in sys.modules: | |
120 | setup_args.update(setuptools_args) | |
121 | setup_args.pop('scripts') | |
104 | } | |
105 | ) | |
122 | 106 | |
123 | 107 | |
124 | 108 | if __name__ == '__main__': |