8 comments

  • ananthakumaran3 hours ago
    We have a similar use case. All Elixir code base, but need to use Python for ML libraries. We decided to use IPC. Elixir will spawn a process and communicate over stdio. <a href="https:&#x2F;&#x2F;github.com&#x2F;akash-akya&#x2F;ex_cmd" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;akash-akya&#x2F;ex_cmd</a> makes it a breeze to stream stdin and stdout. This also has the added benefit of keeping the Python side completely stateless and keeping all the domain logic on the Elixir side. Spawning a process might be slower compared to enqueuing a job, but in our case the job usually takes long enough to make it irrelevant.
    • Kaliboy5 minutes ago
      Honestly you saved yourself major possible headaches down the line with this approach.<p>At my work we run a fairly large webshop and have a ridiculous number of jobs running at all times. At this point most are running in Sidekiq, but a sizeable portion remain in Resque simply because it does just that, start a process.<p>Resque workers start by creating a fork, and that becomes the actual worker.<p>So when you allocate half your available RAM for the job, its all discarded and returned to the OS, which is FANTASTIC.<p>Sidekiq, and most job queues uses threads which is great, but all RAM allocated to the process stays allocated, and generally unused. Especially if you&#x27;re using malloc it&#x27;s especially bad. We used jemalloc for a while which helped since it allocates memory better for multithreaded applications, but easiest is to just create a process.<p>I don&#x27;t know how memory intensive ML is, what generally screwed us over was image processing (ImageMagick and its many memory leaks) and... large CSV files. Yeah come to think of it, you made an excellent architectural choice.
    • barrell1 hour ago
      Similar use case as well. I use erl ports to spawn a python process as well. Error handling is a mess, but using python as a short scripting language and elixir for all the database&#x2F;application&#x2F;architecture has been very ideal
    • dnautics2 hours ago
      I have one vibecoded ml pipeline now and I&#x27;m strongly considering just clauding it into Nx so I can ditch the python
      • flippant2 hours ago
        I did exactly this in early 2025 with a small keyword tagging pipeline.<p>You may run into some issues with Docker and native deps once you get to production. Don’t forget to cache the bumblebee files.
    • markstos2 hours ago
      Is this part of a web server or some other system where you could end up spawning N python processes instead of 1 at a time?
      • ananthakumaran6 minutes ago
        No, it&#x27;s a background job. We can easily control the Python process count by controlling the job queue concurrency on the Elixir side.
      • rozap1 hour ago
        I use a similar strategy for python calls from elixir. This is in a web server, usually they&#x27;re part of a process pool. So we start up N workers and they hang out and answer requests when needed. I just have an rpc abstraction that handles all the fiddly bits. The two sides pass erlang terms back and forth. Pretty simple.
  • rekoros1 hour ago
    Oban is great!
  • cpursley5 hours ago
    Very nice, Oban is great. I effectually found a similar approach with pgflow.dev (built around pgmq) - but the stateless deno &quot;workers&quot; are pretty unreliable and built an elixir worker (<a href="https:&#x2F;&#x2F;github.com&#x2F;agoodway&#x2F;pgflow" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;agoodway&#x2F;pgflow</a>) that can pick up and process jobs that were created by pgflow&#x27;s supabase&#x2F;typescript client. So maybe there&#x27;s an opportunity also with Oban to have a TypeScript&#x2F;Node client that can insert jobs that Elixir&#x2F;Python Oban can pick up. Also, I wonder if another approach vs the python workers picking things up is to have elixir workers call&#x2F;run python&#x2F;lua, etc code or is that too limiting?
    • elitepleb5 hours ago
      that&#x27;s easy with <a href="https:&#x2F;&#x2F;hexdocs.pm&#x2F;pythonx&#x2F;Pythonx.html" rel="nofollow">https:&#x2F;&#x2F;hexdocs.pm&#x2F;pythonx&#x2F;Pythonx.html</a> and <a href="https:&#x2F;&#x2F;hexdocs.pm&#x2F;lua&#x2F;Lua.html" rel="nofollow">https:&#x2F;&#x2F;hexdocs.pm&#x2F;lua&#x2F;Lua.html</a> and works well too
    • cpursley5 hours ago
      btw, a lot of postgres envs are not going to have pgmq, so just use Oban and don&#x27;t reinvent the wheel like I did ;)
  • nimbus-hn-test3 hours ago
    [dead]
  • mrcwinn3 hours ago
    I absolutely love Elixir, but if this is the bridge you need to cross, just write it in Python in the first place.
    • dnautics2 hours ago
      It&#x27;s 2026 and the LLMs score high on elixir, just write it in python and patch it over to elixir gradually
      • Towaway692 hours ago
        Or patch it over to python, I assume LLMs are even better at python.
        • dnautics2 hours ago
          Don&#x27;t assume. Empirically, they are not. (This post Feb 2026 may change in future yadda yadda)<p>See: autocodebench<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Tencent-Hunyuan&#x2F;AutoCodeBenchmark&#x2F;tree&#x2F;main" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Tencent-Hunyuan&#x2F;AutoCodeBenchmark&#x2F;tree&#x2F;ma...</a>
          • Towaway692 hours ago
            Reading that made me think how much that might be related to Elixir being very similar in syntax to Ruby. Do LLMs really differentiate between the two?<p>Specific studies, as the one quoted, are a long way from original real world problems.
            • ricketycricket2 hours ago
              Here are some thoughts on it from José Valim: <a href="https:&#x2F;&#x2F;dashbit.co&#x2F;blog&#x2F;why-elixir-best-language-for-ai" rel="nofollow">https:&#x2F;&#x2F;dashbit.co&#x2F;blog&#x2F;why-elixir-best-language-for-ai</a><p>LLMs absolutely understand and write good Elixir. I&#x27;ve done complex OTP and distributed work in tandem with Sonnet&#x2F;Opus and they understand it well and happily keep up. All the Elixir constructs distinct from ruby are well applied: pipes, multiple function clauses, pattern matching, etc.<p>I can say that anecdotally, CC&#x2F;Codex are significantly more accurate and faster working with our 250K lines of Elixir than our 25K lines of JS (though not typescript).
              • d4mi3n1 hour ago
                I suspect this is partly due to the quality of documentation for Elixir, Erlang, and BEAM. The OTP documentation has been around for a long time and has been excellently written. Erlang&#x2F;Elixer doc gen outputs function signatures, arity, and both Elixir and Erlang handle concepts like function overloading in very explicit, well-defined ways.
                • bnchrch11 minutes ago
                  Thats a large reason for sure!<p>I&#x27;d layer in a few more<p>* Largely stable and unchanged language through out its whole existance<p>* Authorship is largely senior engineers so the code you train on is high quality<p>* Relatively low number of abstractions in comparisson to other languages. Meaning there&#x27;s less ways to do one thing.<p>* Functional Programming style pushes down hidden state, which lowers the complexity when understanding how a slice of a system works, and the likelyhood you introduce a bug
            • dnautics1 hour ago
              Here are my thoughts:<p><a href="https:&#x2F;&#x2F;m.youtube.com&#x2F;watch?v=YZa5GqrZeao" rel="nofollow">https:&#x2F;&#x2F;m.youtube.com&#x2F;watch?v=YZa5GqrZeao</a>
            • OkayPhysicist1 hour ago
              I suspect the biggest advantage Elixir has is the relative quality of the publicly available code. Approximately no one has Elixir as their first programming language, which keeps a lot of the absolute trash-tier code that we all make when first learning to program out of the training set. If you look at languages that are often people&#x27;s first (Python, JavaScript, Java), only Java has an above average score. Of those three, Java&#x27;s significantly more likely to be taught in a structured learning environment, compared to kids winging it with the other two.<p>(And Elixir&#x27;s relationship to Ruby is pretty overstated, IMO. There&#x27;s definitely inspiration, but the OO-FP jump is a makes the differences pretty extreme)
              • Towaway691 hour ago
                Agree with the quality level but there are other languages where that is also the case: Erlang for example is probably one of those languages.<p>&gt; Elixir&#x27;s relationship to Ruby is pretty overstated<p>Perhaps I am actually am over thinking this. Elixir has probably diverged enough from Ruby (e.g. defmodule, pipe operators, :atom syntax) for LLMs to notice the difference between the two. But it does open the question, though, how does an LLM actually recognise the difference in code blocks in its training data.<p>There are probably many more programming languages where similarities exist.
            • ch4s32 hours ago
              Having written a lot of both languages, I&#x27;d be surprised if LLMs don&#x27;t get tripped up on some of Ruby&#x27;s semantics and weird stuff people do with monkey patching. I also find Ruby library documentation to be on average pretty poor.
              • Towaway691 hour ago
                &gt; I also find Ruby library documentation to be on average pretty poor.<p>That surprises me :)<p>From my time doing Ruby (admittedly a few years back), I found libraries were very well documented and tested. But put into context of then (not now), documentation and testing weren&#x27;t that popular amongst other programming languages. Ruby was definitely one of the drivers for the general adaption of TDD principles, for example.
                • ch4s342 minutes ago
                  I think they&#x27;re often very well tested, but the documentation piece has always been lacking compared to Elixir.<p>I used to frequently find myself reading the source code of popular libraries or prying into them at runtime. There&#x27;s also no central place or format for documentation in ruby. Yes rubydoc.info exists, but it&#x27;s sort of an afterthought. Sidekiq uses a github wiki, Nokogiri has a dedicated site, Rails has a dedicated site, Ruby itself has yet another site. Some use RDoc, some don&#x27;t. Or look at Devise <a href="https:&#x2F;&#x2F;rubydoc.info&#x2F;github&#x2F;heartcombo&#x2F;devise&#x2F;main&#x2F;frames" rel="nofollow">https:&#x2F;&#x2F;rubydoc.info&#x2F;github&#x2F;heartcombo&#x2F;devise&#x2F;main&#x2F;frames</a>, there&#x27;s simply nothing documented for most of the classes, and good luck finding in the docs where `before_action :authenticate_user!` comes from.
  • jongjong3 hours ago
    I don&#x27;t see the point of Elixir now. LLMs work better with mainstream languages which make up a bigger portion of their training set.<p>I don&#x27;t see the point of TypeScript either, I can make the LLM output JavaScript and the tokens saved not having to add types can be used to write additional tests...<p>The aesthetics or safety features of the languages no longer matter IMO. Succinctness, functionality and popularity of the language are now much more important factors.
    • HorizonXP3 hours ago
      So I know these are just benchmarks, but apparently Elixir is one of the best languages to use with AI, despite having a smaller training dataset: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=iV1EcfZSdCM" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=iV1EcfZSdCM</a> and <a href="https:&#x2F;&#x2F;github.com&#x2F;Tencent-Hunyuan&#x2F;AutoCodeBenchmark&#x2F;tree&#x2F;main" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Tencent-Hunyuan&#x2F;AutoCodeBenchmark&#x2F;tree&#x2F;ma...</a><p>Furthermore, it&#x27;s actually kind of annoying that the LLMs are <i>not</i> better than us, and still benefit from having code properly typed, well-architected, and split into modules&#x2F;files. I was lamenting this fact the other day; the only reason we moved away from Assembly and BASIC, using GOTOs in a single huge file was because us humans needed the organization to help us maintain context. Turns out, because of how they&#x27;re trained, so do the LLMs.<p>So TypeScript types and tests actually do help a lot, simply because they&#x27;re deterministic guardrails that the LLM can use to check its work and be steered to producing code that actually works.
      • dnautics2 hours ago
        I don&#x27;t think LLMs benefit from having code properly typed (at the call definition). It&#x27;s costly to have to check a possibly remote file to check. The LLM should be able to intuit what the types are <i>at the callsite</i> and elixir has ~strong conventions that LLMs probably take advantage of
        • baseonmars2 hours ago
          llms benefit greatly from feedback and typing&#x2F;type errors are one of the fastest and easiest methods of feedback to give to an llm.
          • dnautics1 hour ago
            Think about fitts law: the fastest place to click under a cursor is the location of the cursor. For an LLM the least context-expensive feedback is no feedback at all.<p>I think codebases that are strongly typed sometimes have bad habits that &quot;you can get away with&quot; because of the typing and feedback loops, the LLM has learned this.<p><a href="https:&#x2F;&#x2F;x.com&#x2F;neogoose_btw&#x2F;status&#x2F;2023902379440304452?s=61" rel="nofollow">https:&#x2F;&#x2F;x.com&#x2F;neogoose_btw&#x2F;status&#x2F;2023902379440304452?s=61</a>
    • cloud84213 hours ago
      &gt; I don&#x27;t see the point of Elixir now. LLMs work better with mainstream languages which make up a bigger portion of their training set.<p>I can&#x27;t say if it works better with other languages, but I can definitely say both Opus and Codex work really well with Elixir. I work on a fairly large application and they consistently produce well structured working code, and are able to review existing code to find issues that are very easy to miss.<p>The LLM needs guidance around general patterns, e.g. &quot;Let&#x27;s use a state machine to implement this functionality&quot; but it writes code that uses language idioms, leverages immutability and concurrency, and generally speaking it&#x27;s much better than any first pass that I would manually do.<p>I have my ethical concerns, but it would be foolish of me to state that it works poorly - if anything it makes me question my own abilities and focus in comparison (which is a whole different topic).
    • jakejohnson3 hours ago
      LLMs work great with Elixir. Running tsc in a loop while generating code still catches type errors introduced by an LLM and it’s faster than generating additional tests. Elixir is also succinct and highly functional. If you can’t find a specific library it’s easier than ever to build out the barebones functionality you need yourself or use NIFs, ports, etc.<p><a href="https:&#x2F;&#x2F;dashbit.co&#x2F;blog&#x2F;why-elixir-best-language-for-ai" rel="nofollow">https:&#x2F;&#x2F;dashbit.co&#x2F;blog&#x2F;why-elixir-best-language-for-ai</a>
    • dnautics2 hours ago
      &gt; Succinctness, functionality and popularity of the language are now much more important factors.<p>No. I would argue that popularity <i>per se</i> is irrelevant: if there are a billion examples of crap code, the LLMs learn crap code. conversely know only 250 documents can poison an LLM independent if model size. [Cite anthropic paper here].<p>The most important thing is <i>conserve context</i>. Succinctness is not really what you want because most context is burned on thinking and tool calls (I think) and not codegen.<p>Here is what I think is not important: strong typing, it requires a tool call anyways to fetch the type.<p>Here is what I think is important:<p>- fewer footguns - great testing (and great testing examples) - strong language conventions (local indicators for types, argument order conventions, etc) - no weird shit like __init__.py that could do literally anything invisible to the standard code flow
    • techpression2 hours ago
      Your code doesn’t run anywhere? Running on the BEAM is extremely helpful for a lot of things. Also, I review my LLM output, I want that experience to be enjoyable.
    • WolfeReader2 hours ago
      I&#x27;m starting to see a new genre of post here in the AI bubble, where people go to topics that aren&#x27;t about AI at all, and comment something like, &quot;this doesn&#x27;t matter because it&#x27;s not AI&quot;. This is the third I&#x27;ve seen in a week.
  • languagehacker4 hours ago
    I feel like if you need to utilize a tool like this, odds are pretty good you may have picked the Wrong Tool For the Job, or, perhaps even worse, the wrong architecture.<p>This is why it&#x27;s so important to do lots of engineering <i>before</i> writing the first line of code on a project. It helps keep you from choosing a tool set or architecture out of preference and keeps you honest about the capabilities you need and how your system should be organized.
    • Arubis3 hours ago
      It’s almost as though choosing a single-threaded, GIL-encumbered interpreted scripting language as the primary interface to an ecosystem of extremely parallelized and concurrent high-performance hardware-dependent operations wasn’t quite the right move for our industry.
      • markstos2 hours ago
        Ha. The question now is whether the ML industry will change directions or if the momentum of Python is a runaway train.<p>I can&#x27;t guess. Perl was once the &quot;800-pound gorilla&quot; of web development, but that chapter has long been closed. Python on the other hand has only gained traction since that time.
    • markstos2 hours ago
      Sometimes the &quot;right tool for the job&quot; philosophy leads to breaking down a larger problem into two small problems, each which has a different &quot;right tool&quot;.<p>Choosing a single tool that tries to solve every single problem can lead to its own problems.
    • victorbjorklund3 hours ago
      Strange opinion. Plenty of apps have more than one language. I might end up using this.<p>Why? Because my app is built in Elixir and right now I’m also using a python app that is open source but I really just need a small part of the python app. I don’t wanna rewrite everything in Elixir because while it’s small I expect it to change over time (basically fetching a lot of data sources) and it will be pain to keep rewriting it when data collections needs to change (over a 100 different sources). Right now I run the python app as an api but it’s just so overkill and harder to manage vs just handling everything except the actually data collection in Elixir where I am already using Oban.
    • geooff_3 hours ago
      I disagree, using python for a web-server and something like celery for background work is a pretty common pattern.<p>My reading of this is it more or less allows you to use Postgres (which you&#x27;re likely already using as your DB) for the task orchestration backend. And it comes with a cool UI.
      • languagehacker3 hours ago
        That&#x27;s not the sort of architecture I&#x27;m referring to. I&#x27;m specifically talking about splitting your application layer between Elixir and Python.
    • whalesalad4 hours ago
      What leads you to this conclusion