RustySnek
Venomous aims to simplify the concurrent use of erlport Python Ports, focusing on dynamic extensibility such as spawning, reusing, and terminating processes on demand. It also handles unused processes, by killing them once they pass their configured inactive TTL. Venomous core functions ensure that whenever
:EXIT signal appears, the Python process dies without further execution by killing
its OS process (brutally).
This is my first attempt at creating an Elixir library. The idea stemmed from the challenge of properly exiting Python processes. Even after closing the Python port, execution would persist until the end of a function or iteration. My goal is to handle these exits effectively while also enabling process reuse, thus avoiding the constant spawning and stopping of new ones.
Any feedback would be greatly appreciated ![]()
Trending in Announcing
Other Trending Topics
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
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
RustySnek
I’ve released 0.3.0 version of Venomous
SnakeWorkerwill now stack instead of timing outChangelog: Release v0.3.0 · RustySnek/Venomous · GitHub
kip
Congrats on your first Elixir library. I like the delicious irony too that pythons aren’t venomous
RustySnek
They must have drank some kind of toxic MIXture
jackalcooper
thanks so much! I am using NimblePool to wrap python process running models. Your implementation to manage python process is way more sophisticated than mine so I guess I’m going to use it
xsteve
Thanks for providing that library.
However, I am unsure how to use it.
The documentation shows how to call a single python function.
Would you please explain how the python interpreter is started. How do I import some python modules and declare the function I want to call?
RustySnek
Hey so basically as of now, all of the python modules (files) are loaded from PYTHONPATH env variable. So if you put your python modules inside python/ directory you would have to add that directory to PYTHONPATH envvar.
There is also a config for Venomous python processes to load the type encoder/decoder of erlport. I made a quick guide to this here: Quick guide on erlport Python API — Venomous v1.0.0
As for calling mutiple python instances you have to do it yourself for example.
Here Venomous will spawn as many processes as its allowed to via
max_childrenconfiguration of SnakeSupervisor up to a 100. If it can’t spawn anymore it will just wait and reuse the already spawned ones once they are done with their tasks.Feel free to ask if you need any more help.
xsteve
Thanks for the explanation. I guess I understand it now.
Perhaps it would be nice to put the python code “time.sleep(0.1)” also somewhere into the documentation. And also add the needed usage of PYTHONPATH when there is a need to call an own python module (which will be the case most of the time)
RustySnek
Yeah I’ll probably extend documentation and add few examples in the next release
RustySnek
I’ve released 0.4.0 version of Venomous

Changelog: Release v0.4.0 · RustySnek/Venomous · GitHub
RustySnek
I’ve released 0.5.1 version of Venomous
which adds optional
Hot reloading for python modules.
To enable the hot reloading:
mix venomous.watchdog installNow all modules inside the configured
module_pathsshould reload on edit.