nallwhy
Doumi.Port - A helper library that facilitates the usage of Python in Elixir
Doumi.Port is a helper library that facilitates the usage of Python in Elixir powered by Erlport, NimblePool.
It’s inspired by Export, but not just a wrapper of Erlport, will be a toolchain for using Python, Ruby in Elixir.
defmodule MyApp.Application do
...
@impl true
def start(_type, _args) do
children = [
...
{Doumi.Port.Pool, port: {Doumi.Port.Python, python_path: [...]}, name: MyApp.PythonPool}
]
Supervisor.start_link(children, strategy: :one_for_one, name: MyApp.Supervisor)
end
end
defmodule MyApp.Native do
def add(a, b) do
Doumi.Port.Pool.command(MyApp.PythonPool, :operator, :add, [a, b])
end
end
> MyApp.Native.add(1, 2)
3
Thanks!
Most Liked
nallwhy
v0.4.0 is released!
- It supports Ruby also.
-
mix doumi.port.init,mix doumi.port.setupis added.
# Create requirements.txt, .gitignores to ./priv/python
mix doumi.port.init --port python
# Add Python dependency
echo "pypdf2==3.0.1" >> ./priv/python/requirements.txt
# Install Python dependecies
mix doumi.port.setup --port python
You can install Python dependencies to your release with mix doumi.port.setup.
defmodule MyApp.MixProject do
defp aliases do
[
...,
"release.setup": ["doumi.port.setup --port python", ...]
]
end
end
...
# release setup (ex. install Python dependencies, compile assets)
RUN mix release.setup
...
4
nallwhy
v0.2.0 is released!
use macro is added to make it easier.
defmodule MyApp.PythonPool do
use Doumi.Port.Pool,
port: {Doumi.Port.Python, python_path: [...]}
end
defmodule MyApp.Application do
...
@impl true
def start(_type, _args) do
children = [
...
MyApp.PythonPool
]
Supervisor.start_link(children, strategy: :one_for_one, name: MyApp.Supervisor)
end
end
defmodule MyApp.Native do
def add(a, b) do
MyApp.PythonPool.command(:operator, :add, [a, b])
end
end
2
ivanhercaz
I will test it as soon as possible! ![]()
![]()
I recommend you to link to the Doumi.Port repository and the Hex package in the post. It will be easier for the people to check them
.
1
nallwhy
Oh, I forgot it. Thanks!!
1
kokolegorille
Nice, I might use it soon too…
I use poolboy with erlport, but I see You use nimble_pool instead ![]()
1
Popular in Libraries
Been making an MLElixir thing (not released yet…) for fun in spare time in the past day. I’m just trying to see how much I can get an ML...
New
Could not wait for the missing Elixir ML libraries to appear, so, I wrote one myself, taking https://github.com/sdwolfz/exlearn as a foun...
New
Hey everyone
i’ve developed a library for Jalaali calendar for elixir which supports converting Gregorian dates to Jalaali and vice vers...
New
Hey everyone!
Well, we made this lib a while ago and now we decided to finally go out and public with it! It’s a tool for creating and m...
New
Presenting Aviacommerce, open source e-commerce platform in Elixir
Aviacommerce is an open source e-commerce platform in Elixir. We at...
New
LiveMotion enables high performance animations declared on the server and run on the client.
As a follow up to my previous thread A libr...
New
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
Yes, yet another parser combinator library!
Most of the parser combinators in the ecosystem are either compile-time, often using AST tra...
New
Hi, I wanted share a small library we at Revelry Labs made for rendering react components from the server side. There are instructions fo...
New
Prometheus metrics and Grafana dashboards for all of your favorite Elixir libraries
I have been put...
New
Other popular topics
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set?
Thanks.
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
Hi guys, i’m new in the Elixir world, and i have to say, that i love it!
i’m having some problem to understand anonymous functions with ...
New
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum.
...
New
I have a super simple question about elixir - how would I take a file like this
foo bar baz
and output a new file that enumerates th...
New
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including.
What is Phoenix LiveV...
New







