Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make the README runnable in Livebook :) #415

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

spencerolson
Copy link
Contributor

No description provided.

@spencerolson
Copy link
Contributor Author

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).

[![Version](https://img.shields.io/hexpm/v/req.svg)](https://hex.pm/packages/req)
[![Hex Docs](https://img.shields.io/badge/documentation-gray.svg)](https://hexdocs.pm/req)

[![Run in Livebook](https://livebook.dev/badge/v1/blue.svg)](https://livebook.dev/run?url=https%3A%2F%2Fgit.luolix.top%2Fwojtekmach%2Freq%2Fblob%2Fmain%2FREADME.livemd)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds a "Run in Livebook" button.

The rest of the changes are minor changes to the code samples to make them work in Livebook.

@spencerolson
Copy link
Contributor Author

Check it out in action!

livebook-demo.mp4

@wojtekmach
Copy link
Owner

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.

@spencerolson
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@wojtekmach
Copy link
Owner

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants