mpope

mpope

Optional Mix deps being fetched with rebar3 plugins?

I have a rebar3 project that I am adding some Elixir deps. I want to keep the deps minimal, and that includes not fetching optional deps. It seems that the libraries that I have tried to use, rebar3_hex, and rebar3_elixir namely, fetch deps that are listed as optional in a project’s mix.exs file. An example is Jason: the decimal dep is fetched. It doesn’t seem as though rebar3 supports optional deps, and it doesn’t look like the mix.lock file contains the relevant metadata to declare that a top level dep is optional. I think the plugins fetch deps by parsing the mix.lock file and constructing a rebar.lock file. Is there any rebar3 plugin or convention that I could be missing that could support this functionality?

Most Liked

tristan

tristan

Rebar3 Core Team

The rebar_mix plugin work by using the list of dependencies from the hex metadata.

My guess is rebar3 would need to be updated to ignore deps marked as optional.

This was never done because it currently, and may always, mean nothing to Erlang projects because unlike Mix the deps list and the .app file are completely separate. I could see that changing since we already have a .app.src it would be possible to add a feature of parsing the applications list and if the app is {app, optional} drop it or change it to just app depending on if the app is included in the final dependencies of the project.

Anyway… got off topic there, tldr: rebar3 needs to learn to ignore dependencies marked as optional in the hex metadata.

ericmj

ericmj

Elixir Core Team

The optional information is in the registry so rebar3 has the information before fetching the package.

Where Next?

Popular in Questions Top

pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New
jc00ke
Expanding on this topic: https://forum.elixirforum.net/t/map-typespec-question/19217 Let’s say I have a map with required and optional k...
New
idi527
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir iex(2)...
New

Other popular topics Top

yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

We're in Beta

About us Mission Statement