News for hackers. Stuff that matters.
Re:Show HN: Eel – a simple Python library for making little ... by ChrisKnott on Saturday January 06, 2018 @01:58PM (#16086834)
I made this Python library for my own needs because I wanted to make some very simple (30 line) GUI applications using HTML/JS for the frontend.

I thought others might find it useful in situations where it isn't worth the investment of using a real GUI framework.

Tested (a bit) on Python3 on Windows/Mac/Linux.

Interested in any feedback at all, or any existing projects which are similar.

Re:Show HN: Eel – a simple Python library for making little ... by meredydd on Saturday January 06, 2018 @02:53PM (#16087090)
This is neat!

One similar project is https://anvil.works. It's got a pure Python front end rather than HTML/CSS/JS, with a drag-and-drop designer - kinda like a modern Delphi or VB. But the client-to-server function call interface is very similar (are you using websockets too? [edit: Yes you are!]).

It's targeted at traditional web apps, rather than desktop apps, but it has an "uplink" that lets you connect local code (eg here's me building a GUI that shows text on a Raspberry Pi: https://anvil.works/blog/uplink).

Re:Show HN: Eel – a simple Python library for making little ... by sandGorgon on Saturday January 06, 2018 @11:35PM (#16089187)
This is just one step away from being a better Jupyter.

Prototype your code in the notebook ..and then click a single button to export it as a standalone app/API.

People will pay for this !

Re:Show HN: Eel – a simple Python library for making little ... by mlevental on Saturday January 06, 2018 @03:41PM (#16087330)
cool except it's not self-hostable/oss. why would you use a hosted frontend for a local app?
Re:Show HN: Eel – a simple Python library for making little ... by meredydd on Saturday January 06, 2018 @03:55PM (#16087402)
It actually is self hostable (that's how quite a few of our customers use it), but no, it's not OSS (because we needed to build a sustainable business).

Anvil isn't for distributable desktop apps (that's not where most of the action is these days, for better or worse). But we use it for one-offs (driving local code via the Uplink) all the time.

Re:Show HN: Eel – a simple Python library for making little ... by make3 on Saturday January 06, 2018 @03:52PM (#16087390)
from their perspective, to charge people, I guess
Re:Show HN: Eel – a simple Python library for making little ... by ChrisKnott on Saturday January 06, 2018 @04:11PM (#16087480)
Anvil has been on my to-check-out list for a while, I think it's really impressive what you guys have done.
Re:Show HN: Eel – a simple Python library for making little ... by trymas on Saturday January 06, 2018 @02:53PM (#16087088)
I do not want to sound in a bad way, though if you need to create very simple GUIs with Python, what's wrong with Tk?
Re:Show HN: Eel – a simple Python library for making little ... by tasty_freeze on Saturday January 06, 2018 @03:00PM (#16087120)
I'm out of the loop, but I have never seen a Tk interface that didn't look straight out of 1997. Also, many people are "fluent" in HTML/javascript/python, but aren't so familiar with Tk.
Re:Show HN: Eel – a simple Python library for making little ... by JetSpiegel on Saturday January 06, 2018 @08:05PM (#16088448)
Themed TK uses native widgets and it presents the same basic API. It's distributed by default too, it's not an external library. You can use both the old and the new widgets in the same GUI.

For simple GUIs it's easy to use and the code is clean and extendable. There is a canvas object for arbitrary graphics or custom widgets, but without OpenGL support they look ugly and it's not performant. The existing widgets are the basic, so no high-level stuff like date-pickers.

As for the layout "language", there are 3 layout managers that CSS has only begun to reach feature parity: - "pack" which is like flexbox - "grid" which is like CSS Grid - "place" which is like absolutely positioned elements All this can be mixed and matched.

With a couple hundred lines of Python you can do a React-like and bind tightly the entire GUI state to a complex `dict` that can be serialized to JSON in a couple of lines. Don't discount Tk just yet.

Re:Show HN: Eel – a simple Python library for making little ... by vram22 on Sunday January 07, 2018 @03:11PM (#16092407)
>With a couple hundred lines of Python you can do a React-like and bind tightly the entire GUI state to a complex `dict` that can be serialized to JSON in a couple of lines. Don't discount Tk just yet.

Why would you want to serialize it to JSON? To send it to a server or something like that?

Re:Show HN: Eel – a simple Python library for making little ... by JetSpiegel on Sunday January 07, 2018 @07:24PM (#16093704)
Mostly for persistence. Save it into a file, restart the program and load the entire state losslessly. You can also send it to a server or do whatever you want.

With the correct widget types, the business state IS the GUI state and can be treated the same. For simple GUIs, there will be no redundancies and no undefined states.

Re:Show HN: Eel – a simple Python library for making little ... by vram22 on Wednesday January 10, 2018 @02:27PM (#16118078)
>Mostly for persistence. Save it into a file, restart the program and load the entire state losslessly.

Interesting, and makes sense. Coincidentally, just today I was remembering the feature of the Palm IV or V that I used to have (also the Palm Zire later, but don't remember if the latter also had the feature), of saving app state, so that when you turn it on again, all apps would be running (or was it only single-app-at-a-time, don't remember) with their exact state preserved from when you shut it down, down to even the last characters entered in the middle of a field in a form that you were filling in, for example. Also it was an almost instant-on kind of device. And was wishing that my PC / laptop could be that way too. I had read a while ago that some work had been done on much faster booting times for Linux or other OS-based PCs. Don't know the current status of such efforts.

Re:Show HN: Eel – a simple Python library for making little ... by istjohn on Saturday January 06, 2018 @03:13PM (#16087197)
Also, there are a lot of great libraries (e.g., for visualizations) in JS that this would allow you to use.
Re:Show HN: Eel – a simple Python library for making little ... by trymas on Saturday January 06, 2018 @03:18PM (#16087216)
Yes, I know that, though if I'd want a simple GUI in few lines of python probably it's something not client facing and internal use only, thus design aspect is not bothering me.

Simple, functional cross-platform GUIs with Python and Tk is a very nice thing.

If we talking cross-platform production ready, pretty GUIs, probably Python is not the best choice or if we insist on Python, then in pair with something like Qt

Re:Show HN: Eel – a simple Python library for making little ... by ethanpil on Saturday January 06, 2018 @10:39PM (#16089000)
Right. HTML seems like a lot for a small app. I have had some success with AppJar. It might not be the fastest but its super intuitive and easy... http://appjar.info
Re:Show HN: Eel – a simple Python library for making little ... by ChrisKnott on Saturday January 06, 2018 @03:14PM (#16087200)
Personally it was because I wanted to use some widgets from jQueryUI, but mostly people are just lazy and they happen to know HTML/CSS/JS already
Re:Show HN: Eel – a simple Python library for making little ... by zoom6628 on Saturday January 06, 2018 @11:35PM (#16089185)
It looks great. I have been using bottle for simple web application. While there appears to be overlap between the too this looks excellent way to built good quality client apps using browser UI but without the 'ajax-tax' of Electron and its ilk. Looking forward to trying this on some local client apps i have to do in next couple of days.
Re:Show HN: Eel – a simple Python library for making little ... by zitterbewegung on Saturday January 06, 2018 @02:52PM (#16087078)
Could you create a web accessable version of this where you give someone a link and they would have the same access? I like this because I really don't like dropping into javascript in a codebase that already has a bunch of python code.
Re:Show HN: Eel – a simple Python library for making little ... by goostavos on Saturday January 06, 2018 @09:25PM (#16088733)
You may want to check out a project called Wooey. It's a drop-in-and-go frontend for your scripts kind of like Gooey[1], but web rather than native focused.

[0] https://github.com/wooey/Wooey [1] https://github.com/chriskiehl/Gooey

Re:Show HN: Eel – a simple Python library for making little ... by bmelton on Saturday January 06, 2018 @03:35PM (#16087301)
I don't see it mentioned in the README, but is this something I can package into a distributable package?
Re:Show HN: Eel – a simple Python library for making little ... by ChrisKnott on Saturday January 06, 2018 @04:09PM (#16087472)
I'm not sure to be honest, I think it would probably work - you could just bundle all the dependencies (apart from the browser) using 'pip download eel' - that seems to be about 750KB of stuff.

I'm personally not a fan of the "bundle a browser every time" model of Electron but you could maybe do that as well to be completely self contained.

As I mentioned in the README, I think the main use of the library is either prototyping, or internal tools for your own (or your team's) use.

Re:Show HN: Eel – a simple Python library for making little ... by voltagex_ on Saturday January 06, 2018 @08:28PM (#16088544)
toga - sort of.
Re:Show HN: Eel – a simple Python library for making little ... by zserge on Saturday January 06, 2018 @03:35PM (#16087302)
A similar project, but for C/C++/Go (using gtk-webkit, cocoa-webkit and mshtml):

https://github.com/zserge/webview

Does not require a web server (uses JS-to-native bindings instead), which might be a benefit.

Re:Show HN: Eel – a simple Python library for making little ... by kodablah on Saturday January 06, 2018 @06:49PM (#16088172)
An older PoC that someone did in Go very similar to how this project fires up an already-installed browser: https://github.com/utamaro/neje-ui
Re:Show HN: Eel – a simple Python library for making little ... by goostavos on Saturday January 06, 2018 @09:17PM (#16088705)
Shameless plug! I have a similar Python project but focused on building native applications without actually writing a single line of UI code. I call it Gooey[1]! It was front page on HN a few years ago ^_^

The next version is currently in RC1 and brings support for in-UI validation/error messages, better layout customization[2], new widget types, and more!

I'm trying to recruit a few more people to test the current release branch[3] :)

[1] https://github.com/chriskiehl/Gooey. [2] https://user-images.githubusercontent.com/1408720/34464824-c... [3] https://github.com/chriskiehl/Gooey/tree/rc1

Re:Show HN: Eel – a simple Python library for making little ... by hardmath123 on Saturday January 06, 2018 @09:45PM (#16088808)
Neat! It would be cool to port this to one of the node option-parsing libraries, perhaps launching a small Electron-ish webapp for the "gooey."
Re:Show HN: Eel – a simple Python library for making little ... by goostavos on Wednesday January 10, 2018 @05:57PM (#16119938)
My ultimate goal is to get rid of the need for language specific ports -- one front-end to rule them all! :)

The whole thing is currently powered by plain ol' json. The next step on my list is (optionally) shipping an executable that any language can feed the appropriate JSON to in order to get their GUI side for 'free'.

Re:Show HN: Eel – a simple Python library for making little ... by marczellm on Saturday January 06, 2018 @03:12PM (#16087189)
For my similar purposes I made this:

https://github.com/marczellm/tkpf

It's a declarative way to do simple Tk GUIs. Also, Tk does not have to look like 1997, it's themable and it can also use the native widget library on Windows and OS X.

Re:Show HN: Eel – a simple Python library for making little ... by jitl on Saturday January 06, 2018 @05:13PM (#16087758)
The tk native widgets don’t look good, because they don’t follow the OS’s user interface conventions. The most notable issue is that widgets don’t have the correct padding or font, even if they’re being rendered via Cocoa (for example).

The example layout here [0] may be functional, and rendered by the platform, but it does not look “native” because the text areas are shoved right up against each other.

[0] https://user-images.githubusercontent.com/6771275/28181423-d...

Re:Show HN: Eel – a simple Python library for making little ... by djsumdog on Saturday January 06, 2018 @05:02PM (#16087723)
Last time I used Tk was with TCL and yes, it was all Motif (or notif or whatever).

I should probably take a look at it again if it can now do native components. I'm really sick of these bloated new desktop frameworks like Electron.

Re:Show HN: Eel – a simple Python library for making little ... by kofejnik on Saturday January 06, 2018 @05:21PM (#16087796)
I found Remi https://github.com/dddomodossola/remi to be excellent for creating HTML frontends to python apps
Re:Show HN: Eel – a simple Python library for making little ... by zoom6628 on Monday January 08, 2018 @05:56PM (#16101644)
Thanks for pointing out remi which i just gave a test-drive. Also very nice!
Re:Show HN: Eel – a simple Python library for making little ... by mch82 on Saturday January 06, 2018 @08:39PM (#16088584)
Great to see efforts like this trying to move the needle on the designer usability of “native” UI toolkits for Python/Go/Ruby/etc.

Any ideas for other ways designers can help improve/influence the UX of “native” toolkits?

It seems like native UI development (especially for PC or Linux embedded device displays) is stuck years behind the simplicity of layout for the web. And I’m not aware of anyone but Apple doing constraint-based layout (as with Interface Builder). With platforms like Raspberry Pi and BeagleBone increasing the accessibility of embedded Linux design it seems like there’s a need for designer-friendly UI toolkits that don’t require tons of dependencies or the complexity of running a web stack to render a UI, but do require responsiveness across devices and operating systems.

Re:Show HN: Eel – a simple Python library for making little ... by pavlov on Sunday January 07, 2018 @05:40AM (#16090289)
Qt is a great choice for embedded Linux UIs.
Re:Show HN: Eel – a simple Python library for making little ... by nzjrs on Sunday January 07, 2018 @01:34AM (#16089609)
Remi (https://github.com/dddomodossola/remi) is also similar and is shipping in a few commercial products and a few popular raspberry pi apps
Re:Show HN: Eel – a simple Python library for making little ... by Mister_Snuggles on Saturday January 06, 2018 @02:52PM (#16087080)
Wow, that’s pretty cool! I can think of some interesting uses for this!
Re:Show HN: Eel – a simple Python library for making little ... by shivaprasad on Monday January 08, 2018 @06:56AM (#16096148)
I had built a similar one using WebKit + Gtk.. Did not actually know about `--app` option to Chrome. This would have been a good fallback option when Gtk + WebKit is not available..

https://github.com/shivylp/visualpy

Re:Show HN: Eel – a simple Python library for making little ... by lifeformed on Saturday January 06, 2018 @04:22PM (#16087534)
What's the performance like, compared to Electron?
Re:Show HN: Eel – a simple Python library for making little ... by anaphylactic on Saturday January 06, 2018 @11:57PM (#16089269)
Runtime performance will obviously vary across platforms, but in all cases, at least the executable will be much, much smaller! :)
Re:Show HN: Eel – a simple Python library for making little ... by pwaai on Saturday January 06, 2018 @10:12PM (#16088900)
curious why you didn't choose asyncio? If I understand this correctly, it lets you write python endpoints to call from javascript? Does it let you create UI from python only?

Lot of questions because I'd like to see more Python use in front-end/electron type of projects.

Re:Show HN: Eel – a simple Python library for making little ... by dna_polymerase on Saturday January 06, 2018 @10:15PM (#16088911)
You do not understand this correctly:

> [Asyncio] provides infrastructure for writing single-threaded concurrent code using coroutines, multiplexing I/O access over sockets and other resources, running network clients and servers, and other related primitives.

Re:Show HN: Eel – a simple Python library for making little ... by pwaai on Saturday January 06, 2018 @11:33PM (#16089179)
I still don't, what does that mean exactly?
Re:Show HN: Eel – a simple Python library for making little ... by wingerlang on Tuesday January 09, 2018 @03:14AM (#16104431)
> If I understand this correctly, it lets you write python endpoints to call from javascript? Does it let you create UI from python only?

It does not let you write endpoints.

It does not let you make UIs.

All asyncio does it to let you run python code asynchronously.