6 ms·
Elixir Livebook now as a desktop app
- Existenceblinks 4y agoRelated question: would people pay for this kind of localhost desktop app? I'd love to sell an elixir app without bothering Electron or Rust based engine.
- brightball 4y agoI’d be interested to see the details of how they did that. Very cool!
- Aqua_Geek 4y agoYou can have a look at the code: https://GitHub.com/livebook-dev/livebook/tree/main/app_bundler https://GitHub.com/livebook-dev/livebook/tree/main/app_bundl...
- powersurge360 4y agoI, too, am interested but I'm not terribly literate in elixir yet. I am aware that you can compile executables in elixir with a release command but I'd be curious to hear more about (or at least be pointed to the specific spots in the code) how the bundling was done to give you a discrete application per platform, with app icon and everything. Having a script that opens a web browser pages is simple enough, but the extra sugar on top to wrap in an app bundle that shows up in your task bar or dock is something I am very curious about. EDIT: Someone further down the thread linked to a more specific place and that led me to the macos.ex file[1] (which is what I was most interested in, being on macOS myself. It looks like at least in the case of macOS it will build the bundle by hand, template in enough swift code to build the application, sign and notarize a bundle, and add the compiled elixir program in there. Pretty interesting. I guess the idea is that you write just enough swift to manage the life cycle of the compiled elixir application. It's an interesting approach but it seems like it would be frustrating and fragile. [1]: https://github.com/livebook-dev/livebook/blob/355527f7e8034ef96a0ff1d7a27c5a30745585ae/app_bundler/lib/app_bundler/macos.ex https://github.com/livebook-dev/livebook/blob/355527f7e8034e...
- wojtekmach 4y agoRight, so our goal was to allow configuring the bundle with app icons etc and importantly custom URL schemes and file types [1]. And then macOS- [2] and Windows- [3] specific launchers capture the "open file" and "open url" events and trigger the Elixir side of things. Another reason for native launchers is if for any reason we couldn't start the Elixir side, we want to let the user know that something went wrong and point to logs. (We have that on Mac and will have on Windows very soon.) [1]: https://github.com/livebook-dev/livebook/blob/920f70817efbacbb160483af895293f9fb43717d/mix.exs#L148:L178 https://github.com/livebook-dev/livebook/blob/920f70817efbac... [2]: https://github.com/livebook-dev/livebook/blob/920f70817efbacbb160483af895293f9fb43717d/app_bundler/lib/templates/macos/Launcher.swift.eex https://github.com/livebook-dev/livebook/blob/920f70817efbac... [3]: https://github.com/livebook-dev/livebook/blob/920f70817efbacbb160483af895293f9fb43717d/app_bundler/lib/templates/windows/Launcher.vb.eex https://github.com/livebook-dev/livebook/blob/920f70817efbac...
- powersurge360 4y agoI know linux is a future supported platform but as far as I'm aware, there's not a clear unified way to build bundles in this way across linux distributions. What kind of things are you folks considering if you don't mind my curiosity.
- wojtekmach 4y agoWe don't plan to add Linux support ourselves at the moment but we'd love a contribution.
- mercer 4y agoare there any plans to also have LiveBook open up in a separate wrapper app, like Electron?
- aaaaaaaaaaab 4y agoIs it by any chance an Electron app?
- ch4s3 4y agoIt uses an erlang binding for wxWidgets[1]. [1]https://www.wxwidgets.org/ https://www.wxwidgets.org/
- lvass 4y agoWhat for? The Livebook interface is built with Phoenix Liveview.
- ch4s3 4y agoThe window it runs in.
- lvass 4y agoIs this required in some OS and not another? A comment in this thread claims it just uses a browser tab.
- ch4s3 4y agoIt's used for the desktop app, as you can see here[1]. [1] https://github.com/livebook-dev/livebook/blob/355527f7e8034ef96a0ff1d7a27c5a30745585ae/lib/livebook_app.ex https://github.com/livebook-dev/livebook/blob/355527f7e8034e...
- powersurge360 4y agoThanks for linking this. I was interested in how it worked but I didn't know enough elixir to get around the codebase by myself. This entry point is very informative for how they managed to do it. I just looked at the macOS part, but the tl;dr for that is they seem to have compiled the elixir program into a binary and wrote enough swift to manage the lifecycle of the elixir program and signed it and notarized it and prepared it for shipment using CLI via shell! invocations. I didn't look at the windows way of doing things but I imagine it's similar.
- adriancarrieres 4y agoA super cool notebook, you should give it a try even without knowing Elixir with the tutorials coming with it :D
- wawjgreen 4y agonot sure what the livebook is--the landing page is not sufficiently clear or coherent.
- CodeSgt 4y agoThe headline on the landing page is "Write interactive & collaborative code notebooks in Elixir". That's pretty clear and coherent to me.
- lytedev 4y agoYou're correct that it's not really captured in the prose of the article, but the first image does inform you.
- chrismccord 4y ago> Write interactive & collaborative code notebooks in Elixir Think Jupyter Notebooks (if you're familiar with the python world), but collaborative and for Elixir.
- frellus 4y agoI think this is a fair analogy, but maybe I'd add that LiveBooks uses MarkDown markupfor the non-code part of the notebook, make it far more readable, and with more visualizations coming in. For example, recently an addition to add automatically generated sequence diagrams to Livebook Kino (https://github.com/livebook-dev/kino/pull/165 https://github.com/livebook-dev/kino/pull/165). So generate code which shows a supervision tree, and automatically create a visual diagram of the code in one place. Pretty great for learning and explanatory material.
- nivertech 4y agoNo support for Ubuntu?
- ch4s3 4y agoNot as a downloadable desktop app, yet. You can run it in docker[1]. [1]https://github.com/livebook-dev/livebook#docker https://github.com/livebook-dev/livebook#docker]
- lvass 4y agoI love the concept of local Web servers as GUI substitutes, and hope we get many more of those. Tachidesk is my favorite example. Thanks to Phoenix Liveview, Elixir is becoming a great option in this space. This method gives us every benefit of Electron and almost none of the downsides.
- chadrs 4y agoI have the opposite opinion. These things tend to get lost in my tabs.
- josefrichter 4y agoPin your tab.. But I hear you, having the same problem, there are trade-offs for sure.
- lvass 4y agoOr just bookmark them. They usually have the program name in the page title, on firefox just begin with * on the url bar, or press B if you have Vimium.
- auraham 4y agoI feel the same. Wonder if the author can provide a bare-bones repository/template with Elixir and WxWidgets to create similar apps.
- sidpatil 4y agoThis approach has been around a lot longer than Electron too. Privoxy, i2p, CUPS, etc. were/are all local-first software with Web-based interfaces.
- freedomben 4y agoNo Linux download :-( Nevertheless it's fairly easy to install[1]. If you have docker, you can just run the image to try it out: docker run -p 8080:8080 -p 8081:8081 --pull always livebook/livebook You may want to configure some things, so check out the options[2].: If you want a "native" install, after you have elixir installed you can use mix escript.install hex livebook and start it with livebook server Check out the readme for more configuration options[1] [1]: https://github.com/livebook-dev/livebook#installation https://github.com/livebook-dev/livebook#installation [2]: https://github.com/livebook-dev/livebook#docker https://github.com/livebook-dev/livebook#docker
- ch4s3 4y ago> No Linux download :-( They discussed it, but no one has taken it on yet. I think Wojtek Mach(the desktop initial author) is a mac user, and they actively wanted to provide a way for windows users to easily try it.
- wojtekmach 4y agoWe don't plan to add Linux support ourselves at the moment but we'd love if someone contributed that. As was mentioned elsewhere it might be challenging to provide a bundle that works across different distributions so investigating the possible options would be an important first step.
- ch4s3 4y agoThat's what I assumed was the case. Seems like a good opportunity for the community to take on for major distros.
- commoner 4y agoAn AppImage or Flatpak package would make a great starting point that works across distributions. Making Livebook more accessible to Linux developers would improve its adoption, as well as the adoption of Elixir, Phoenix, and Fly.io.
- 4y ago
- codeptualize 4y agoThis is awesome! Starting it up from the terminal and going to the url was not super convenient for quick tasks and scripts, this is much better. Edit: one thing that would make it even nicer is if it would remember the folder and/or recently opened notebooks.
- redrobein 4y agoWhy would you use a notebook for quick scripts though
- codeptualize 4y agoI often need to inspect/transform some JSON/CSV/text/whatever data, move around/organize a bunch files, and similar things. I find that notebooks work great for that as you don't need to set up an environment, you can easily collect and rerun your scripts if you do need them again, and the output options are great for debugging and looking at data.
- powersurge360 4y agoI know this is a Livebook love-fest, but you may also consider setting up org-mode sometime. There's a lot to love about org-mode but to stay on subject, you can write your documents in a plain text syntax akin to markdown and any of the code blocks that you add in as examples are _executable_. And you can take the output from one and pipe to another. At work, for example, we have to hit a remote API and the secrets are stored in AWS secrets manager. I have some documentation that has a block describing how to get the secrets and some other documentation elsewhere describing how to issue a post request and I can pipe the output from one block into another and receive the output either in the same file or put it somewhere else. The one downside with this extreme flexibility is I sometimes catch myself squirreling away useful functionality in my own notes instead of adding it in a utility CLI or similar where it can be shared with the team. If having access to a scripting language is duct tape, piping output from one script to another in this way in a single file is like having inter-dimensional duct tape.
- 4y ago
- xcambar 4y agoThe Elixir ecosystem is growing incredibly well. I am impressed both from an engineering and a product perspective. It shows that they are playing the long game. I think they are achieving what I wished happen to the Clojure ecosystem: productive, well designed, respected and popular. Clojure missed the last step, unfortunately.
- freedomben 4y agoI agree, and I think their move into ML is a genius move that is going to make elixir mainstream. I'm super excited for the future.
- thejosh 4y agoI've wondered whether it's easier to add data analyst stuff to Elixir that Python seems to have, or add features to Python that Erlang (and by extension Elixir) provides out of the box. By what I can see, if you want multiprocessing on Python in an easier way (let's say running async), you have to use something like ray core[0], then if you want multiple machines you need redis(?). Elixir/Erlang supports this out of the box. Explorer[1] is an interesting approach, where it uses Rust via Rustler (Elixir library to call Rust code) and uses Polars as its dataframe library. I think Rustler needs to be reworked for this usecase, as it can be slow to return data. I made initial improvements which drastically improves encoding (https://github.com/elixir-nx/explorer/pull/282 https://github.com/elixir-nx/explorer/pull/282 and https://github.com/elixir-nx/explorer/pull/286 https://github.com/elixir-nx/explorer/pull/286, tldr 20+ seconds down to 3). [0] https://github.com/ray-project/ray https://github.com/ray-project/ray [1] https://github.com/elixir-nx/explorer https://github.com/elixir-nx/explorer
- jolux 4y agoDefinitely easier to add Pandas to Elixir than preemptively scheduled green threads to Python.
- throwawaymaths 4y ago
- bebrws 4y agoHow many layers can we do!! I’m guessing elixir to JavaScript to v8 or whatever the js vm was called in chrome. Then jit then binary. Communicating over a network or one of those chrome sockets to an elixir or erlang vm so someone else can manage your data. Life is good
- lvass 4y agoNot quite, this is just your standard server side rendering for providing a convenient GUI alongside your erlang vm. There's no layering here, just bundling of things that are usually distributed separately (editor and vm).
- matreyes 4y agoAnd the interaction is handled by Phoenix LiveView (html pushed trough websockets)
- deleted 4y ago[deleted]
- turtlebits 4y agoWas excited for this. However on my M1 mac, it launched once, and now it won't open. Tried killing all processes and now nothing.
- wojtekmach 4y agoSorry about that! A bug report at https://github.com/livebook-dev/livebook/issues/new https://github.com/livebook-dev/livebook/issues/new would be very appreciated, especially with relevant parts from ~/Library/Logs/Livebook.log.
- turtlebits 4y agoThanks for the log location - I killed the erlang process and now it works - it launched in a browser window with no app icon though?
- wojtekmach 4y agoYeah there's no app icon in the Dock because we don't have any GUI besides the menu bar icon.
- throwawaymaths 4y agoIt would be crazy awesome if someone could figure out how to layer python underneath this. There is a very nice feature set in livebook that doesn't really exist in jupyter.
- auraham 4y agoAs others pointed out, the app uses wxWidgets for the UI and Elixir for backend, along with Phoenix. I think similar apps can be created using wxWidgets with Python by replacing Phoenix with another framework, maybe Flask or Django.
- throwawaymaths 4y agoYeah you could but it hasn't been done. I've struggled with jupyter/ipython for a decade. CRDTs like automerge and OTs exist, but they're not in jupyter. It's simply put, not that easy to manage distributed live state in a sane fashion with python (see openstack), the programming model of the underlying language puts obstacles in your way. Meanwhile Erlang was created by a physicist who understood that the speed of light is a thing and consistency of data across distances is a real issue.
- junwonapp 4y agoHow is Livebook using iframes? Is each notebook cell an iframe?
- varispeed 4y agoAny tips why would you want to learn Elixir or what would you use it for? I tried to learn it a couple of years ago. Bought a book and couldn't shake the impression that it was created to be complex and hard to reason about or maybe I am wrong and it is "easy", but has a steep learning curve? That being said, I looked at Go around the same time and I clicked instantly. Easy to read, simple and yet powerful.
- stu2b50 4y agoIt shines at creating highly concurrent applications with a great deal of built in features to provide reliability and resilience. Sounds a lot like a server, and that's what much of the modern use for Elixir is. In particular, one area where it shines is stateful, long-lived requests (e.g, websockets) where many other concurrency models will either rely much more on databases to track state or potentially get choked up. If nothing else it's neat to learn as one of the few somewhat well used languages in modern times that actually adheres to Alan Kay's original conception of OOP.
- didibus 4y agoProps to the Elixir community, it seems for some reason they've attracted a lot of people who have the will, the free time and the talent to provide amazing educational content. I've never seen a language of this size have so much quality learning material and tooling.
- MarkMarine 4y agoThis idea is incredible, and extensible beyond these notebooks. I’d like to see something like this as a general code authoring/collaboration tool, would be nice to see when I’m working in the same code as a co-worker, or supercharged pair programming. Obviously scaled too large this would be chaos, but on a 6 person team I think this would be killer.
- frellus 4y agoI'm currently reading an Elixir Patterns book (https://elixirpatterns.dev https://elixirpatterns.dev) which releases a side-by-side Livebook for the material with each chapter. It's a fantastic way to learn and a huge advantage over other languages, I think, to help build up the Elixir community.
- akoutmos 4y agoCo-author of Elixir Patterns here :). Really appreciate the kind words and happy to hear that you are enjoying the book! Hugo Baraúna and I have really enjoyed putting this book together and feel that Livebook has become pivotal in explaining certain topics and really understanding how things work under the hood. I wrote a blog post about some of my thoughts around Livebook as a learning tool on the DashBit blog: https://dashbit.co/blog/livebook-as-an-educational-tool https://dashbit.co/blog/livebook-as-an-educational-tool
- fleeno 4y agoAs someone who also doesn't know Jupyter, what sort of fun and useful things would I do with this? It looks like I can add content and some code blocks that I can execute. I guess taking notes and tinkering? I'm messing with Elixir just for fun, so this caught my eye.