livebook-dev / kino

Client-driven interactive widgets for Livebook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to use within another Mix project's runtime?

cvincent opened this issue · comments

I've been experimenting with using Livebook as a dev/debug tool in a Phoenix app I'm working on, and it's really nice! I've basically been using it like iex but if it had persistent sessions and nice, organizable output. A "code notebook", one might say. ;)

I wanted to see if I could bring some Kino interactivity into these sessions, but unfortunately I get the following when trying to add it:

** (Mix.Error) Mix.install/2 cannot be used inside a Mix project

This makes sense because we're already attached to a running Mix project with its own set of dependencies. I'm sure I could just add Kino to the actual project's dev dependencies, but as of now I'm the only one on the team using it. Is there an unobtrusive way to use Kino in this manner?

Either way, this and the rest of the Livebook tools are a breath of fresh air, and I'm looking forward to using them more.

Hey @cvincent! The Mix runtime will actually be removed in the next release. We came up with a better way to address this exact limitation. Instead of connecting to a mix project, you can install it as a dependency with Mix.install, together with kino and anything else you want in the notebook. For projects like a phoenix app you also need to specify the configuration file that should be used. See this section for more details. Note that you don't need the latest Livebook version for that, just Elixir v1.14 :)