marcandre
Specifying minimal Erlang version in mix.exs
Is it still not possible to specify Erlang compatibility in mix.exs?
Erlang/OTP is a dependency of Elixir, so it is an indirect dependency of any mix projects, but it may be a direct dependency too. mix.exs should be able to convey that and mix should be able to resolve dependencies handling this too.
As a practical example, :crypto.hmac/3 no longer exists in OTP 24, one must use :crypto.mac/4 which is OTP 22+
If a package maintainer wants to use :crypto.mac/4, the only easy choice is to require the shiny new Elixir 1.12, because Elixir 1.11 is compatible with OTP 21
Ideally one could say: compatible with Elixir >= 1.7 but OTP >= 22.
Trending in Questions
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated!
To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead.
Sta...
New
Hello !
We want new/edit form pages to POST/PUT to their own URL rather than the resources REST defaults (post /things, put /things/:id)...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
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
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
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
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #performance
- #security










First 10 of 15 Posts
eksperimental
Interesting request. Totally doable.
https://github.com/eksperimental/otp_dependency/commit/689e3e309118cc79a3cc162ff4a023764d54a952
It will not compile if it does not meet the :otp dependency requirement.
josevalim
Correct, it is still not supported because we want to avoid adding multiple dimensions for system dependencies. So in this sense it would be preferable to either supporting v1.7 and all OTP versions by checking which crypto function is available (that’s what we did in plug_crypto) or bumping to v1.12.
However, if occurrences like this keep happening, then we should probably be more pragmatic and allow the OTP dependency.
hauleth
You can always have runtime/compile time check that will pick the best available option.
dimitarvp
Smells like a
compatlibrary that I wanted to write for at least a year.marcandre
Thanks for the link to this workaround. I’d say that if we get to a failed compilation, we still lost though.
The goal is that
mix deps.getresolves to the correct version of package, not that it resolves to the wrong version, that compilation fails, and that the user must figure out why, then figure out manually what version is actually compatible, hardcode the version requirement and then reinstall.marcandre
Thanks for the response, although I do not see how erlang is in a different dimension, from the point of view of a package manifest.
I will check what was done for
plug_cryptoeksperimental
My solution does not deal with package dependencies. It only checks --as the title of your post says-- that the installed OTP version meets the requirements, in the exact same way it checks for the Elixir version required.
If your requirement is Elixir v1.12, but you are running Elixir v1.11, the compilation will fail, and I wouldn’t see it as a loss, it is a gain because your app is not designed to run under a lower version of Elixir.
How would you propose your solution to work? To have conditional dependencies based on the available OTP version?
derek-zhou
I guess you can make a dummy erlang package with rebar.config that have:
then add this package as one mix dependency?
marcandre
My solution is that hex packages could declare which OTP version they are compatible with and that
mix deps.gettakes that into account to figure out which versions to get.If package
Examplehas version 1.0 compatible with Elixir >= 1.4 but uses:crypto.hmac/3, they could make incompatible changes to the code to use the new:crypto.mac/4and release 1.0.2 compatible with Elixir >= 1.7 and OTP >= 22.mix deps.getcan use that information to retrieve the correct package depending on the version of Elixir and OTP that is in use, and insure that there is no incompatiblity / compilation error.The only other acceptable alternative in my book requires more work on the part of the maintainer to release a package that maintains compatibility with all versions of OTP.
I lack the experience to know how much of a burden that is, but that solution has the advantage of expressing the situation as it actually is, as well as giving more options to maintainers to minimize their burden. Not allowing that is fighting reality.
(edited to remove a step that didn’t add anything)
marcandre
Interesting. If that works, then even more reason to support explicitly what can already be supported implicitly.