> https://hex.pm/packages/wand
I’m glad to see community is stepping up to fill this gap. My personal opinion
is such tools makes it almost “too easy” to adds deps whereas I think we should
do the opposite, encouraging people to audit deps before adding them and
ideally limiting deps in the first place.
In any case, just some unsolicited feedback about Wand:
1. instead of parsing JSON from Hex HTTP API, you can ask the server to provide
response in External Term Format and read it using `:erlang.binary_to_term/0`:
$ curl -H "Accept: application/vnd.hex+erlang"
https://hex.pm/api/packages/wand | elixir -e "IO.read(:all) |>
:erlang.binary_to_term() |> IO.inspect()”
%{
"docs_html_url" => "https://hexdocs.pm/wand/“,
…
(Or use https://github.com/hexpm/hex_core <https://github.com/hexpm/hex_core>
which does this too, it’s deps-free and meant to be vendored into tools like
this one, parts of it are already vendored into Hex and Rebar)
2. Instead of parsing JSON from a deps.json file, you could save Erlang terms
in some deps.config file, one term per line, and read them with
`:file.consult/1`. This way you could drop json dependency completely.
> On 11 May 2019, at 16:45, Anil Kulkarni <[email protected]> wrote:
>
> I actually built the CLI tool & json reader - it's located here:
>
> https://hex.pm/packages/wand <https://hex.pm/packages/wand>
>
> And the usage is similar to yarn in that you can add and update and remove
> packages using the cli
>
> IMO having elixir read from a deps.json as a fallback if mix.exs doesn't
> define deps would be a good path forward. The json format would need to be
> worked out (such as for encoding atoms different than binaries).
>
> Best,
> Anil
>
> On May 10, 2019, at 15:22, 'boris kotov' via elixir-lang-core
> <[email protected]
> <mailto:[email protected]>> wrote:
>
>> Well, it's a nice to have, not something urgent. But a nice to have for most
>> devs, you also would use that feature, if it would be there ;)
>>
>> Am Samstag, 11. Mai 2019 00:05:29 UTC+2 schrieb Andrea Leopardi:
>> > its basic stuff.
>>
>> I disagree because implementing what you're asking in Elixir (or Hex, not
>> much difference since they're shipped together) is a substantial change.
>> Personally, I don't add libraries to projects often enough to make this a
>> problem in any way. I just run "mix hex.info <http://hex.info/> package" so
>> that I know what the latest version is, and then copypaste what "mix
>> hex.info <http://hex.info/>" outputs to mix.exs. I don't think that "mix
>> deps.add package" would speed up my development time too much. The drawback
>> of having to give up code as configuration like we have today in mix.exs is
>> not worth that saved time IMO. Hopefully that makes things a little more
>> clear.
>>
>> Cheers,
>>
>> Andrea Leopardi
>> [email protected] <>
>>
>> On Fri, May 10, 2019 at 11:19 PM 'boris kotov' via elixir-lang-core
>> <[email protected] <>> wrote:
>> Hi Andrea,
>>
>> this is not meant to be a core-related feature-request. Instead, it should
>> go into hex.
>>
>>
>>
>> Do you have some personal opinions on that feature, and do you feel that it
>> is uneccessary and that it is something that fullfills a very special need?
>> I don't think so, its basic stuff. Recently, I had to explain a friend, why
>> you don't have that feature in elixir, and that adding deps is just
>> unconvient compared to other environments.
>>
>>
>>
>> However you are right, it could be added even by a average programmer like
>> me. But this is actually a weak argument, to not discuss a feature, which
>> was already requested many times.
>>
>>
>> Am Freitag, 10. Mai 2019 22:44:58 UTC+2 schrieb Andrea Leopardi:
>> Hi Boris,
>>
>> as Pedro mentioned, this has been discussed before. Having a "data" file as
>> opposed to a "code" file for dependencies can already be done today: you can
>> define a file that contains dependencies as a list, and then read that file
>> in your mix.exs file. You can also build "mix deps.add" yourself on top of
>> this. For these reasons, we're likely not going to add this to Elixir
>> itself: we want to empower users and give them flexibility rather than
>> providing many solutions that try to cater to many different needs.
>>
>> Andrea Leopardi
>> [email protected] <>
>>
>> On Fri, May 10, 2019 at 8:46 PM 'boris kotov' via elixir-lang-core
>> <[email protected] <>> wrote:
>> Hi Pedro,
>>
>> > I don't think evaluation an exs to get a list will make a `mix.deps.add`
>> > reliable once we could put any elixir code on that file as well.
>>
>> Well, as long as the file only consists only a list, there is no problem
>> with it. You can even have code inside the list, like
>>
>> [
>> {:my_dep, System.get_env("DEP_VER")}
>> ]
>>
>> But it should't have anything other then a list, for example this should't
>> work:
>>
>> # deps.exs
>> f = fn -> System.get_env("DEP_VER")
>> [{:my_dep, f.() }]
>>
>> And you can check that really simple, and print something..
>>
>> Am Freitag, 10. Mai 2019 16:02:51 UTC+2 schrieb Pedro Medeiros:
>> Hi boris 👋🏼
>>
>> there was an old discussion on the list about that
>>
>> https://groups.google.com/forum/#!searchin/elixir-lang-core/mix$20add|sort:date/elixir-lang-core/ULBzKNCjYvY/XgwwrdepBgAJ
>>
>> <https://groups.google.com/forum/#!searchin/elixir-lang-core/mix$20add%7Csort:date/elixir-lang-core/ULBzKNCjYvY/XgwwrdepBgAJ>
>>
>> the main thing that came was "The dependency file for mix is an Elixir
>> program rather than just a simple JSON file. There's no way reliably and
>> safely programatically modify the mix.exs file as a result."
>>
>> I don't think evaluation an exs to get a list will make a `mix.deps.add`
>> reliable once we could put any elixir code on that file as well.
>>
>> Le ven. 10 mai 2019, à 06 h 09, 'boris kotov' via elixir-lang-core
>> <[email protected] <>> a écrit :
>> Right now, its a bit annoying to lookup the version on hex, and then
>> manually adding it to the deps function.
>>
>> There was a discussion back in 2017 on this.
>> https://elixirforum.com/t/mix-deps-add-functionality/4856/7
>> <https://elixirforum.com/t/mix-deps-add-functionality/4856/7>
>> The main problem people have thought about was manipulation of mix.exs, and
>> true, we don't want that.
>>
>> Instead we can use a simple exs file for this, which should be evaluatable
>> to a list. So its a no-brainer to add items to it. For example `mix deps.add
>> jason`.
>>
>> defp deps, do: Code.eval_file("deps.exs")
>>
>> I am posting it here, to get some feedback on that feature, but I think the
>> integration could go into hex only and if its adopted, adding the `deps.exs`
>> file to the `mix new`-templates so please, share you opinions on it.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "elixir-lang-core" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elixir-lang-core/48f096ab-c6dd-494c-8907-ca16e1b785fe%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/elixir-lang-core/48f096ab-c6dd-494c-8907-ca16e1b785fe%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout
>> <https://groups.google.com/d/optout>.
>>
>>
>> --
>> Pedro Henrique de Souza Medeiros
>> ----------------------------------
>> Cel: +1 (514) 641-5031
>> Email: [email protected] <>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "elixir-lang-core" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elixir-lang-core/faf1c54d-8974-4643-a5d2-301776a479ef%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/elixir-lang-core/faf1c54d-8974-4643-a5d2-301776a479ef%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout
>> <https://groups.google.com/d/optout>.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "elixir-lang-core" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elixir-lang-core/3ce4a853-948f-48a7-a186-9a23a7ae1324%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/elixir-lang-core/3ce4a853-948f-48a7-a186-9a23a7ae1324%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout
>> <https://groups.google.com/d/optout>.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "elixir-lang-core" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected]
>> <mailto:[email protected]>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elixir-lang-core/5d94715c-33b4-4d23-8f95-34a6096f868b%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/elixir-lang-core/5d94715c-33b4-4d23-8f95-34a6096f868b%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout
>> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/0100016aa75b0a2a-09a6afec-1775-470d-8b94-6c84bf51ec98-000000%40email.amazonses.com
>
> <https://groups.google.com/d/msgid/elixir-lang-core/0100016aa75b0a2a-09a6afec-1775-470d-8b94-6c84bf51ec98-000000%40email.amazonses.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/7F3F7130-29CA-4F37-96FC-A1CBDFC5D1A0%40wojtekmach.pl.
For more options, visit https://groups.google.com/d/optout.