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
Lexical
Lexical is a next-generation language server for the Elixir programming language.
Features
Context aware code completion
As-you...
New
After just over two years in development, this latest version of Pigeon is what I finally consider done in regards to my original vision ...
New
Hello :wave:
Allow me to introduce you to Tz, an alternative time zone database support to Tzdata.
Why another library?
First and fore...
New
I’d like to announce a small library called boundaries.
This is an experimental project which explores the idea of enforcing boundaries ...
New
I’ve published the first version of my Makeup library. It’s a syntax highlighter for Elixir in the spirit of Pygments, Currently it highl...
New
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch.
This project took far...
New
Yes, yet another parser combinator library!
Most of the parser combinators in the ecosystem are either compile-time, often using AST tra...
New
import Meeseeks.CSS
html = HTTPoison.get!("https://news.ycombinator.com/").body
for story <- Meeseeks.all(html, css("tr.athing")) do...
New
Hey everyone!
Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
With HEEX released we decided to start a components library using Tailwind CSS - check it out here: Petal Components.
We also have a boi...
New
Other popular topics
Manning 2016 Halloween weekend sale via Deal of the Day
Friday, October 28 - Half off all MEAPs - code WM102816LT
Saturday, October 29 ...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine)
This is a plugin that adds support for Elixir to JetBrains IntelliJ...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
Hello, I have map which I want to convert it to string like this:
the map:
%{last_name: "tavakkoli", name: "shahryar"}
the string I ne...
New
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
New
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors:
[WARN] - (starship::utils): Executing command ...
New
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







