GithubHelp home page GithubHelp logo

jupyter / qtconsole Goto Github PK

View Code? Open in Web Editor NEW
393.0 23.0 194.0 1.88 MB

Jupyter Qt Console

Home Page: https://qtconsole.readthedocs.io/en/stable/

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
qt-console jupyter

qtconsole's Introduction

Jupyter QtConsole

Windows tests Macos tests Linux tests Coverage Status Documentation Status Google Group

A rich Qt-based console for working with Jupyter kernels, supporting rich media output, session export, and more.

The Qtconsole is a very lightweight application that largely feels like a terminal, but provides a number of enhancements only possible in a GUI, such as inline figures, proper multiline editing with syntax highlighting, graphical calltips, and more.

qtconsole

Install Qtconsole

The Qtconsole requires Python bindings for Qt, such as PyQt6, PySide6, PyQt5 or PySide2.

Although pip and conda may be used to install the Qtconsole, conda is simpler to use since it automatically installs PyQt5. Alternatively, the Qtconsole installation with pip needs additional steps since pip doesn't install the Qt requirement.

Install using conda

To install:

conda install qtconsole

Note: If the Qtconsole is installed using conda, it will automatically install the Qt requirement as well.

Install using pip

To install:

pip install qtconsole

Note: Make sure that Qt is installed. Unfortunately, Qt is not installed when using pip. The next section gives instructions on doing it.

Installing Qt (if needed)

You can install PyQt5 with pip using the following command:

pip install pyqt5

or with a system package manager on Linux. For Windows, PyQt binary packages may be used.

Note: Additional information about using a system package manager may be found in the qtconsole documentation.

More installation instructions for PyQt can be found in the PyQt5 documentation and PyQt4 documentation

Source packages for Windows/Linux/MacOS can be found here: PyQt5 and PyQt4.

Usage

To run the Qtconsole:

jupyter qtconsole

Resources

qtconsole's People

Contributors

2dsharp avatar bfroehle avatar carreau avatar ccordoba12 avatar dalthviz avatar detrout avatar ellisonbg avatar eyllanesc avatar firai avatar fperez avatar hmaarrfk avatar impact27 avatar ivanov avatar jeremysikes73 avatar kloper avatar mariacamilarg avatar markvoorhies avatar minrk avatar mspacek avatar nisseg avatar psobolewskiphd avatar punchagan avatar rahulporuri avatar rayosborn avatar sylvain-bougnoux avatar takluyver avatar tmr232 avatar vidartf avatar willingc avatar wmvanvliet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qtconsole's Issues

Override QT_API when a Qt binding is already loaded?

I would like to suggest not obeying QT_API when a specific Qt binding has already been loaded, and just use it, rather than raising an exception: the error is probably just a misconfigured environment variable and there's a clear, single, well-defined recovery.

Cannot start qtconsole on Ubuntu 15.04 for either Python 2 or Python 3. (Lack of PyQt5.)

I am on Ubuntu 15.04, using Python 3.5.1 as Python 3. I have installed PyQt5 using sudo apt-get install python3-pyqt5, but it didn't work. I also tried installing it from source.

After installing from source, I was able to access PyQt5 from ipython itself.

This is the output of python3 -c "import IPython; print(IPython.sys_info())"

python3 -c "import IPython; print(IPython.sys_info())" 
{'commit_hash': '8ff8693',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': '/usr/local/lib/python3.5/dist-packages/IPython',
 'ipython_version': '4.0.3',
 'os_name': 'posix',
 'platform': 'Linux-3.19.0-42-generic-x86_64-with-Ubuntu-15.04-vivid',
 'sys_executable': '/usr/bin/python3',
 'sys_platform': 'linux',
 'sys_version': '3.5.1 (default, Dec 18 2015, 16:31:51) \n[GCC 4.9.2]'}

Here is the full traceback:

Traceback (most recent call last):
  File "/usr/local/bin/ipython3", line 11, in <module>
    sys.exit(start_ipython())
  File "/usr/local/lib/python3.5/dist-packages/IPython/__init__.py", line 119, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 588, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-111>", line 2, in initialize
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/IPython/terminal/ipapp.py", line 305, in initialize
    super(TerminalIPythonApp, self).initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/IPython/core/application.py", line 386, in initialize
    self.parse_command_line(argv)
  File "/usr/local/lib/python3.5/dist-packages/IPython/terminal/ipapp.py", line 300, in parse_command_line
    return super(TerminalIPythonApp, self).parse_command_line(argv)
  File "<decorator-gen-4>", line 2, in parse_command_line
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 485, in parse_command_line
    return self.initialize_subcommand(subc, subargv)
  File "<decorator-gen-3>", line 2, in initialize_subcommand
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 416, in initialize_subcommand
    subapp = import_item(subapp)
  File "/usr/local/lib/python3.5/dist-packages/ipython_genutils/importstring.py", line 31, in import_item
    module = __import__(package, fromlist=[obj])
  File "/usr/local/lib/python3.5/dist-packages/qtconsole/qtconsoleapp.py", line 60, in <module>
    from qtconsole.qt import QtCore, QtGui
  File "/usr/local/lib/python3.5/dist-packages/qtconsole/qt.py", line 23, in <module>
    QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
  File "/usr/local/lib/python3.5/dist-packages/qtconsole/qt_loaders.py", line 304, in load_qt
    api_options))
ImportError: 
    Could not load requested Qt binding. Please ensure that
    PyQt4 >= 4.7, PyQt5 or PySide >= 1.0.3 is available,
    and only one is imported per session.

    Currently-imported Qt library:   None
    PyQt4 installed:                 False
    PyQt5 installed:                 False
    PySide >= 1.0.3 installed:       False
    Tried to load:                   ['pyqt5', 'pyside', 'pyqt']

Python 2 has a similar issue. This is the output of python -c "import IPython; print(IPython.sys_info())":

{'commit_hash': u'f534027',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': '/usr/local/lib/python2.7/dist-packages/IPython',
 'ipython_version': '4.0.0',
 'os_name': 'posix',
 'platform': 'Linux-3.19.0-42-generic-x86_64-with-Ubuntu-15.04-vivid',
 'sys_executable': '/usr/bin/python',
 'sys_platform': 'linux2',
 'sys_version': '2.7.9 (default, Apr  2 2015, 15:33:21) \n[GCC 4.9.2]'}

and the traceback:

Traceback (most recent call last):
  File "/usr/local/bin/ipython", line 11, in <module>
    sys.exit(start_ipython())
  File "/usr/local/lib/python3.5/dist-packages/IPython/__init__.py", line 119, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 588, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-111>", line 2, in initialize
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/IPython/terminal/ipapp.py", line 305, in initialize
    super(TerminalIPythonApp, self).initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/IPython/core/application.py", line 386, in initialize
    self.parse_command_line(argv)
  File "/usr/local/lib/python3.5/dist-packages/IPython/terminal/ipapp.py", line 300, in parse_command_line
    return super(TerminalIPythonApp, self).parse_command_line(argv)
  File "<decorator-gen-4>", line 2, in parse_command_line
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 485, in parse_command_line
    return self.initialize_subcommand(subc, subargv)
  File "<decorator-gen-3>", line 2, in initialize_subcommand
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 416, in initialize_subcommand
    subapp = import_item(subapp)
  File "/usr/local/lib/python3.5/dist-packages/ipython_genutils/importstring.py", line 31, in import_item
    module = __import__(package, fromlist=[obj])
  File "/usr/local/lib/python3.5/dist-packages/qtconsole/qtconsoleapp.py", line 60, in <module>
    from qtconsole.qt import QtCore, QtGui
  File "/usr/local/lib/python3.5/dist-packages/qtconsole/qt.py", line 23, in <module>
    QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
  File "/usr/local/lib/python3.5/dist-packages/qtconsole/qt_loaders.py", line 304, in load_qt
    api_options))
ImportError: 
    Could not load requested Qt binding. Please ensure that
    PyQt4 >= 4.7, PyQt5 or PySide >= 1.0.3 is available,
    and only one is imported per session.

    Currently-imported Qt library:   None
    PyQt4 installed:                 False
    PyQt5 installed:                 False
    PySide >= 1.0.3 installed:       False
    Tried to load:                   ['pyqt5', 'pyside', 'pyqt']

PyQt5 does not work in Python 2 at all, even though python-pyqt5 is also installed.

If this is not the right place for it, please let me know.

`resources/icon` does not exist in the whl package

/tmp # unzip -l qtconsole-4.0.0-py2.py3-none-any.whl 
Archive:  qtconsole-4.0.0-py2.py3-none-any.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
       48  2015-05-07 15:42   qtconsole/__init__.py
       82  2015-06-23 18:22   qtconsole/__main__.py
       72  2015-07-20 13:01   qtconsole/_version.py
    13682  2015-06-23 18:22   qtconsole/ansi_code_processor.py
     6630  2015-07-02 15:57   qtconsole/base_frontend_mixin.py
     3738  2015-06-23 18:22   qtconsole/bracket_matcher.py
    10178  2015-06-23 18:22   qtconsole/call_tip_widget.py
     2312  2015-05-07 15:42   qtconsole/client.py
    12463  2015-07-20 12:59   qtconsole/completion_html.py
     2095  2015-07-20 12:59   qtconsole/completion_plain.py
     5363  2015-06-23 18:22   qtconsole/completion_widget.py
    86891  2015-07-15 16:09   qtconsole/console_widget.py
    33258  2015-07-20 12:59   qtconsole/frontend_widget.py
    10094  2015-07-15 16:09   qtconsole/history_console_widget.py
     2285  2015-05-12 12:34   qtconsole/inprocess.py
      152  2015-07-20 12:59   qtconsole/ipython_widget.py
    22224  2015-07-20 12:59   qtconsole/jupyter_widget.py
     1618  2015-07-20 12:59   qtconsole/kernel_mixins.py
     3798  2015-06-23 18:22   qtconsole/kill_ring.py
    31043  2015-07-20 12:59   qtconsole/mainwindow.py
     1572  2015-05-07 15:42   qtconsole/manager.py
     8692  2015-06-23 18:22   qtconsole/pygments_highlighter.py
      799  2015-05-07 15:42   qtconsole/qt.py
     8528  2015-07-20 12:59   qtconsole/qt_loaders.py
    13782  2015-07-20 12:59   qtconsole/qtconsoleapp.py
      167  2015-07-20 12:59   qtconsole/rich_ipython_widget.py
    15709  2015-07-20 12:59   qtconsole/rich_jupyter_widget.py
     8644  2015-07-20 12:59   qtconsole/rich_text.py
     4224  2015-06-23 18:22   qtconsole/styles.py
     2466  2015-05-07 15:42   qtconsole/svg.py
     3920  2015-07-20 12:59   qtconsole/util.py
        0  2015-06-23 18:22   qtconsole/tests/__init__.py
     6970  2015-06-23 18:22   qtconsole/tests/test_ansi_code_processor.py
      397  2015-07-01 13:10   qtconsole/tests/test_app.py
     2902  2015-07-01 13:10   qtconsole/tests/test_console_widget.py
     2236  2015-07-01 13:10   qtconsole/tests/test_kill_ring.py
       88  2015-07-20 13:03   qtconsole-4.0.0.data/scripts/jupyter-qtconsole
       10  2015-07-20 13:03   qtconsole-4.0.0.dist-info/DESCRIPTION.rst
     1165  2015-07-20 13:03   qtconsole-4.0.0.dist-info/metadata.json
       46  2015-07-20 13:03   qtconsole-4.0.0.dist-info/pbr.json
       10  2015-07-20 13:03   qtconsole-4.0.0.dist-info/top_level.txt
      110  2015-07-20 13:03   qtconsole-4.0.0.dist-info/WHEEL
     1062  2015-07-20 13:03   qtconsole-4.0.0.dist-info/METADATA
     3730  2015-07-20 13:03   qtconsole-4.0.0.dist-info/RECORD
---------                     -------
   335255                     44 files

%colors magic has no effect in qtconsole 4.0.0

I have qtconsole 4.0.0 installed via pip in a conda environment with Python 2.7.10 and PyQT 4.11.3. When I try to specify a color at the command line explicitly, e.g., jupyter qtconsole --colors=linux, the console starts but I observe the following warning:

[JupyterQtConsoleApp] WARNING | Unrecognized alias: '--colors=Linux', it will probably have no effect.

The specified colors do not take effect. Attempting to set the color via the %colors magic within the running console also has no effect.

Relevant installed packages:

$ yolk -l | egrep 'ipython|qtconsole|jupyter|ipykernel'
ipykernel       - 4.0.3        - active 
ipython-genutils - 0.1.0        - active 
ipython         - 4.0.0        - active 
jupyter-client  - 4.0.0        - active 
jupyter-console - 4.0.0        - active 
jupyter-core    - 4.0.2        - active 
jupyter         - 1.0.0        - active 
qtconsole       - 4.0.0        - active 

Copy/Paste Regressions

I've noticed a couple of regressions with the latest qtconsole:

  1. The last character of a selection isn't copied - see also #47
  2. The prompts aren't stripped on copy
    qtconsole
In [10]: print sys_info()
-> print(sys_info())
{'commit_hash': 'f534027',
 'commit_source': 'installation',
 'default_encoding': 'cp1252',
 'ipython_path': 'C:\\Anaconda3\\lib\\site-packages\\IPython',
 'ipython_version': '4.0.0',
 'os_name': 'nt',
 'platform': 'Windows-8-6.2.9200',
 'sys_executable': 'C:\\Anaconda3\\python.exe',
 'sys_platform': 'win32',
 'sys_version': '3.4.3 |Anaconda 2.3.0 (64-bit)| (default, Mar  6 2015, '
                '12:06:10) [MSC v.1600 64 bit (AMD64)]'}

In [11]: !conda list "jupyter|ipython"
# packages in environment at C:\Anaconda3:
#
ipython                   4.0.0                    py34_0  
ipython-genutils          0.1.0                     <pip>
ipython_genutils          0.1.0                    py34_0  
jupyter                   1.0.0                    py34_0  
jupyter-client            4.0.0                     <pip>
jupyter-console           4.0.0                     <pip>
jupyter-core              4.0.4                     <pip>
jupyter_client            4.0.0                    py34_0  
jupyter_console           4.0.0                    py34_0  
jupyter_core              4.0.4                    py34_0  

NB: Maybe sys_info should be updated to show info about the whole jupyter install?

jupyter: 'qtconsole' is not a Jupyter command

I'm trying use Jupyter qtconsole on Windows and Python 3.4:

(jupyter_venv) > pip install jupyter
...
(jupyter_venv) > jupyter qtconsole

And I'm getting an error:

jupyter: 'qtconsole' is not a Jupyter command

Installed packages in my virtual environment (by pip list):

decorator (4.0.2)
ipykernel (4.0.3)
ipython (4.0.0)
ipython-genutils (0.1.0)
ipywidgets (4.0.2)
Jinja2 (2.8)
jsonschema (2.5.1)
jupyter (1.0.0)
jupyter-client (4.0.0)
jupyter-console (4.0.0)
jupyter-core (4.0.3)
MarkupSafe (0.23)
mistune (0.7)
nbconvert (4.0.0)
nbformat (4.0.0)
notebook (4.0.2)
path.py (7.6)
pickleshare (0.5)
pip (7.1.0)
Pygments (2.0.2)
pyzmq (14.7.0)
qtconsole (4.0.0)
setuptools (18.1)
simplegeneric (0.8.1)
tornado (4.2.1)
traitlets (4.0.0)

Logging output at exit.

The qtconsole prints

[JupyterQtConsoleApp] shutdown: {'restart': False, 'status': 'ok'}

at exit.
Not a big deal but this output should probably be suppressed.

[JupyterQtConsoleApp] CRITICAL | Bad config encountered during initialization

I have a anaconda installation with python 3.4, spyder 2.3.7 and Ipython 4.0.0 that works just fine.
I have been trying to set up a 2.7.8 python environment with spyder, but I just can not make ipython qtconsole work.
I can install ipython up to version 3.2.* with py2.7 and have qtconsole run, but then spyder will not run with it.
If I on the other hand update to ipython 4.0.0 qtconsole does not work. I can run ipython on console without trouble, but if I try to run either ipython qtconsole or jupyter qtconsole I get the following output:

-------help info------

[JupyterQtConsoleApp] CRITICAL | Bad config encountered during initialization:
[JupyterQtConsoleApp] CRITICAL | Could not decode 'C:\Users\Marcos Vin\xedcius.jupyter' for unicode trait 'config_dir' of a JupyterQtConsoleApp instance.

I have tried whatever I could think of in setting the environment to no avail. I can not help but to think it has something to do with the folder it is trying to access, which should be Marcos Vinícius. The odd thing is that older versions did not have this problem.

Should the Qt console be treated as a tty?

Came here from astropy/astropy#2297, where a updateable progress bar isn't printing inside the Qt console. It looks like this is because, in the console, sys.stdout.isatty() is False. Should this be the case? I don't know enough about what a tty actually is to judge whether this is something that needs to be fixed, or whether we shouldn't be using isatty to judge whether we can treat the console like one.

Please set X11 window class and instance

Hello,

The ipython3 qtconsole window comes up with WM_CLASS(STRING) = "", "" (xprop output). This makes it very hard to identify a Qtconsole window programmatically (e.g. to have the window manager put it on a specific workspace, or assign it a specific size).

It would be great if these values could be changed to something more meaningful than the empty string.

Output more possibilities on tab-completion

Currently, tab completion only displays a small list of possibilities at a time:
completion
The list is also always displayed in three columns, even if they don't fit (then the last column is just invisible) or if the window is much wider than that.
Given that the qtconsole can erase the unused completions I'd suggest just displaying the whole list instead (which is also useful as a quick substitute to calling dir/vars).
(Actually, a pager-like behavior would be more useful in the console ipython, which currently outputs the whole list without erasing it afterwards.)

HTML with inline png images does not appear to be generated correctly

To reproduce:

  1. From within Spyder, Tools->Preferences->IPython console->Graphics, set the Graphics backend to “Inline”.
  2. Close Spyder and restart.
  3. Run this to display an inline plot (for example):
               import matplotlib.pyplot as plt
               plt.plot([1, 3, 1, 6, 10, 4])
  1. Hit control-s, choose a file name and save as “HTML with PNG figures”, click “save”.
  2. Select “Inline” when it asks “Would you like inline PNGs …”
  3. Neither FireFox nor IE will display the figure.

The HTML ends up with code like this:

     <img src="data:image/png;base64,b'iVBORw0KGgoAAAAN...'

To get the figure to display, I manually deleted the leading b' and the trailing '.

I finally tracked the source of this down to the file ‘rich_jupyter_widget.py’, in the routine ‘RichJupyterWidget._get_image_tag()’. The offending code is:

    re.sub(r'(.{60})',r'\1\n',str(ba.toBase64()))

Modifying this to:

    re.sub(r'(.{60})',r'\1\n',str(ba.toBase64())[2:-1])

works, but I don’t know the what the best fix is or if this causes other issues somewhere else.

Remove IPython dependency

QtConsole depends on IPython for a few things, and it shouldn't

  • use is_complete requests instead of input splitter
  • remove IPython-specific magics menus, etc.

The magic command %guiref not available in IPython 4, but is listed in QtConsole startup text

The line magic function %guiref is no longer available in IPython (version 4.0 and above I think, see the IPython docs), and should probably be removed from the text printed when starting Jupyter QtConsole, or replaced with a working command.

When I start Jupyter QtConsole (I'm on Windows 10 64 bit, using the latest Anaconda3) the following is printed

Jupyter QtConsole 4.1.1
Python 3.5.1 |Anaconda 2.4.1 (64-bit)| (default, Dec  7 2015, 15:00:12) [MSC v.1900 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 4.0.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
%guiref   -> A brief reference about the graphical user interface.

But when I try %guiref I get an error

In [1]: %guiref
ERROR: Line magic function `%guiref` not found.

%%HTML magic not working.

Below is the symptom.

In [1]: %%html
   ...: sdf<b>fads</b>
<IPython.core.display.HTML object>

In [2]:

This bug exists in IPython qtconsole too.
The _handle_execute_result & _handle_display_data in rich_jupyter_widget.py are missing code that handle html data. After adding 4 lines of code, the %%HTML magic works again.

    def _handle_execute_result(self, msg):
        """Overridden to handle rich data types, like SVG."""
        self.log.debug("execute_result: %s", msg.get('content', ''))
        if self.include_output(msg):
            self.flush_clearoutput()
            content = msg['content']
            prompt_number = content.get('execution_count', 0)
            data = content['data']
            metadata = msg['content']['metadata']
            if 'image/svg+xml' in data:
                self._pre_image_append(msg, prompt_number)
                self._append_svg(data['image/svg+xml'], True)
                self._append_html(self.output_sep2, True)
            elif 'image/png' in data:
                self._pre_image_append(msg, prompt_number)
                png = decodestring(data['image/png'].encode('ascii'))
                self._append_png(png, True, metadata=metadata.get('image/png', None))
                self._append_html(self.output_sep2, True)
            elif 'image/jpeg' in data and self._jpg_supported:
                self._pre_image_append(msg, prompt_number)
                jpg = decodestring(data['image/jpeg'].encode('ascii'))
                self._append_jpg(jpg, True, metadata=metadata.get('image/jpeg', None))
                self._append_html(self.output_sep2, True)
            elif 'text/latex' in data:
                self._pre_image_append(msg, prompt_number)
                self._append_latex(data['text/latex'], True)
                self._append_html(self.output_sep2, True)
            elif 'text/html' in data:
                self._append_html(data['text/html'], True)
            else:
                # Default back to the plain text representation.
                return super(RichJupyterWidget, self)._handle_execute_result(msg)

    def _handle_display_data(self, msg):
        """Overridden to handle rich data types, like SVG."""
        self.log.debug("display_data: %s", msg.get('content', ''))
        if self.include_output(msg):
            self.flush_clearoutput()
            data = msg['content']['data']
            metadata = msg['content']['metadata']
            # Try to use the svg or html representations.
            # FIXME: Is this the right ordering of things to try?
            self.log.debug("display: %s", msg.get('content', ''))
            if 'image/svg+xml' in data:
                svg = data['image/svg+xml']
                self._append_svg(svg, True)
            elif 'image/png' in data:
                # PNG data is base64 encoded as it passes over the network
                # in a JSON structure so we decode it.
                png = decodestring(data['image/png'].encode('ascii'))
                self._append_png(png, True, metadata=metadata.get('image/png', None))
            elif 'image/jpeg' in data and self._jpg_supported:
                jpg = decodestring(data['image/jpeg'].encode('ascii'))
                self._append_jpg(jpg, True, metadata=metadata.get('image/jpeg', None))
            elif 'text/latex' in data and latex_to_png:
                self._append_latex(data['text/latex'], True)
            elif 'text/html' in data:
                self._append_html(data['text/html'], True)
            else:
                # Default back to the plain text representation.
                return super(RichJupyterWidget, self)._handle_display_data(msg)

Sorry for my poor english.

Multiline editing in an in-process console

When embedding a Jupyter console in a PyQt GUI using an in-process kernel, multiline editing is not triggered when a typed line is incomplete, although multiline editing works for pasted code. Instead, it raises a syntax error. The reason is because line 603 of console_widget.py calls the _is_complete function in frontend_widget.py, which attempts to send a message to a non-existent socket for a blocking kernel client and gets no reply. I believe that the solution is to subclass RichJupyterWidget (or possibly JupyterWidget), within inprocess.py, to provide an in-process version of '_is_complete', which checks for code completion directly. I will issue a pull request with a fix that I have tested.

Should not warn about shutting down kernels if not relevant

When using the %qtconsole magic from an existing notebook (e.g., for %debug'ging), I get the "kernel will be shut down" warning when trying to close the window. Shouldn't it be possible to see in the code that the qtconsole does not "own" the kernel (or that the kernel usage count is >= 2, if it is refcounted) and to only show the warning if relevant?

Docs

Making an issue so it doesn't get forgotten. Assign yourself if you want to work on this

There's a simple skeleton of docs there, but we should:

  • Update stuff (e.g. it's now jupyter qtconsole)
  • Document its config options. I have some machinery to do this in the ipython docs.
  • Create API docs (particularly considering the use case of embedding it as a Qt widget)
  • Get it building on RTD

Support pyreadline

Hi, I'm currently trying to introduce QtConsole to our workflow, but a key feature is missing - support of libraries using pyreadline(e.g ipdb as a noticeable example).
This is a REALLY big issue for us, and so, I want to participate and fix this issue so badly! But as I'm not that familiar with the IPython code-base(yet), I would like your help.

Freely speaking, I'm not sure why this is such a hard problem to tackle, as the IPython kernel itself uses pyreadline, so can't we hook usages of the module and "rewire" our endpoints(history/auto-complete) to the new "readline"?

Thanks!

Add API to change QtConsole title

I often have multiple QtConsole windows open, and it gets very hard to tell them apart.
It would be great if there was an API to allow changing the window title.

tab completion in cd with filenames with space on Windows

I'm trying to use QtConsole as a complete shell replacement, but when I do

cd My

I can e.g. choose a path so that my prompt becomes

cd My\ Library

which gives my

[Error 3] The system cannot find the path specified: u'My\ Library', probably because there is something wrong with the way the spaces are escaped.

LaTeX support is broken

In our IRkernel, we use repr to create mimebundles. this includes LaTeX and HTML for many things that aren’t plots.

This results in QtConsole displaying PNGs with LaTeX source code in them instead of something useful.

Please prefer the HTML version if available. Also LaTeX doesn’t necessarily mean “equation”.

Apparently redundant parent App class

@minrk, in 129c5af, you made the application class look like this:

class JupyterQtConsoleApp(object):
    pass

class JupyterQtConsoleApp(JupyterApp, JupyterConsoleApp, JupyterQtConsoleApp):
    ...

Is there a good reason for this pattern, or is it a leftover from some debugging? If there's a reason, let's add a comment explaining it.

Menubar does not appear on MacOS X 10.9 or 10.10

I've had a similar issue with other Qt4 projects. On MacOS X 10.9 and 10.10, the menubar does not appear at first even though the console is in the foreground:

screen shot 2015-09-14 at 9 29 06 pm

If I click on another application then go back to the Qt console, it then appears:

screen shot 2015-09-14 at 9 29 16 pm

This works fine on MacOS X 10.8 though. Any ideas on what could be causing this?

Ipython qtconsole continues line instead of executing on return

When I start a kernel, everything works fine but I always get to this weird mode when I am playing with a dataframe in pandas and I use tab completion on some of its index functions (e.g. df.index.get_lev<tab> which makes it df.index.get_level_values)*. Then tab completion stops working and hitting enter will generate a new line. Even if I erase the line and hit enter it will go to a new line. I either have to restart the kernel or hit <shift+enter> and then hitting <ctrl+c> multiple times so it comes out of this mode. It happens on both mac and linux and with both anaconda 3.19.0 and python 2.7.
I have this issue when I run ipython qtconsole from command line, I don't have problem with this in jupyter notebook or when I just enter ipython in terminal.

(*) This sequence might be unrelated but this is how I reproduce the problem. I don't get to this problem if I type df.index.get_level_values(0) but if anywhere after typing index I use <tab> this happens. Also it doesn't happen when I use on dataframe methods like df.get_<tab>, nor does it happen if I use <tab> for something that is a index property not a method like df.index.names. It also does not happen with small dataframes, what I am using is more than 500 MB when pickled.

Missing pygments dependency

(qtconsole)[jupyter_project] jupyter-qtconsole
Traceback (most recent call last):
  File "/home/damian/miniconda3/envs/qtconsole/bin/jupyter-qtconsole", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/media/datos/Desarrollos/jupyter_project/jupyter_qtconsole/scripts/jupyter-qtconsole", line 2, in <module>
    from jupyter_qtconsole.console.qtconsoleapp import main
  File "/media/datos/Desarrollos/jupyter_project/jupyter_qtconsole/jupyter_qtconsole/console/qtconsoleapp.py", line 49, in <module>
    from jupyter_qtconsole.console.ipython_widget import IPythonWidget
  File "/media/datos/Desarrollos/jupyter_project/jupyter_qtconsole/jupyter_qtconsole/console/ipython_widget.py", line 23, in <module>
    from .frontend_widget import FrontendWidget
  File "/media/datos/Desarrollos/jupyter_project/jupyter_qtconsole/jupyter_qtconsole/console/frontend_widget.py", line 25, in <module>
    from .pygments_highlighter import PygmentsHighlighter
  File "/media/datos/Desarrollos/jupyter_project/jupyter_qtconsole/jupyter_qtconsole/console/pygments_highlighter.py", line 3, in <module>
    from pygments.formatters.html import HtmlFormatter
ImportError: No module named 'pygments'

jupyter qtconsole --generate-config does not work

Hi,

According to this documentation: http://jupyter.readthedocs.org/en/latest/config.html, you can do jupyter {application} --generate-config to create blank config files. jupyter notebook --generate-config does this: it creates the file ~/jupyter/jupyter_notebook_config.py. However, I get an error with jupyter qtconsole --generate-config or jupyter console --generate-config. For instance:

jupyter qtconsole --generate-config
The Jupyter QtConsole.

This launches a Console-style application using Qt.  It is not a full console,
in that launched terminal subprocesses will not be able to accept input.

Options
-------

[...]

[JupyterQtConsoleApp] CRITICAL | Bad config encountered during initialization:
[JupyterQtConsoleApp] CRITICAL | Unrecognized flag: '--generate-config'

I'm runnig jupyter 4.0.6 (from anaconda).

P.D.: I'm having a hard time finding the right/preferred place to ask for help or discuss issues about jupyter (a mailing list, stackoverflow?). IPython.org has a "Community" and "For Developers" list of links at the right column. I can't see something similar for jupyter. It would be great if you can add something similar in jupyter.org.

too many classes in Qt

@minrk opened ipython/ipython#7325

We have too many classes and subclasses in the qtconsole code. Right now, we have:

RichIPythonWidget inherits from IPythonWidget inherits from FrontendWidget inherits from (HistoryConsoleWidget, BaseFrontendMixin) inherits from ConsoleWidget, and RichIPythonWidget is the only class we actually use. None of the intermediate classes serve any use.

I think a lot of this is abstraction for abstraction's sake, and we can get rid of most or all of these classes, leaving the one and only real final IPythonWidget as the implementation of all of these things, especially the BaseFrontendMixin, which is a Mixin only mixed into one class. The ConsoleWidget makes a certain amount of sense, since it contains a lot of generic logic, but I think at least, BaseFrontendMixin, FrontendWidget, IPythonWidget, and RichIPythonWidget should probably be consolidated into a single class.

KeyboardInterrupting time.sleep on windows

Hey, I noticed that interrupting time.sleep on windows doesn't work(py26/py27 + IPython 1.21 and py27/py3 + IPython 3.1.2), on linux systems or the console it works perfectly.
The code does reach the interrupt_main call, so why is it not happening on qtconsole + windows?
Thanks in advance!

JupyterConsole.svg icon file missing in qtconsole 4.0.0?

When I run qtconsole 4.0.0 (installed via pip in a conda environment), the following message is printed:

Cannot open file '/home/lev/Work/miniconda/envs/DEFAULT/lib/python2.7/site-packages/qtconsole/resources/icon/JupyterConsole.svg', because: No such file or directory

RichJupyterWidget.execute() leads to exception

When trying to execute code before showing the RichJupyterWidget, an exception is thrown. When I traced the code, it makes sense, as neither parent class of FrontendWidget has a _handle_execute_reply function, but there is a code path that will call super(FrontendWidget, self)._handle_execute_reply. The traceback is below:

Traceback (most recent call last):
  File ".../qtconsole/base_frontend_mixin.py", line 163, in _dispatch
    handler(msg)
  File ".../qtconsole/jupyter_widget.py", line 182, in _handle_execute_reply
    super(JupyterWidget, self)._handle_execute_reply(msg)
  File ".../qtconsole/frontend_widget.py", line 496, in _handle_execute_reply
    super(FrontendWidget, self)._handle_execute_reply(msg)
AttributeError: 'super' object has no attribute '_handle_execute_reply'

I can try to find a suitable solution and submit a pull request if there's interest in it?

Make bracket match highlight style configurable

Currently the style used when highlighting matching brackets is hard-coded to apply a silver background. This style is problematic for light-on-dark color schemes where the cursor and/or bracket colors are close to the silver background that gets applied as they will appear to blend into the highlighting making it hard to tell where the cursor is or what kind of bracket is being matched.

My preference would be to set the style in the pygments style settings so that colors/styles can be chosen which best match the current pygments style. I understand if this is not feasible, in which case setting the style in the jupyter_qtconsole_config.py file would be fine.

Start qtconsole using pythonw on Windows

Is it possible to make the jupyter qtconsole script launch the console using pythonw.exe instread of python.exe?

Presently, it causes a shell window to be displayed in addition to the qtconsole, and is quite annoying.
I use pythonw -m qtconsole as an alternative to avoid that, but would prefer a proper solution.

Completion detection no longer works with InProcessKernel

When using an InProcessKernel, completion detection no longer works (i.e. hitting the Enter key always results in a continuation line, even though a complete python statement has been entered).

A workaround is to use Shift+Enter instead of Enter to execute commands.

I think this bug was introduced by changes to frontend_widget.is_complete() from:

c5f2ea4

Jupyter QtConsole 4.0.1 copy on selection ignores the last char

When I upgrade to the latest ipython-qtconsole v4.0, I find the window name is changed to Jupyter QtConsole now. My versions / settings are now as below:

Jupyter QtConsole 4.0.1
Python 2.7.7 |Anaconda 2.2.0 (32-bit)| (default, Jun 11 2014, 10:41:43) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.

IPython 4.0.0 -- An enhanced Interactive Python

The usage seems to be the same as before, while when I was trying to do copy / paste after selecting some texts: the last character is missing after pasting!

I shutdown & reopened the kernel, using either the command:
D:\Anaconda\pythonw.exe D:\Anaconda\pkgs\ipython-4.0.0-py27_0\Scripts\ipython-script.py qtconsole
or
jupyter qtconsole
or
jupyter-qtconsole.exe

yet the issue still be there. So this seems to be a replicable bug to me -- not a fatal error, but annoying ;/

Has anyone come across the same issue as mine?

[JupyterQtConsoleApp] CRITICAL | Could not find existing kernel connection file

My workflow:

  1. Start kernel on remote machine: ipython kernel
  2. Copy kernel JSON file from remote to local machine
  3. Run ipython qtconsole --existing kernel.json --ssh user@host

I recently upgraded to El Capitan and upgraded to Jupyter on both remote and local machines. Now when I attempt to run ipython qtconsole with the existing flag, I get the following error:

[JupyterQtConsoleApp] CRITICAL | Could not find existing kernel connection file

Any ideas?

Docs Typo

There's a typo at:

http://jupyter.org/qtconsole/stable/config_options.html

These options can be set in ~/.jupyer/jupyter_qtconsole_config.py, or at the command line when you start it.
<

Note the missing 't' in .jupyter. I was looking for the docs to fix and submit a pull request, but it looks like the source rst file docs/source/config_options.rst is excluded from the repo via .gitignore...?

After a kernel reset, input line hangs

Windows with Jupyter QtConsole 4.1.1 but I have seen this on Linux on iPython too.

  • Add these lines to ipython_config.py, because I want pylab mode and autoreload for my development.
    c.InteractiveShellApp.extensions = ['autoreload', 'pylab']
    c.InteractiveShellApp.exec_lines = ['%autoreload 2', '%pylab']
  • Then use ctrl+. to reset the kernel.

If I am running QtConsole for some time, sometimes the input hangs. I will have to close the application and open it again.

This is not a big issue, but wanted to see if I am alone in seeing this problem and if there is any workaround, or if I could help debugging this.

Occasionally, Qtconse stops responding to some keystrokes

I am using Jupyter QtConsole 4.1.1 from Continuum's Anaconda.

Every once in a while, the Qtconsole windows stops accepting some keystrokes. I can still enter most characters and numbers, but if I press e.g. return or backspace, nothing happens.

Sometimes I can get things to work again by either:

  • Opening a new tab (and then switching back to the old one)
  • Pressing Ctrl-p or Ctrl-y repeatedly

Is there anything I can do to debug this further?

LaTeX that matplotlib fails on should fallback to the next renderer

There is a lot of advanced LaTeX that the matplotlib renderer cannot handle. If an object defines a LaTeX repr that it can't handle, it just shows the error message. It should fallback to the next renderer.

This is causing an issue for us with SymPy (see sympy/sympy#9962). SymPy is able to print expressions using Unicode, but when the renderer fails (in this case, for matrices), it just shows the error

Failed to render latex: 
\left[\begin{matrix}1 & 2\\3 & 4\end{matrix}\right]
      ^
Expected "\right" (at char 6), (line:1, col:7)

To reproduce:

  • First, make sure you don't have latex installed in your PATH (or else it will just use that and not matplotlib)
  • Install the latest version of SymPy
  • Start the qtconsole and run
from sympy import *
init_session()
Matrix([[1, 2], [3, 4]])

Tab completion inside Jupyter QtConsole ipdb shell

Hi there,

I have just discovered that the tab completion utility seems to be offline when using tracing with ipdb but only with qtconsole of the jupyter variety. By which I mean that the ipython qtconsole still has functioning tab completion during an ipdb trace so I am curious if anyone knows how to enable this, or if this needs to become something to eventually work into a later version.

Cheers,
Devin

the launcher on windows keeps a dos window open

Hi,

When we double-click on "jupyter-qtconsole" on windows, there is a background black window that remains open.

qt-console_black_window

It was already present in QtConsole 3.2.0. Is there a small possible fix for that ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.