req icon indicating copy to clipboard operation
req copied to clipboard

make the README runnable in Livebook :)

Open spencerolson opened this issue 1 year ago • 6 comments

spencerolson avatar Sep 26 '24 19:09 spencerolson

took surprisingly few changes to get this working in Livebook! There is one thing I still can't figure out: with the final code code sample in the README i get

** (Mix.Error) Mix.install/2 can only be called with the same dependencies in the given VM
    (mix 1.15.7) lib/mix.ex:577: Mix.raise/2
    #cell:dy5ab6jj3lj5ooey:1: (file)

And I'm not sure of any way around that other than requiring all of those dependencies at the top in setup (and I felt that'd mess with the flow and intent of the README to have those all installed at the top).

spencerolson avatar Sep 26 '24 19:09 spencerolson

Check it out in action!

https://github.com/user-attachments/assets/b5cbc667-c785-4b8d-9f7d-8209e3ee6bc1

spencerolson avatar Sep 26 '24 20:09 spencerolson

This is a really nice idea! We cannot remove README.md though as it's rendered on GitHub which is important to me. How about we make any necessary changes to README.md and have a README.livemd which is the exact copy (we can have mix.exs keep them identical)?

** (Mix.Error) Mix.install/2 can only be called with the same dependencies in the given VM

Yeah not sure what to do about that either maybe we don't have an exact copy after all and we skip this section in the README.livemd.

wojtekmach avatar Oct 01 '24 08:10 wojtekmach

Thanks!

We cannot remove README.md though as it's rendered on GitHub which is important to me.

I believe GitHub supports .livemd (relevant PR), for example see the livebook from my Weather repo: https://github.com/spencerolson/weather/blob/main/LIVEBOOK.livemd (I still need to convert my README to livemd in that repo too)

spencerolson avatar Oct 01 '24 12:10 spencerolson

Given that GitHub will render .livemd files as markdown, is this something you would consider merging in @wojtekmach ? Thanks!

spencerolson avatar Oct 09 '24 19:10 spencerolson

I was unsure whether README.livemd is considered the README, i.e. rendered when going to project page, and it sure does. So I think this is viable, I'll think about for sure, thank you!

wojtekmach avatar Oct 09 '24 19:10 wojtekmach