<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="214887" data-post-id="214887">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="marcandre" data-post="11" data-topic="39911">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/marcandre/48/31790_2.png" class="avatar"> marcandre:</div>
<blockquote>
<p>Interesting. If that works, then even more reason to support explicitly what can already be supported implicitly.</p>
</blockquote>
</aside>
<p>It doesn’t work on dependency resolution. It just emits a warning (or raise) if you don’t have a matching version. If this behaviour is enough for you, then you can check for the OTP release in your mix.exs.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="214887" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/specifying-minimal-erlang-version-in-mix-exs/39911/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-214887" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="214887"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="310232" data-post-id="310232">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jozuas" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jozuas/120/35355_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jozuas
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I wanted to add another example of this happening from today:</p>
<p>I have Elixir 1.15.7 with Erlang 25.3.2.7, I added <a href="https://github.com/erlef/oidcc" rel="noopener nofollow ugc">oidcc</a> 3.1.0 to <code>mix.exs</code> and found out in runtime that oidcc only supports OTP26 and beyond by running into <code>:base64.encode/2 is undefined or private</code>.</p>
<p><a href="https://github.com/erlef/oidcc/issues/296" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/erlef/oidcc/issues/296</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310232" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/specifying-minimal-erlang-version-in-mix-exs/39911/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-310232" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310232"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="310235" data-post-id="310235">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="maennchen" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/maennchen/120/32742_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  maennchen
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I believe having a standardized field &amp; warning for the required OTP version in the mix <code>project/0</code> would be beneficial.</p>
<p>It at least communicates the problem to the user and there is also a standardized place to manually look for the versions a library supports.</p>
<p>Also checking the requirement in the hex resolution would be awesome, but I don’t believe that this must be implemented for the rest to be useful.</p>
<p>(Happy to provide an Elixir PR for that <img src="https://forum.elixirforum.com/images/emoji/apple/blush.png?v=15" title=":blush:" class="emoji" alt=":blush:" loading="lazy" width="20" height="20">)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310235" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/specifying-minimal-erlang-version-in-mix-exs/39911/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-310235" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310235"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="310240" data-post-id="310240">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="wojtekmach" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/wojtekmach/120/999_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  wojtekmach
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Hex Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>There is a couple of problems:</p>
<ol>
<li>We have <code>System.otp_release() # =&gt; "26"</code> but not <code>System.otp_version() #=&gt; "26.1.2"</code> and the reason is the latter is not exposed by OTP. There are hacks to get this version out, you can see what <code>mix hex.info</code> does for example, but the first step would be to have OTP expose this.</li>
<li>Adding <code>:minimum_otp_release</code>/<code>:otp_version</code> to mix.exs that works like :elixir, i.e. does <em>not</em> participate in resolution, should be fairly straightforward. Adding it in a way that participates in resolution is a rather big undertaking.</li>
</ol>
<p>mix.exs is executable so something everyone can do today is:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">if System.otp_release &lt; "26" do
  IO.puts "this package requires OTP 26. Install foo v0.2.0 that works with prior OTP versions"
  raise "incorrect OTP"
end

defmodule Foo.MixProject do
</code></pre>
<p>and the benefit is the error message can be as succinct or as verbose as you want it to be. In that sense it’s better than when provided by the build tool because you have full control what extra information to include.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310240" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/specifying-minimal-erlang-version-in-mix-exs/39911/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-310240" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310240"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="310247" data-post-id="310247">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="maennchen" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/maennchen/120/32742_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  maennchen
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-Hex-Core-Team" data-username="wojtekmach" data-post="15" data-topic="39911">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/wojtekmach/48/999_2.png" class="avatar"> wojtekmach:</div>
<blockquote>
<p>We have <code>System.otp_release() # =&gt; "26"</code> but not <code>System.otp_version() #=&gt; "26.1.2"</code> and the reason is the latter is not exposed by OTP.</p>
</blockquote>
</aside>
<p>While this feels hacky, this is the officially proposed way to read the version:</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://www.erlang.org/doc/system/versions.html">
  <header class="source">

      <a href="https://www.erlang.org/doc/system/versions.html" target="_blank" rel="noopener nofollow">erlang.org</a>
  </header>

  <article class="onebox-body">
    

<h3><a href="https://www.erlang.org/doc/system/versions.html" target="_blank" rel="noopener nofollow">Versions — Erlang System Documentation v29.0.2</a></h3>



  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>Rebar3 also does it this way and this therefore seems to be the accepted way to do so:<br>
<a href="https://github.com/erlang/rebar3/blob/7a27a26c11470617898b9a3c80451d1cea1c4361/apps/rebar/src/rebar_utils.erl#L415" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/erlang/rebar3/blob/7a27a26c11470617898b9a3c80451d1cea1c4361/apps/rebar/src/rebar_utils.erl#L415</a></p>
<p>This should allow us to create <code>System.otp_version/0</code> if we desire to have that function.</p>
<aside class="quote group-Hex-Core-Team" data-username="wojtekmach" data-post="15" data-topic="39911">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/wojtekmach/48/999_2.png" class="avatar"> wojtekmach:</div>
<blockquote>
<p>mix.exs is executable</p>
</blockquote>
</aside>
<p>I’m aware that this is possible, but this seems like a hack to me. If everybody does it like this, there’s no standardized approach which means that we won’t be able to handle those errors in a uniform way. (e.g. Editor Language Servers, statistical analysis of libraries &amp; their requirements on Hex etc.)</p>
<p>Implementing only the first part (without resolution) seems to be an easy implementation and I think it would be beneficial. Exposing <code>System.otp_version/0</code> would also be great since that is something I had to work around before.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310247" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/specifying-minimal-erlang-version-in-mix-exs/39911/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-310247" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310247"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>