Trying out dependencies

I often find myself wanting to play with a dependency in IEx. If it’s a dependency not yet in my project or if the project takes some work to set up, my go-to solution is to create a brand new project, add the desired dependency, and try it out. This works, but I end up with lots of throwaway projects to delete, and I’m looking for a simpler solution.

Unable to find anything better I hacked together a mix task for trying dependencies

But I’m wondering if I’ve overlooked a better approach. I thought Mix.Local.Installer.fetch/3 may hold what I’m looking for, but most of the functions it uses seem to take a “get in, do what I want, and get out” approach, whereas I want things to be available in IEx.

Any ideas where I could be looking?

12 Likes

Instead of a random name, would it be better to name the directory after the dependency?

For eg “ecto 1.1”, “jason 2.2”

This will prevent us from redownloading and compiling the dependency every time we run iex -S mix deps.try ecto '~> 3.4.5'