Adzz

Adzz

LivebookHelpers - Creating Livebooks From Module docs

Announcing GitHub - Adzz/livebook_helpers: Generates livebooks from module docs · GitHub

This is a library that generates a livebook from a module’s docs. It turns the module, type and function docs into a livebook, turning any doctests and elixir snippets into elixir cells and setting the doc itself as markdown.

This is helpful for boostrapping livebooks and having interactive versions of the Hexdoccs. You can for example set up a pipeline on hex publish that generates the livebook as part of it.

I’ve experimented with generating a livebook for all the core Elixir modules, for example here is the livebook for the Collectable protocol. Here is a livebook from the Time module.

Feedback welcome :tada:

Most Liked

Adzz

Adzz

Here is a blog post introducing what you can do with it:

Adzz

Adzz

This is a very cool hack but…

I think this nicely sums up most of my programming career to date :sweat_smile:.

Some nice ideas. I think if we were to go that route it could be good to build it into hexdocs itself.
I did try to host for free all the core Elixir module docs on Fly.io but one problem I ran into is there is a bit of a limit on the size of livebook that you can reasonably run.

For example you can’t open or run a livebook created in this manner for the Enum module in Elixir - it’s simply too large.

There isn’t really a workaround for this yet either - each Elixir cell is an instance of the monaco editor so if you have a lot of them the page gets very heavy. See this issue for more.

Last Post!

Rich_Morin

Rich_Morin

Someone clueful will no doubt solve the loading latency and resource usage issues. However, to me the more interesting question is: “How should a communal project Livebook for Elixir developers be structured and implemented?”

Since I’ve come up with a bit of a wishlist, here is a speculative description of what this resource might look like. Comments and suggestions welcome… (ducking :slight_smile: )

-r

Like @Adzz, I really like the notion of having Hexdocs-based Livebooks (and assorted other resources) made available as a “starting point” for my Livebook project notebooks. Here’s a possible use case:

Starting a new project, I instantiate a new project notebook, based on a specified Git branch. This branch might be a group or individual effort; either way it represents someone’s idea of a useful collection.

The notebook would typically have sections containing example code, library documentation, tools, etc. Some of these would be turned on by default; others would be included and described, but commented out.

Most of these items would be well known and popular, but others’ inclusion might be based on personal preferences. In any case, collectively they would make a well-tuned starting point for projects of a particular nature.

After downloading a canonical starting point, I would start it up. At this point, the Livebook would access and fold in preferences set in local control files. At this point, I would have a “live” notebook, ready for customization for a project.

Of course, this is merely the starting point; some of the gnarlier problems deal with how to handle continuing divergence of local notebooks from current practice, etc. I submit that these sorts of issues are already dealt with in various ways (eg, diffs and patch files). That said, I’ll be as interested as anyone to see what might be done in practice.

Where Next?

Popular in Announcing Top

Hal9000
Here is my first stab at this. README pasted below. https://github.com/Hal9000/elixir_random Comments and critiques are welcome. Thank...
New
Crowdhailer
Experimenting with this code. OK.try do user <- fetch_user(1) cart <- fetch_cart(1) order = checkout(cart, user) save_orde...
New
pkrawat1
Hey guyz We at @aviabird are working on a payment library in elixir/phoenix. We are targeting March 2018 to add 56 Gateways to it. Have...
New
tmbb
PhoenixWS - Websockets over Phoenix Channels Source code on Github here: GitHub - tmbb/phoenix_ws: Websockets implemented over Phoenix Ch...
New
tfwright
After working on it for a couple of months and using it in production for most of that time, today I’ve released LiveAdmin, a LiveView ba...
New
type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 10796 134
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 55125 245
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49266 226
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New

We're in Beta

About us Mission Statement