Skip to content

Fork of Nathan Whitehead's Pineapple, rewritten entirely in Python3

License

Notifications You must be signed in to change notification settings

darthoctopus/pyneapple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pyneapple: Interactive Jupyter Notebooks for GTK

I've been actively using Pineapple but its development seems to have stalled and/or been stymied by a bunch of bugs in various projects (which I've duly reported upstream). Since I use it as much as I do, I decided to re-implement things in Python instead of wxWidgets. This has a couple of advantages:

  • No explicit dependence on daemonising an external server process, which may otherwise continue running in the background if the main GUI application fails
  • Better integration with Linux desktop environments (at the cost of Mac integration obviously, but I use a global menu and the GUI hasn't changed all than much functionally)
  • Since I'm dogfooding this for my PhD research I can be assured of updates (albeit with a slightly more painful than usual update path)

This was my winter break project of 2017/2018, and I may not be able to update it much until I'm done with quals. Expect bugs (although thanks to Nathan's excellent engineering these may be few — this project owes much to the original Pineapple).

Requirements

I wrote this with GObject introspection and it uses a WebKit2 webview to access Jupyter notebooks proper. I also use setproctitle to keep things tidy (particularly for GTK RecentManager bookkeeping). As far as I know these (via PyGObject) are the only requirements. I've also updated some of Nathan's scripts to use Promises, which are only implemented in Jupyter 5.1 and above.

Running

Install this with either

$pip install pyneapple

or

python3 setup.py build
python3 setup.py install

And execute this as

pyneapple <filename>

Untitled files will be populated in the temp directory (by default ~/.local/share/pyneapple/tmp) when File > New is invoked, or the program is run without arguments with no existing open windows. These are retained between launches.

As a Gtk.Application, pyneapple will automatically keep one instance of the Jupyter notebook server running, keep track of recently opened files, and terminate the server when all windows are closed (on Linux).

Configuration (e.g. default theme, location of Jupyter config directories) can be changed by creating either ~/.pyneapplerc, ~/.config/pyneapple/pyneapplerc or pyneapplerc in the working directory. Look at defaults.cfg for default values.

Screenshot

Extras

I've included a desktop file in extras, to be placed in the application directory (e.g. /usr/share/applications) after installation. It references an icon that doesn't yet exist; I've been personally using the Pineapple icon but may get around to designing a new one shortly (time and medical conditions permitting).