Git Product home page Git Product logo

euporie's People

Contributors

0xflotus avatar jdblischak avatar jessebot avatar joouha avatar kadykov avatar matheusfillipe avatar raffaem 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

euporie's Issues

image rendering on alacritty

Is it a known limitation in Alacritty terminal that can't render the images well?

I don't know anything about sixel and not sure if is usable on Windows. I installed timg in my python env and it broke it.

image

Dragging the scrollbar to scroll is extremely finnicky

When I use my mouse to left click-and-drag the scrollbar in Euporie Notebook, the scrolling is very irregular. Additionally, when I release the left mouse button, the scroll bar sometimes continues to be dragged with the vertical motion of my mouse; an additional click on the scrollbar seems to remove this effect.

The versions of software I am using, as well as a GIF that demonstrates my issue, are included below.

  • euporie 2.0.7
  • Python 3.10.4
  • Ubuntu 22.04
  • gnome-terminal 3.44.0

output

Cursor becomes invisible after exiting notebook

Very impressive repo!

This minor issue is annoying that I have to enter then exit Tmux to recover the cursor.

This behaviour has been confirmed in Kitty, iTem2 and Windows Terminal, so I believe it is not Terminal Emulator-related issue.

License

Any chance you can change the license to MIT or BSD?

Nukes cells after navigating

Hey!

I am amazed at this tool. Very useful! I have unfortunately found an issue which renders it near-unusable for me.

I edit cells with an external editor, but sometimes cells "revert" to their previous content after saving and navigating away from the cell. For example, I add some code using my editor (Neovim), save the code and drop back into Euporie. Randomly, cells suddenly become empty if I navigate away from them, or run them.

Any idea why this might be? I could maybe contribute a solution if you could point me in the right direction.
P

Euporie does not work in Alacritty (without Tmux?)

Hello again!

I am having a really weird issue, where Euporie doesn't output anything if launched from Alacritty, but works fine in gnome-terminal. Also, works fine if run from Tmux within alacritty?

When i run Euporie from "vanilla" Alacritty, there's no output. If i press Ctrl-C, the output is:

Traceback (most recent call last):
  File "/home/peder/.local/bin/euporie", line 8, in <module>
    sys.exit(App.launch())
  File "/home/peder/.local/pipx/venvs/euporie/lib/python3.8/site-packages/euporie/app/__init__.py", line 137, in launch
    app = cls()
  File "/home/peder/.local/pipx/venvs/euporie/lib/python3.8/site-packages/euporie/app/__init__.py", line 71, in __init__
    self.configure()
  File "/home/peder/.local/pipx/venvs/euporie/lib/python3.8/site-packages/euporie/app/__init__.py", line 113, in configure
    super().__init__(
  File "/home/peder/.local/pipx/venvs/euporie/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 314, in __init__
    self._merged_style = self._create_merged_style(include_default_pygments_style)
  File "/home/peder/.local/pipx/venvs/euporie/lib/python3.8/site-packages/euporie/app/__init__.py", line 186, in _create_merged_style
    if self.bg_color:
  File "/home/peder/.local/pipx/venvs/euporie/lib/python3.8/site-packages/euporie/app/term.py", line 181, in bg_color
    if result := _query_term(
  File "/home/peder/.local/pipx/venvs/euporie/lib/python3.8/site-packages/euporie/app/term.py", line 132, in _query_term
    output += stdin.read(1)
KeyboardInterrupt

Tmux is an OK workaround for me, just thought I'd let you know.

euporie==0.1.16
alacritty==0.4.1

Malformed config file

The config file created by euporie lack a } at the end. Then euporie will give warnings when it starts.

Kernel died before replying to kernel_info

Amazing Tool!
I'm trying to run euporie, but my kernel dies as soon as I open a file (I created beforehand with eoporie).

Arch
Python 3.10

 cat log
2022-06-02 23:33:11 DEBUG   [euporie.terminal.send:156] Sending query '\x1bPtmux;\x1b\x1b]11;?\x1b\x1b\\\x1b\\' for ForegroundColor
2022-06-02 23:33:11 DEBUG   [euporie.terminal.send:156] Sending query '\x1bPtmux;\x1b\x1b]10;?\x1b\x1b\\\x1b\\' for BackgroundColor
2022-06-02 23:33:11 DEBUG   [euporie.terminal.send:156] Sending query '\x1b[14t' for PixelDimensions
2022-06-02 23:33:11 DEBUG   [euporie.terminal.send:156] Sending query '\x1bPtmux;\x1b\x1b[c\x1b\\' for SixelGraphicsStatus
2022-06-02 23:33:11 DEBUG   [euporie.terminal.send:156] Sending query '\x1bPtmux;\x1b\x1b_Gi=4294967295,s=1,v=1,a=q,t=d,f=24;AAAA\x1b\x1b\\\x1b\\' for KittyGraphicsStatus
2022-06-02 23:33:11 DEBUG   [euporie.terminal._handle_response:139] Got terminal response for 'BackgroundColor'
2022-06-02 23:33:11 DEBUG   [euporie.terminal._handle_response:139] Got terminal response for 'ForegroundColor'
2022-06-02 23:33:11 INFO    [euporie.app.base.open_file:332] Opening file idea
2022-06-02 23:33:11 DEBUG   [euporie.tabs.notebook.__init__:80] Loading notebooks idea
2022-06-02 23:33:11 DEBUG   [euporie.kernel.start_:228] Starting kernel
2022-06-02 23:33:11 DEBUG   [euporie.kernel.start_:238] Started kernel
2022-06-02 23:33:11 DEBUG   [euporie.kernel.start_:243] Waiting for kernel to become ready
2022-06-02 23:33:12 ERROR   [euporie.kernel.start_:247] Error starting kernel
Traceback (most recent call last):
  File "/home/korny/.local/lib/python3.10/site-packages/euporie/kernel.py", line 245, in start_
    await self.kc.wait_for_ready(timeout=10)
  File "/home/korny/.local/lib/python3.10/site-packages/jupyter_client/client.py", line 201, in _async_wait_for_ready
    raise RuntimeError("Kernel died before replying to kernel_info")
RuntimeError: Kernel died before replying to kernel_info
2022-06-02 23:33:12 DEBUG   [euporie.kernel.stop_:224] Kernel None shutdown
2022-06-02 23:33:12 DEBUG   [euporie.tabs.notebook.check_kernel:415] Kernel status is 'error'
2022-06-02 23:33:15 DEBUG   [euporie.tabs.notebook.really_close:880] Closing notebook 'idea'
2022-06-02 23:33:15 DEBUG   [euporie.kernel.stop:895] Stopping kernel None (wait=False)
2022-06-02 23:33:15 DEBUG   [euporie.kernel.stop_:224] Kernel None shutdown

KeyError (0)

I'm trying to use euporie in iTerm2, after enabling CSI-u mode I can use Ctrl+Enter but I'm getting:

An error ocurred:
KeyError(0)

light mode

do you plan on adding a mode for light background terminals?

Command palette takes a long time to load

I'm on the dev branch, and Fedora Workstation 36 with Python 3.10.7.

$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.5.0
ipykernel        : 6.15.3
ipywidgets       : 8.0.2
jupyter_client   : 7.3.5
jupyter_core     : 4.11.1
jupyter_server   : 1.18.0
jupyterlab       : 3.4.8
nbclient         : 0.5.5
nbconvert        : 6.5.0
nbformat         : 5.4.0
notebook         : 6.4.12
qtconsole        : 5.1.1
traitlets        : 5.1.1

Sometimes, not always, when I start euporie notebook, the command palette takes a long time to load.

Here is a screencast of the issue.

Exception 'TextArea' object has no attribute 'preferred_width'

Trying to use the inline plotting, I'm using kitty.

Here's the code:

% matplotlib inline
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4])
plt.ylabel('some numbers')
plt.show()

This will immediately exit to the terminal and print the following strace

  File "/Users/yingzhu/miniconda3/envs/python38/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 716, in write_to_screen
    c.write_to_screen(
  File "/Users/yingzhu/miniconda3/envs/python38/lib/python3.8/site-packages/euporie/scroll.py", line 115, in write_to_screen
    self.to_draw = self.arrange_children(write_position)
  File "/Users/yingzhu/miniconda3/envs/python38/lib/python3.8/site-packages/euporie/scroll.py", line 426, in arrange_children
    size = self.get_child_size(i, refresh=True)
  File "/Users/yingzhu/miniconda3/envs/python38/lib/python3.8/site-packages/euporie/scroll.py", line 392, in get_child_size
    size = container.preferred_height(
  File "/Users/yingzhu/miniconda3/envs/python38/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 795, in preferred_height
    return self.content.preferred_height(width, max_available_height)
  File "/Users/yingzhu/miniconda3/envs/python38/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 325, in preferred_height
    dimensions = [
  File "/Users/yingzhu/miniconda3/envs/python38/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 326, in <listcomp>
    c.preferred_height(width, max_available_height) for c in self._all_children
  File "/Users/yingzhu/miniconda3/envs/python38/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 2625, in preferred_height
    return self.content.preferred_height(width, max_available_height)
  File "/Users/yingzhu/miniconda3/envs/python38/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 571, in preferred_height
    sizes = self._divide_widths(width)
  File "/Users/yingzhu/miniconda3/envs/python38/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 632, in _divide_widths
    dimensions = [c.preferred_width(width) for c in children]
  File "/Users/yingzhu/miniconda3/envs/python38/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 632, in <listcomp>
    dimensions = [c.preferred_width(width) for c in children]
  File "/Users/yingzhu/miniconda3/envs/python38/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 316, in preferred_width
    dimensions = [c.preferred_width(max_available_width) for c in self.children]
  File "/Users/yingzhu/miniconda3/envs/python38/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 316, in <listcomp>
    dimensions = [c.preferred_width(max_available_width) for c in self.children]
  File "/Users/yingzhu/miniconda3/envs/python38/lib/python3.8/site-packages/euporie/output.py", line 124, in preferred_width
    return self.content.preferred_width(*args, **kwargs)

Exception 'TextArea' object has no attribute 'preferred_width'

Some setup info:

❯ kitty --version
kitty 0.19.3 created by Kovid Goyal
❯ pip list | rg prompt-toolkit
prompt-toolkit                3.0.18
❯ pip list | rg matplot
matplotlib                    3.4.2
matplotlib-inline             0.1.2
❯ uname -a
Darwin MacBook-Air-4 20.3.0 Darwin Kernel Version 20.3.0: Mon Dec  7 22:03:58 PST 2020; root:xnu-7195.80.16.111.1~1/RELEASE_ARM64_T8101 arm64
❯ pip list | rg euporie
euporie                       0.1.9
❯ pip list | rg ipython
ipython                       7.16.0
ipython-genutils              0.2.0
ptipython                     1.0.1
❯ python --version
Python 3.8.6

Stupid question: Installing from git

Dear developers,

I intended to clone directly from git and install it from there, but I could not find a setup.py. How does it work?

Best,

v.

Feature Request: Change terminal cursor shape depending on mode

Howdy!

I'm really loving the direction euporie is headed. One small request would be to allow customization of the cursor depending on the editing mode. Many people who use modal text editors (e.g., Vim, but not trying to flame any wars) configure their editors to change the cursor shape depending on the mode. For instance, I use a block cursor for command mode and a vertical bar for insert mode (as well as an underline for replace mode, but the former is way more important).

This could be done easily by allowing the user to set a string that may contain escape sequences that is emitted during mode changes, akin to Readline's vi-ins-mode-string and vi-cmd-mode-string. This would also enable further creative uses.

If you'd be willing to provide some pointers to spots in the codebase, I'd be happy to attempt an implementation.

Thanks again for your awesome work!

Feature request: Some ideas for improving input cells

First off: absolutely stoked to see this project - comes so close to my ideal workflow that I got very excited brainstorming additional suggestions. Thanks a ton!

Right now, my jupyter TUI workflow is essentially using Neovim on a left kitty split and ptipython on the right side (i.e. ptpython using the ipython shell. This works surprisingly well for everything (and works across every language, too, just need a REPL). Here's some ideas coming from that.

There is a couple of niceties that ptpython does that would be absolutely fantastic to have in euporie

1) improved vim mode:

ptpython allows you to use vim on an individual input cell. right now to my understanding euporie only allows it on a notebook level, however this basically forces me to use e for every simple edit, which is kind of disturbing to the workflow since I have to do e -> <edit thing> -> :x -> ctrl-r.

Cooler would be if it would be solved like in the jupyterlab vim extension where single escape gets you to normal mode in a jupyter notebook level and shift escape or double escape gets you to vim mode on a notebook level. Another way to remove friction here is to make a write of the temp file executes the respective cell, so we could at least get rid of the last ctrl-r (by the time of write I'm pretty committed to executing it so the ctrl-r feels superfluous).

It would also be helpful to make sure that the tempfile has the right filetype (e..g use .py ending to make sure the editor filetype recognition works and you have LSP etc available)

2) function signatures and other advanced features (or even LSP support)?

image

3) autosuggestion

4) completion while typing

(3/4 look something like this in practice)

image

5) Variable viewer

Like the jupyterlab equivalent

TypeError: __init__() got an unexpected keyword argument 'column' │

Apologies for opening so many issues!

Just ran into an issue with completion. I can reproduce this error reliably when using tab-completion on this locally installed package (pip install -e .). As soon as I press the tab key, I get the following (from priv_lib.che is the private library, I pressed tab after the che)

                                        │ ╭───┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │
                                        │ │[ ]│ 1 from priv_lib.che[IPKernelApp] ERROR | Exception in message handler:                                           │ │
Traceback (most recent call last):      │ ╰───┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
  File "/Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 261, in dispatch_shell                                 │
    yield gen.maybe_future(handler(stream, idents, msg))                                                                                                           │
  File "/Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/tornado/gen.py", line 762, in run                                                     │
    value = future.result()             │                                                                                                                          │
  File "/Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/tornado/gen.py", line 234, in wrapper                                                 │
    yielded = ctx_run(next, result)     │                                                                                                                          │
  File "/Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 576, in complete_request                               │
    matches = yield gen.maybe_future(self.do_complete(code, cursor_pos))                                                                                           │
  File "/Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/ipykernel/ipkernel.py", line 356, in do_complete                                      │
    return self._experimental_do_complete(code, cursor_pos)                                                                                                        │
  File "/Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/ipykernel/ipkernel.py", line 381, in _experimental_do_complete                        │
    completions = list(_rectify_completions(code, raw_completions))                                                                                                │
  File "/Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/IPython/core/completer.py", line 484, in rectify_completions                          │
    completions = list(completions)     │                                                                                                                          │
  File "/Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/IPython/core/completer.py", line 1818, in completions                                 │
    for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000):                                                                        │
  File "/Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/IPython/core/completer.py", line 1861, in _completions                                │
    matched_text, matches, matches_origin, jedi_matches = self._complete(                                                                                          │
  File "/Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/IPython/core/completer.py", line 2029, in _complete                                   │
    completions = self._jedi_matches(   │                                                                                                                          │
  File "/Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/IPython/core/completer.py", line 1373, in _jedi_matches                               │
    interpreter = jedi.Interpreter(     │                                                                                                                          │
  File "/Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/jedi/api/__init__.py", line 725, in __init__                                          │
    super().__init__(code, environment=environment,                                                                                                                │
TypeError: __init__() got an unexpected keyword argument 'column'                                                                                                  │
                                        │                                                                                                                          │

ImportError in Python 3.8

Hi @joouha ,

Thank you for the awesome tool!

Using Python 3.8, euporie v2.1.1 returns the following error.

$ euporie notebook foo
Traceback (most recent call last):
  File "/Users/ym/opt/miniconda3/bin/euporie", line 5, in <module>
    from euporie.core.__main__ import main
  File "/Users/ym/opt/miniconda3/lib/python3.8/site-packages/euporie/core/__init__.py", line 12, in <module>
    from euporie.core.log import default_logs
  File "/Users/ym/opt/miniconda3/lib/python3.8/site-packages/euporie/core/log.py", line 25, in <module>
    from euporie.core.formatted_text.utils import indent, lex, wrap
  File "/Users/ym/opt/miniconda3/lib/python3.8/site-packages/euporie/core/formatted_text/utils.py", line 18, in <module>
    from euporie.core.border import GridStyle, Padding, Thin
  File "/Users/ym/opt/miniconda3/lib/python3.8/site-packages/euporie/core/border.py", line 6, in <module>
    from functools import cache, total_ordering
ImportError: cannot import name 'cache' from 'functools' (/Users/ym/opt/miniconda3/lib/python3.8/functools.py)

Could you please replace functools.cache with functools.lru_cache(maxsize=None), same functionality supported in Python 3.8, as suggested at https://stackoverflow.com/a/66846753 ?

Gnome-terminal shortcuts

Do you know how to get cltr+enter and cltr+shift+enter to work in gnome-terminal?

seems I need to do something like this but not sure what I'm looking for
https://github.com/joouha/euporie#key-remapping

I confirmed that all three enter, cltr+enter and shift+cltr+enter return the same thing by running showkey -a and they all return ^M or the 0x0d which is the \r character

jupyter-client >= 6.2.0

Awesome project!
I see you require jupyter-client>=6.2.0, but the latest working version is 6.1.12 (6.1.13 and 6.2.0 were yanked).

Plots with matplotlib

Dear developers,

Somehow I experience this bug that the plot turns black once I move around to other cells. I saw that you were using matplotlib as well in your examples, did you have a certain configuration for your gui?

Best,

v.

Refresh notebook

Would it be possible to implement (1) a menu entry that refresh the notebook (i.e. reload it from file) and (2) a feature that continuously monitor the notebook file for changes, and if there are changes, automatically reload it?

The use case is: I edit the notebook in plain vim with the percentage format, and then convert it back to notebook format with jupytext.

I know euporie has vim keybindings, but I have a whole ecosystem in vim which goes beyond keybindings (custom keybindings, plugins, etc.), so I would like to edit the notebook in plain vim, and update it with jupytext.

It would be great if euporie could refresh the notebook automatically.

AttributeError: 'NotebookApp' object has no attribute 'background_tasks'

This is such a cool app! Thank you for this! :)

I tried to run it in iterm2 using Python 3.11.0 on macOS Ventura (13.0.1) after running:

python -m pip install --user euporie
euporie-notebook

And it launches, but when I do CTRL+n to create a new notebook, it unfortunately gives an error:
Screenshot 2022-12-01 at 08 31 10

I can't select the ? in that image, but I can select copy traceback, which doesn't do anything immediately, but if I hit CTRL+q, it prints the following traceback

2022-12-01 08:24:02 CRITICAL Uncaught exception     euporie.core.log.handle_exception:421
Traceback (most recent call last):
    File "/Users/friend/Library/Python/3.11/bin/euporie-notebook", line 8, in <module>
      sys.exit(main())
               ^^^^^^
    File "/Users/friend/Library/Python/3.11/lib/python/site-packages/euporie/notebook/__main__.py", line 8, in main
      __main__.main(__name__.split(".")[1])
    File "/Users/friend/Library/Python/3.11/lib/python/site-packages/euporie/core/__main__.py", line 10, in main
      return entry.load().launch()
             ^^^^^^^^^^^^^^^^^^^^^
    File "/Users/friend/Library/Python/3.11/lib/python/site-packages/euporie/core/app.py", line 534, in launch
      return cls().run()
             ^^^^^^^^^^^
   File "/Users/friend/Library/Python/3.11/lib/python/site-packages/prompt_toolkit/application/application.py",
  line 978, in run    return loop.run_until_complete(
             ^^^^^^^^^^^^^^^^^^^^^^^^
   File
  "/usr/local/Cellar/python@3.11/3.11.0/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_event…
  , line 650, in run_until_complete    return future.result()
             ^^^^^^^^^^^^^^^
   File "/Users/friend/Library/Python/3.11/lib/python/site-packages/prompt_toolkit/application/application.py",
  line 891, in run_async    await self.cancel_and_wait_for_background_tasks()
   File "/Users/friend/Library/Python/3.11/lib/python/site-packages/euporie/core/app.py", line 832, in
  cancel_and_wait_for_background_tasks    for task in self.background_tasks:
                  ^^^^^^^^^^^^^^^^^^^^^
  AttributeError: 'NotebookApp' object has no attribute 'background_tasks'

I also tried uninstalling with pip and then reinstalling with pipx, but got the same error and traceback:

2022-12-01 08:40:32 CRITICAL Uncaught exception
euporie.core.log.handle_exception:421
Traceback (most recent call last):
              File "/Users/friend/.local/bin/euporie", line 8, in <module>
                sys.exit(main())
                         ^^^^^^
             File
            "/Users/friend/.local/pipx/venvs/euporie/lib/python3.11/site-packages/euporie…
            , line 10, in main    return entry.load().launch()
                       ^^^^^^^^^^^^^^^^^^^^^
             File
            "/Users/friend/.local/pipx/venvs/euporie/lib/python3.11/site-packages/euporie…
            , line 32, in launch    main(app)
             File
            "/Users/friend/.local/pipx/venvs/euporie/lib/python3.11/site-packages/euporie…
            , line 10, in main    return entry.load().launch()
                       ^^^^^^^^^^^^^^^^^^^^^
             File
            "/Users/friend/.local/pipx/venvs/euporie/lib/python3.11/site-packages/euporie…
            , line 534, in launch    return cls().run()
                       ^^^^^^^^^^^
             File
            "/Users/friend/.local/pipx/venvs/euporie/lib/python3.11/site-packages/prompt_…
            , line 978, in run    return loop.run_until_complete(
                       ^^^^^^^^^^^^^^^^^^^^^^^^
             File
            "/usr/local/Cellar/python@3.11/3.11.0/Frameworks/Python.framework/Versions/3.…
            , line 650, in run_until_complete    return future.result()
                       ^^^^^^^^^^^^^^^
             File
            "/Users/friend/.local/pipx/venvs/euporie/lib/python3.11/site-packages/prompt_…
            , line 891, in run_async    await self.cancel_and_wait_for_background_tasks()
             File
            "/Users/friend/.local/pipx/venvs/euporie/lib/python3.11/site-packages/euporie…
            , line 832, in cancel_and_wait_for_background_tasks    for task in self.
            background_tasks:                ^^^^^^^^^^^^^^^^^^^^^
            AttributeError: 'NotebookApp' object has no attribute 'background_tasks'

Images not displaying in console but do in notebook

Hi, thanks for sharing this incredible project. I've just started using the console and am having trouble getting images to display from matplotlib.

I'm using WezTerm and from running console with logging, the images are being rendered with chafa. In euporie notebook everything is working great. But in euporie console, the same commands yield only a blank space.

I've tried using a couple of other terminals and found that Kitty has the same issue while Gnome terminal or Gnome console works (with inferior rendering of course).

Let me know if there is any additional information I can provide for this.

Close the menu?

It may be me, but I think <Escape> should close an open menu?

Instead only <Tab> seems to do the job.

Is this intended?

StdinNotImplementedError: raw_input was called, but this frontend does not support input requests.

I just tried using %debug, however encountering the following

│                                                                                           │   
│ /Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/IPython/core/ultratb │   
│ .py:1266 in debugger                                                                      │   
│                                                                                           │   
│   1263 │   │   │   │   if etb and etb.tb_next:                                            │   
│   1264 │   │   │   │   │   etb = etb.tb_next                                              │   
│   1265 │   │   │   │   self.pdb.botframe = etb.tb_frame                                   │   
│ ❱ 1266 │   │   │   │   self.pdb.interaction(None, etb)                                    │   
│   1267 │   │                                                                              │   
│   1268 │   │   if hasattr(self, 'tb'):                                                    │   
│   1269 │   │   │   del self.tb                                                            │   
│                                                                                           │   
│ /Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/IPython/core/debugge │   
│ r.py:305 in interaction                                                                   │   
│                                                                                           │   
│   302 │                                                                                   │   
│   303def interaction(self, frame, traceback):                                        │   
│   304 │   │   try:                                                                        │   
│ ❱ 305 │   │   │   OldPdb.interaction(self, frame, traceback)                              │   
│   306 │   │   except KeyboardInterrupt:                                                   │   
│   307 │   │   │   self.stdout.write("\n" + self.shell.get_exception_only())               │   
│                                                                                           │   
│ /Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/pdb.py:357 in interaction          │   
│                                                                                           │   
│    354 │   │   │   self.forget()                                                          │   
│    355 │   │   │   return                                                                 │   
│    356 │   │   self.print_stack_entry(self.stack[self.curindex])                          │   
│ ❱  357 │   │   self._cmdloop()                                                            │   
│    358 │   │   self.forget()                                                              │   
│    359 │                                                                                  │   
│    360def displayhook(self, obj):                                                    │   
│                                                                                           │   
│ /Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/pdb.py:322 in _cmdloop             │   
│                                                                                           │   
│    319 │   │   │   │   # keyboard interrupts allow for an easy way to cancel              │   320 │   │   │   │   # the current command, so allow them during interactive input      │   321 │   │   │   │   self.allow_kbdint = True                                           │   
│ ❱  322 │   │   │   │   self.cmdloop()                                                     │   
│    323 │   │   │   │   self.allow_kbdint = False                                          │   
│    324 │   │   │   │   break                                                              │   
│    325 │   │   │   except KeyboardInterrupt:                                              │   
│                                                                                           │   
│ /Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/cmd.py:126 in cmdloop              │   
│                                                                                           │   
│   123 │   │   │   │   else:                                                               │   
│   124 │   │   │   │   │   if self.use_rawinput:                                           │   
│   125 │   │   │   │   │   │   try:                                                        │   
│ ❱ 126 │   │   │   │   │   │   │   line = input(self.prompt)                               │   
│   127 │   │   │   │   │   │   except EOFError:                                            │   
│   128 │   │   │   │   │   │   │   line = 'EOF'                                            │   
│   129 │   │   │   │   │   else:                                                           │   
│                                                                                           │   
│ /Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/ipykernel/kernelbase │   
│ .py:845 in raw_input                                                                      │   
│                                                                                           │   
│   842 │   │   StdinNotImplementedError if active frontend doesn't support stdin.          │   
│   843 │   │   """                                                                         │   
│   844 │   │   if not self._allow_stdin:                                                   │   
│ ❱ 845 │   │   │   raise StdinNotImplementedError(                                         │   
│   846 │   │   │   │   "raw_input was called, but this frontend does not support input req │   
│   847 │   │   │   )                                                                       │   
│   848 │   │   return self._input_request(str(prompt),                                     │   
╰───────────────────────────────────────────────────────────────────────────────────────────╯   
StdinNotImplementedError: raw_input was called, but this frontend does not support input        
requests.                                                                                       

For what it's worth, I tried to debug an issue with Kitty rendering

╭──────────────────────────── Traceback (most recent call last) ────────────────────────────╮ 
│ <ipython-input-5-1eb00ff78cf2>:1 in <module>                                              │ 
│                                                                                           │ 
│ /Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/matplotlib/pyplot.py │ 
│ :353 in show                                                                              │ 
│                                                                                           │ 
│    350 │                                                                                  │ 
│    351 │   """                                                                            │ 
│    352 │   _warn_if_gui_out_of_main_thread()                                              │ 
│ ❱  353 │   return _backend_mod.show(*args, **kwargs)                                      │ 
│    354                                                                                    │ 
│    355                                                                                    │ 
│    356 def isinteractive():                                                               │ 
│                                                                                           │ 
│ /Users/yingzhu_/matplotlib-backend-kitty/__init__.py:79 in show                           │ 
│                                                                                           │ 
│   76 │   │   │   Gcf.destroy(manager)                                                     │ 
│   77 │                                                                                    │ 
│   78 │   def show(*args, **kwargs):                                                       │ 
│ ❱ 79 │   │   _Backend.show(*args, **kwargs)                                               │ 
│   80 │   │   Gcf.destroy_all()                                                            │ 
│   81 │                                                                                    │ 
│   82 │   trigger_manager_draw = _trigger_manager_draw                                     │ 
│                                                                                           │ 
│ /Users/yingzhu_/miniconda3/envs/python38/lib/python3.8/site-packages/matplotlib/backend_b │ 
│ ases.py:3524 in show                                                                      │ 
│                                                                                           │ 
│   3521 │   │   │   return                                                                 │ 
│   3522 │   │   for manager in managers:                                                   │ 
│   3523 │   │   │   try:                                                                   │ 
│ ❱ 3524 │   │   │   │   manager.show()  # Emits a warning for non-interactive backend.     │ 
│   3525 │   │   │   except NonGuiException as exc:                                         │ 
│   3526 │   │   │   │   cbook._warn_external(str(exc))                                     │ 
│   3527 │   │   if cls.mainloop is None:                                                   │ 
│                                                                                           │ 
│ /Users/yingzhu_/matplotlib-backend-kitty/__init__.py:47 in show                           │ 
│                                                                                           │ 
│   44 │   │   # gather terminal dimensions                                                 │ 
│   45 │   │   rows = int(tput("lines"))                                                    │ 
│   46 │   │   px = icat("--print-window-size")                                             │ 
│ ❱ 47 │   │   px = list(map(int, px.split("x")))                                           │ 
│   48 │   │                                                                                │ 
│   49 │   │   # account for post-display prompt scrolling                                  │ 
│   50 │   │   # 3 line shift for [\n, <matplotlib.axes…, >>>] after the figure             │ 
╰───────────────────────────────────────────────────────────────────────────────────────────╯ 
ValueError: invalid literal for int() with base 10: ''                                        

partial sixel rendering

While playing with your euporie browser example I saw that you do a low quality prerendering of graphics while they are not fully in viewport, and once they are fully in the viewport, switch to better quality with sixel.

This currently raises 3 issues:

  • low UX, as peeps first see a blurry preview like thingy
  • issues with overly big graphics not fitting into the viewport - no chance to get nice quality output here at all?
  • (blurry preview still has cell width issues, at least in the browser variant)

Thus I wonder if it would be feasible to do partial sixel rendering.

Now the main issue with sixels is - it is very expensive to convert the original image into sixel in the first place, as it needs quantization and dithering. So ideally one want to do that only once and cache the result.
On the other hand the advanced image algos needed for sixel conversion kinda make pre-slicing the original image into line parts and separately convert to sixel a no-go, as the created color palettes and dithering pattern are not stable (would lead to ugly stitching artefacts).

A possible solution to all those downsides would be a sixel-cropping library, eg.:

  • create full sixel repr of the original image
  • crop into that sixel as needed (pull pixel area WxH with needed colors)
  • print the cropped part

A more involved solution would be to write own sixel converter capable to freeze the color palette, and do the substitution on slices of the original image. This would need one initial quantization step creating a color substitution map with dithering marks. With that slices can be created pretty fast and memory efficient. (I suggested something similar here for the julia peeps, as they are keen to code such a thingy on their own).

So I wonder if you are interested in such an enhancement for sixel output. In general I'd lean more towards to the sixel-crop library idea, which should be straight forward to implement.

Open in external editor fails

When pressing e I'm getting the following warning, and the process never completes.

/1ib/python3.9/site-packages/euporie/commands/base.py:165: RuntimeWarning: coroutine 'edit_in_external_editor' was never awaited
self.handler()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

euporie 1.3.2, OSX, export EDITOR=nvim

question: sample config file for different kernel

Hi, Can someone give me a config file example for euporie notebook for non-default kernel name and kernel connection file? I am using it on Windows and can't connect to an existing kernel in a python venv.

C:\Users\asharaf>jupyter kernelspec list
Available kernels:
  python3    C:\Users\asharaf\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\share\jupyter\kernels\python3
  xpython    C:\Users\asharaf\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\share\jupyter\kernels\xpython

How to hide cell output?

Sorry for the question here but I couldn't find a discussion section nor a IRC chat.

How can I hide the output of a cell?

non-default kernel issue on Windows

I've tried euporie on WSL (with Ubuntu) and it works. Now I need to use it on Windows because my python package (arcpy) is just running on Windows. I installed it via pipx on Windows but cannot configure it with a non-default kernel. Is it something you can help?

my existing kernels:

C:\Users\asharaf>jupyter kernelspec list
Available kernels:
  python3    C:\Users\asharaf\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\share\jupyter\kernels\python3
  xpython    C:\Users\asharaf\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\share\jupyter\kernels\xpython

euporie configuration file:

PS C:\Users\asharaf\AppData\Local\euporie> cat .\config.json
{
  "color_scheme": "dark",
  "syntax_theme": "native",
  "notebook": {
    "expand": false,
    "always_show_tab_bar": true,
    "show_cell_borders": false,
    "kernel_connection_file": "C:\Users\asharaf\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\share\jupyter\kernels\python3\kernel.json",
    "kernel_name": "python3"
  },
  "console": {
    "color_scheme": "default",
    "syntax_theme": "dracula"
  },
  "preview": {
    "show_cell_borders": true
  }
}

euporie log:

image

`euporie --version` not working

euporie --version not working, prints the following

usage: euporie [-h] [--version] [--log-file [LOG_FILE]] [--debug | --no-debug] {edit,preview,hub} ...
euporie: error: unrecognized arguments: --version

Version: 1.6.1
Python: 3.9.7

two suggestions

Thanks for very good repo. I'm from vim world and because of so much distractions, can't handle work in Juyterlab in browser.
two suggestions though:

  1. selecting in output window.
    when we get an error, we have have to select it by mouse, which is not convenient. it would be better if we could switch window and be in 'visual mode' in output window to be able to copy text and search later.
  2. vim like syntax inside cells.
    it would be better if we could use the superpowers that vim give to us, I mean something like this

[Feature request] Toggle top menu

Thanks for the great project!

Is there an option to toggle whether the top menu (File, Edit, etc.) is displayed, and can this be activated by a keyboard shortcut? Having the ability to remove the top menu at times would aid a minimalist setup greatly.

Define Custom Keybindings

Hi @joouha
Is there a way to define custom keybindings? Most of the keybindings (Ctrl+N, etc) conflict with emacs keybindings/ terminals. So for the stuff that I rarely use, I'd probably turn them off.

Right now it's not possible to load some config right? I presume I need to change https://github.com/joouha/euporie/blob/main/euporie/key_binding/bindings/micro.py

Maybe having an easy method for editing custom keybindings could be an interesting addition. I might look into this.

Dependencies

I was wondering why numpy, pandas, pillow, scikit-image and sklearn are required?

Recover deleted cells

Thank you for this awesome tool!
I love the Vim-like keybindings of Euporie.

While using Euporie, I sometimes mistakenly delete cells, but could not find a way to recover.

It would be great if Euporie has "Undo Delete Cells" feature similar to Jupyter.

Alternatively, it would be also helpful to have an option to back up the deleted cells in the tmp directory (e.g. /tmp/euporie_deleted_cell_2022-12-30T23:59:59.py) so that users can recover later.

Configuration options

  1. here it says that "configuration options are listed below", but nothing is listed
  2. here it talks about the configuration file, but it is not explained what are the valid configuration options.
    My understanding is that they are the same as the command line options, but (1) without the -- at the start, (2) with - in the middle substituted with _ (e.g. the --color-scheme command line options becomes the color_scheme config file option), and (3) command line options that don't take parameters are boolean options in the config file.
    I think we should write that.

Euporie fails to open notebook files with pandas dataframe HTML in cell output

Issue

I noticed that Euporie fails to open notebook files with pandas dataframe HTML in a cell output.

Reproducing steps:

  1. Prepare Python 3.8 environment with pandas (e.g. 1.3.3)
  2. Install euporie version 1.6.2.
pip install euporie==1.6.2
  1. Create and open a new notebook.
euporie foobar.ipynb
  1. Run a code cell which outputs a pandas dataframe HTML.
import pandas as pd

pd.DataFrame()
  1. Save and close the notebook.
  2. Try opening the notebook, but fails to open after several seconds without any errors.
euporie foobar.ipynb
  1. [Workaround] After removing the output from the notebook file, it can be opened by Euporie.
jupyter nbconvert --clear-output --inplace foobar.ipynb

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.