gitmyhub

Eel

Python ★ 6.7k updated 1y ago ▣ archived

A little Python library for making simple Electron-like HTML/JS GUI apps

A small Python library for building desktop apps where HTML and JavaScript handle the interface and Python handles the logic, opening in a browser window that looks like a native app, note the project is effectively unmaintained.

PythonJavaScriptHTMLCSSChromesetup: easycomplexity 2/5

Eel is a small Python library that lets you build a desktop application with a web-page interface, using HTML, CSS, and JavaScript for what the user sees, and Python for the logic running behind it. The result looks like a standalone app (it opens in a browser window without the usual browser controls) but is written with familiar web tools. The README notes that the project is effectively unmaintained and has not received updates in years, so it should be used with that in mind.

The core idea is a two-way communication bridge. You mark Python functions with a decorator and they become callable from JavaScript. You can also call JavaScript functions from Python. This means the Python side can do things that a browser cannot, like reading files from the local filesystem or running number-crunching libraries, while the JavaScript side handles the visual presentation. The README specifically mentions that this makes it useful for combining Python data libraries with JavaScript charting libraries in small internal tools.

Setup is minimal: install the package with pip, put your HTML and JavaScript files in a folder, and start the app with three lines of Python. By default Eel opens the app in Chrome or Chromium in a mode that hides the browser navigation bar to look more like a native app. The start function accepts options for window size, port, which browser to use, and a callback to run when the user closes the window.

Function calls between Python and JavaScript can be done in a fire-and-forget style or with return values, using either callbacks or a synchronous blocking call. The README covers both patterns with examples.

Eel is not intended for large or complex applications. The README positions it as a way to add a quick graphical interface to a Python utility script rather than a foundation for a full application. It can be packaged into a standalone executable using PyInstaller. The project is MIT-licensed.

Where it fits