Repository navigation
Releases
Releases · igaurab/gpython
gpynb 0.2.3
Added
- The
hiberbeetheme, from NvChad's theme of the same name: a near-black warm background,
yellow strings, orangedefandreturn, redif, cyan function names and green numbers,
as Neovim shows a Python file, and calls such ashello()in green.:theme hiberbeeor
gpy --theme hiberbee. hiberbee-light, a light theme to go with it. NvChad has no light hiberbee, so this one is
gpython's own: each word keeps its colour, made darker for a warm off-white page.- The file tree shows folders as nvim-tree does: an arrow, a closed or an open folder
picture, and the folder name in the theme's second colour. The pictures come from a Nerd
Font. If your terminal font has none and you see empty boxes,:set noiconsgoes back to
the text arrows (icons = falsein the config);:set iconsshows the pictures again.
gpynb 0.2.1
Added
- An update command.
gpython --updategets 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 devgets the newest code from the main branch on GitHub;
gpython --update stablegoes back to the newest release. In gpython,:update,
:update devand:update stabledo 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 usegit pull. - Two windows can show the same notebook. When a window shows
sc.pyand you ask for it again
in another window (:e sc.pyafter 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.:qcloses 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 DIRremembers 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.pyorctrl+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 isscratchpadin~/.config/gpython/config.toml. - Tab completion in the shell for
gpythonandgpy:gpy --scra+ tab gives--scratchpad,
gpy --theme+ tab lists the themes, and a file argument lists folders and notebooks.
gpython --install-completionssets it up for your shell (bash, zsh, fish or PowerShell): it
writes the script under~/.configand adds one line to the shell's start-up file. Run it
again after an upgrade.gpython --completions SHELLprints the script to place by hand. - The
:prompt shows suggestions.:slists each command that starts withs, 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:band:bd,
and the words of:img:copy:uv:pip:tabmove:foldclose.tab/shift+tab
(ordown/up,ctrl+n/ctrl+p) go through the rows and put the row in the prompt;
enterruns the line. A click on a row does the same astab. After a range (:'<,'>) the
list shows the line commands (sdjmtnormal...). :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;:spand:vstake 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 withG, 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.Runnerandanyio.runwork too. Nothing to import or turn on, and cells that use
awaitrun as fast as before.- Interrupt stops a cell that is waiting in
await, such asawait asyncio.sleep(30). It used
to keep running until something else happened in the kernel.
Changed
- Undo is one timeline for the whole notebook.
uundoes the newest change, in any cell (it goes
there): text you typed, or a cell delete, move, add or markdown/code switch.ctrl+rdoes the
change again, in the editor and in cell mode;:undoand:redodo the same. A deleted cell
that comes back keeps its text history. The timeline holds 500 steps (was 50 cell actions). ctrl+bshows 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+hand backspace go to the explorer only when it is shown; they do not open it.ion a selected cell opens its editor in normal mode, the same asenter; pressiagain to type.
gpynb 0.2.0
Changed
- Running all cells is much faster: a run sends its cells to the kernel as one request and
repaints a few times a second while results stream. 500 cells from launch to the last
cell: 25.8 s before, 1.5 s now. A run of 1000 cells fed by one setup cell is ordered in
milliseconds (was 1.3 s). - The kernel starts a few milliseconds after launch, before the UI, so the first cell is
ready about 0.2 s sooner. - A notebook over 100 cells mounts only the cells around the viewport. Keys, cell moves and
loading stay fast at 500 and 1000 cells;:%s,:gand other ex ranges still reach every
cell. - Text outputs of a cell share one widget: about 30 % less memory per printing cell.
- The bottom bar is a tmux-style status line: the mode badge (NORMAL, INSERT, CELL, …)
on the left and modules on the right: clock, host, cpu, ram, gpu (README, "Bottom
bar"). cpu and gpu are btop-style sparklines of the last samples, ram a block meter,
coloured by load;status.style = "tmux"draws one level glyph instead. All on by
default;status.cpu = falsedrops one,status.layoutorders them,
status.clock_formatsets the clock. The kernel state, theme name and key hints are
gone from it.:set nostatusbarhides it (status_bar = falsein the config;:set statusbarbrings it back). psutil is a new dependency. The kernel chip in the header
carries the kernel dot (green ready, yellow starting or installing, red failed) and,
while the kernel is not ready, the state text;r 6,g 6andr tprompts show in
the header subtitle. - Cell mode is sky blue (
#38bdf8) with dark text: the badge, the cell bar and the block cursor. - User-facing text (notifications, the
:command list, the help screen, the environment
picker, the install prompt, the debugger and variables panels) is rewritten in plain,
short sentences in the style of ASD-STE100 Simplified Technical English. ctrl+w h/j/k/lchooses, among equally near windows, the one that lies most fully beside
the current one as a share of its own size, so two windows from one split tie and the
first wins; a one-row rounding difference no longer decides.- The editor follows vim where app shortcuts collided; the old actions stay in cell mode
(README, "What changed for vim"):ris vim's replace (r 6runs a cell in cell mode,
space r 6in the editor),Jjoins lines,gJjoins without spaces,Kno longer
moves to the previous cell; in normal and visual modectrl+d ctrl+e ctrl+n ctrl+p ctrl+o ctrl+v ctrl+bare vim keys (scroll, jump list, visual block), in insert modectrl+w ctrl+t ctrl+d ctrl+e ctrl+n ctrl+p ctrl+vare. - The cursor is a block in every mode, coloured like the mode's badge (yellow normal, green
insert, magenta visual, red replace); a cell selected in cell mode has a blue bar and a blue
block cursor on its current line; the cell being edited has a bar in the vim mode's colour, a stale cell a salmon one, the cell the debugger is paused in red like the DEBUG badge (was the theme's
accent, often orange like the normal-mode cursor); and the
CELL badge is blue.:set cursor=bar|underlinebrings back the terminal cursor, coloured
per mode.
Added
- Concurrent cells (
:set concurrent, off by default): cells of a run that share no state
run at the same time, on threads in the one kernel. A cell joins a group only if no other
cell in it writes what it reads or writes; magics, top-levelawait,input()and
breakpoint()run alone.:set concurrency=Ncaps a group,:groups(and
gpy --groups nb.py) shows the groups and what each cell waits for. After a group,
a shared name that changed marks its readers stale and the run falls back to one cell at
a time.threadpoolctlis a new dependency. - Outline panel (
ctrl+oin cell mode,:outline): one node per cell with its imports, variables,
functions and classes, the kernel's types once the cell ran, the cell's dependency edges,
and enter to jump. It replaces thef2variables table. - Variables panel (
ctrl+v) and abreakpoint()debugger: loop views with iteration k of
n, pointer strips over sequences, locals with their history, watches, the stack, time
travel over recorded steps (h/l), a timeline (T) and post-mortem where a cell
failed (r d,:debug).debug_detail(auto,full,balanced,lean) caps what is
recorded.input()asks at the bottom of the screen. - Plain
.pynotebooks: new files and scripts are saved without# %%lines; where cells
start and end is kept in~/.gpython/cells(GPYTHON_HOMEmoves it). Files that already
have# %%markers keep them.:copy allcopies the whole notebook. r rreruns the cell run last;r cruns the current cell.gpy --version(or-v) and:version(:ver) show the installed version, read from the package metadata (theversionin pyproject.toml).- Vim:
r,J,U,gi gI gp gP g_ gm g0 g$ ga gd gD g; g, g* g# g& g?,gq/gw,
( ),is as,[( [{ ]) ]} [[ ]] [] ][ [m ]m, the jump list (ctrl+o,tab,''),
scrolling (ctrl+d ctrl+u ctrl+f ctrl+b ctrl+e ctrl+y zz zt zb z. z<enter> z-),ZZ ZQ @: &,
ctrl+g,?backward search (nfollows its direction), registers"0 "1-"9 "- ". "+,
blockwise visual mode (ctrl+v:I A c d y p r ~ u U O $), visualctrl+a ctrl+x g ctrl+a :,
insert-modectrl+w ctrl+u ctrl+t ctrl+d ctrl+r ctrl+a ctrl+e ctrl+y ctrl+n ctrl+p ctrl+v ctrl+j. :swith ranges, vim patterns and replacements, flagsg i I n &, and:&/:&&. The
notebook is one file as in vim::%schanges every cell,$is the notebook's last line.:Q!,:WQ!,:Wq,:W,:X,:QA!(any case of a save / quit command) work like the
lower-case ones.:g/:g!/:vwithd s j > < m t normal(no command: list the lines), and the line
commands:d :j :> :< :m :t :co :normal.Kshows the kernel's help for the name under the cursor; insert-modectrl+ktypes a
digraph (:digraphs); folds are cells:zc za zM zR,:foldclose,:foldopen,Hin
cell mode. Interrupting from insert mode moves tospace r i/ other modes'ctrl+k.gpy, a short alias for thegpythoncommand.- Window management:
ctrl+w zzooms a window to fill its tab (again restores the splits),
ctrl+w xswaps,ctrl+w r/Rrotate,ctrl+w H J K Lmove a window to an edge,
ctrl+w M/:tabmergeundoesctrl+w T,:tabmove Nreorders tabs. - Window manager (
ctrl+w space,:windows): a floating list of tabs, windows and hidden
buffers with a map of the selected tab's layout; go, split, move to a tab, zoom, close,
delete, reorder tabs and filter by name from one popup.
Fixed
ctrl+w + - < >resized the layout only after the next unrelated change.- A removed cell's editor stayed in memory while its completion request waited for the kernel.
- A
breakpoint()stop orinput()prompt that reached gpython before the cell's begin
marker was dropped, and the cell waited forever; the two travel on separate sockets.
gpynb 0.1.2
Added
- Matplotlib figures and other PNG outputs draw as direct kitty graphics placements
(kitty, Ghostty, Rex, WezTerm, Konsole); textual_image's Sixel widget where the terminal
has Sixel, and a card with View and Download buttons where it has no graphics at all. vin cell mode (and:img [N]) views a cell's image full screen: zoom, pan,ssaves
it as PNG next to the notebook,oopens it in the browser;:img save [N|all] [file]
and:img open [N|all].- Markdown cells draw
pictures in place, and[text](x.png)links to
pictures too: http(s) and data URLs, or paths relative to the notebook, fetched in the
background and cached under~/.cache/gpython/images. Animated GIFs play. The cell's
pictures are part ofv/:img. - Vim:
.repeat, counted inserts,~g~gugU,R,><=with motions and
text objects, marks, registers, macros,ctrl+a/ctrl+x, more motions. - Running a cell that imports a missing module offers to install it (pip or uv, like marimo).
tin cell mode shows each cell's run time in its header (saved astimingin the config);
r t [n]times a cell over n runs and prints mean, median, std, variance, p50/p90/p99,
min and max.ctrl+h/ctrl+lmove between the explorer and the notebook.:wq!,:x!,:w!,:wqa!,:xa!and:exitare accepted as their unforced forms.GPYTHON_TTY_LOG=filerecords every byte sent to the terminal, so a session can be
replayed withcat;scripts/kitty_probe.pychecks a terminal's graphics support.- CI runs the tests on every push to main and on pull requests.
Fixed
- A notebook whose folder does not exist still gets a kernel: it starts in the current folder.
- Only the focused editor paints a cursor.