mike_bianco
Hello!
New to Elixir & Phoenix. Really incredible work here—thanks for all of the amazing efforts to make an amazing language!
I’m coming from the Ruby & Rails community. Right now, I’m working on upgrading the geoip package to support a more recent version of poison to eliminate a dependency conflict.
In ruby-land, many times you’ll check the version of dependency and modify the package logic to avoid forcing users to upgrade another package to use the latest version of a different package. For example:
if SomeGemName::VERSION > 3.0
do_it_this_way
else
do_it_that_way
end
Here’s the questions I can’t seem to find an answer to:
- I haven’t seen this pattern in the (limited) elixir code I’ve read—is this something that isn’t done in the Elixir community? What’s the best practice here?
- I can’t figure out how to inspect a package version at runtime.
Poison.Mixfile.project[:version]doesn’t seem to be available during runtime and I can’t find any other interfaces to inspect a package version.
Really appreciate everyone’s help here!
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
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
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
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
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #elixirconf-us
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
danschultzer
I prefer to either force developers to update their dependencies, or find alternative ways to make the code work independently of the dependency.
In the case of poison requirement, I would guess a better solution would be to just relax requirement in
mix.exs, or make it so geoip doesn’t care whether poison is there, and instead you can switch out the json decoder the same way as in Phoenix and e.g. use jason instead.If I got no other options, then I would do the following (this is from Pow):
I can then check the dependency version requirement like this:
I use the above only in mix tasks or at compile time, since the dependency version is fixed at compile. I wouldn’t do this at runtime.
mike_bianco
Really appreciate the reply! For some reason, it looks like this data isn’t available when running tests in the
geoipgem:However, the Poison module is properly loaded and seems to have a
vsnattribute:Any ideas why this could be the case?
Also, do you know if there’s a way to define an exact version for the local package build for testing purposes but keep the version definition in the
mix.exsloose?For instance, I want:
In
depsbut use version~> 4.0for the tests in the package.Thanks again!
danschultzer
You can just set it up like that, and run
mix deps.update poison. It’ll fetch the most recent 4.x version.If you need to test different versions in CI, then I would add a second
mix.lockfile, and do it similar to how Phoenix does it: phoenix/mix.exs at f3fe0188aaa53bfa10d7750cffe5008d211756bf · phoenixframework/phoenix · GitHubThat error would mean that Poison isn’t loaded before you run
:application.get_key/2in the current process. Have you checked that it’s loaded just before calling:application.get_key/2?mike_bianco
@danschultzer thanks for the detailed help here, really appreciate it!
For anyone who runs into the unloaded package issue in the future: the reason why
:poisonwasn’t loaded is because it wasn’t included in the package’s mix.exsapplicationlist. The solution was to removeapplicationaltogether and replace it withextra_applications.