pit007
I’m trying to develop a project using Livebook.
So I wrote and tested the code for the first module.
I don’t want to publicize the code to Hex yet, because it’s way too early for this.
I created a new project using mix.
Now I would like to use the code of my first module in Livebook for further development.
When specifying the module name in Livebook’s Mix.install section I get the error message “No package with name…”. I kind of expected this. But then how can I “import” the module for use inLivebook?
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
Hello,
I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










Showing Posts 1 to 10- Show Best Posts
- Show All Posts (oldest first)
- Show All Posts (newest first)
outlog
you can use the
pathoptionw0rd-driven
You may prefer relative paths using
__DIR__. That would resolve to the directory your notebook is in.For this type of work I usually create a directory, run git init, save my notebook here, commit, then run
mix new <library_name>so everything is co-located.An alternative would be to mix new, initialize git, and commit (I always commit immediately after the generator runs before I make any customizations), then save a notebook under the notebooks directory. Then you could do something like
__DIR__/../to go up to the parent directory and load the library that way. This approach is probably better if you’re wanting to include a notebook with your library.The first approach makes sense if your primary focus is the notebook itself with tiny libraries to support it. You never need to publish to hex in either scenario if you don’t want to. If you package the whole thing in a git repository, other users can replicate your work whereas a standalone notebook wouldn’t work without all your dependencies.
You likely do not want to use absolute paths because my
/Users/jeremy/directory is not the same as your/Users/pit007would be for an example. If you’re the only one using the notebook, portability doesn’t matter but I create very few notebooks for just myself.adkron
I like to run an elixir application and then connect to that application instead of directly trying to pull in libraries.
Run your project with something like
iex --sname test --cookie mycookie -S mix, which will start an iex console with your library loaded. Note thesnameandcookieyou use to create the session.Then inside the livebook, find

and click it. A menu will appear, and click the
Configurebutton. Once the popup appears, clickAttached node. You can then fill in yourcookieandnameand click connect. Now your livebook will have access to the same session at your iex console.When you recompile code in iex, the livebook will have all the updated code available.
@w0rd-driven’s solution works. Connecting to a running node is my preferred method.
bmitc
I’m noticing that after recompiling inside IEx, I still have to click the “Reconnect and setup” cell at the top to get the updates, even though there’s nothing in that cell. The Livebook doesn’t automatically update. Is this your experience?
Livebook also doesn’t seem to take into account the
.iex.exsfile where I have pre-entered aliases that I want to use in an IEx session or Livebook notebook. I still have to re-alias things inside the notebook.pit007
No, I just didn’t know I had to recompile.
After all Phoenix notices changes automatically via inotify and recompiles.
Thanks for your comment.
adkron
When starting Phoenix with
iex -S, it no longer seems to pick up the signal to recompile. If you hop into the console and typerecompileit will work. I haven’t tried to see if there is a way to fix this. Using the recompile command, you will not have to restart and reset the connection.pit007
Wonderful
Thank you very much for your help.
Cheers
Peter
adkron
Okay, I did some playing around, and this appears inaccurate. I just tried again and added a function to the LiveView. That seemed not to require a call to
recompile. I’m going to experiment a little and see what I find. I’ll check back in if I figure anything out.linusdm
I had a similar question about recompilation a few months back. José and Jonatan were kind enough to answer my question in the github discussions here: How to recompile installed mix dependency (with `:path` option) without reconnecting runtime? · livebook-dev/livebook · Discussion #1625 · GitHub
Tl;dr: recompilation is not (yet) supported by
Mix.install/2, so reconnecting is the only option, for path-dependencies.bmitc
Interestingly enough, I am now just doing
recompileinside the session started byiex --sname <name> --cookie <cookie> -S mix, and it is working. This exact thing wasn’t working earlier when I posted my previous reply, for whatever reason, but now, I can just dorecompileand then re-evaluate individual cells as expected. I’m not for sure what changed or if Livebook just got into some weird state.I haven’t rechecked the
.iex.exsfile not being read.