Skip to content

gpynb 0.2.1

Choose a tag to compare

@github-actions github-actions released this 18 Nov 22:21
· 16 commits to main since this release

Added

  • An update command. gpython --update gets the newest release from PyPI with the tool that
    installed gpython (uv, pipx or pip), and says which version you have after it.
    gpython --update dev gets the newest code from the main branch on GitHub;
    gpython --update stable goes back to the newest release. In gpython, :update,
    :update dev and :update stable do the same; start gpython again to use the new version.
    A gpython that runs from a source folder is not changed: the command says to use git pull.
  • Two windows can show the same notebook. When a window shows sc.py and you ask for it again
    in another window (:e sc.py after a split, :sp sc.py, :vs sc.py, :split v sc.py), that
    window shows the same notebook, where before the cursor went back to the first window. The
    cells, the kernel and the undo steps are the same in the two windows: text that you type, a
    cell that you add, move or delete, and each output show in both. Each window has its own
    scroll position and cursor. :q closes one window and the notebook stays in the other. From
    the file explorer or the file finder, a notebook that is open gets the focus, as before.
  • The mouse changes the size of the windows. Hold the line between two windows that are side by
    side, or the status line of the upper of two stacked windows, and move it.
  • A scratchpad folder for new notebooks. gpython --scratchpad DIR remembers DIR for every
    later launch (gpy --scratchpad . is the folder you are in; a missing folder is made). After
    that, a new untitled notebook saved under a plain name, as in :w save.py or ctrl+s, goes
    to that folder, and the save prompt shows the folder. A name that says where it goes
    (./save.py, ../save.py, ~/save.py, /tmp/save.py) is used as typed. With no scratchpad
    folder the file goes to the folder gpython was started in, as before. gpython --scratchpad ""
    forgets the folder. The setting is scratchpad in ~/.config/gpython/config.toml.
  • Tab completion in the shell for gpython and gpy: gpy --scra + tab gives --scratchpad,
    gpy --theme + tab lists the themes, and a file argument lists folders and notebooks.
    gpython --install-completions sets it up for your shell (bash, zsh, fish or PowerShell): it
    writes the script under ~/.config and adds one line to the shell's start-up file. Run it
    again after an upgrade. gpython --completions SHELL prints the script to place by hand.
  • The : prompt shows suggestions. :s lists each command that starts with s, with one line
    that says what it does. After a command and a space, the list shows what the command takes:
    the options of :set (and the values after =, as in :set cursor=), the themes for :theme,
    folders and notebooks for :e :sp :vs :tabnew :w, the open notebooks for :b and :bd,
    and the words of :img :copy :uv :pip :tabmove :foldclose. tab / shift+tab
    (or down / up, ctrl+n / ctrl+p) go through the rows and put the row in the prompt;
    enter runs the line. A click on a row does the same as tab. After a range (:'<,'>) the
    list shows the line commands (s d j m t normal ...).
  • :split v [file] splits the window into left and right, and :split h [file] into top and
    bottom. The direction comes before the file name; :sp and :vs take it too.

Fixed

  • A file opened in an empty split no longer makes the other window scroll.
  • A new cell at the end of a long notebook (more than 100 cells), added immediately after a
    jump with G, no longer stops gpython with an error.
  • asyncio.run(...) works inside a cell, and so does a library that calls it for you. It used to
    fail with "asyncio.run() cannot be called from a running event loop". loop.run_until_complete,
    asyncio.Runner and anyio.run work too. Nothing to import or turn on, and cells that use
    await run as fast as before.
  • Interrupt stops a cell that is waiting in await, such as await asyncio.sleep(30). It used
    to keep running until something else happened in the kernel.

Changed

  • Undo is one timeline for the whole notebook. u undoes the newest change, in any cell (it goes
    there): text you typed, or a cell delete, move, add or markdown/code switch. ctrl+r does the
    change again, in the editor and in cell mode; :undo and :redo do the same. A deleted cell
    that comes back keeps its text history. The timeline holds 500 steps (was 50 cell actions).
  • ctrl+b shows or hides the file explorer in every mode, also in vim normal mode (where it was
    page up). There is no FILES mode badge: in the explorer the badge says NORMAL, as in vim.
    ctrl+h and backspace go to the explorer only when it is shown; they do not open it.
  • i on a selected cell opens its editor in normal mode, the same as enter; press i again to type.