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

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
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
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
pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database. Dep...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

Other popular topics Top

Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
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
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New

We're in Beta

About us Mission Statement