{"repo":"red-data-tools/pycall.rb","free":true,"listed":false,"github":"https://github.com/red-data-tools/pycall.rb","clone":"git clone https://github.com/red-data-tools/pycall.rb.git","description":"Calling Python functions from the Ruby language","language":"C","stars":1116,"topics":["ruby","pycall","data-science","python","rubydatascience","rubyml"],"license":"MIT","category":"dev-tools","readme_excerpt":"PyCall: Calling Python functions from the Ruby language This library provides the features to directly call and partially interoperate with Python from the Ruby language. You can import arbitrary Python modules into Ruby modules, call Python functions with automatic type conversion from Ruby to Python. Supported Ruby versions pycall.rb supports Ruby version 2.4 or higher. Supported Python versions pycall.rb supports Python version 3.7 or higher. PyCall does not support multi-threaded use officially CPython's C-API has GIL acquiring/releasing functions such as PyGILState Ensure and PyGILState Release . Programmers can call CPython's C-APIs from outside of Python threads if they manage GIL's state by these functions. However, we do not want to officially support the multi-threaded use of PyCall because creating the feature enabling stable multi-threaded use in any situation is too difficult. We want to avoid incurring the costs to support such use cases. Note for pyenv users pycall.rb requires Python's shared library (e.g. libpython3.7m.so ). pyenv does not build the shared library in default, so you need to specify --enable-shared option at the installation like below: Installation Add this line to your application's Gemfile: And then execute: $ bundle Or install it yourself as: $ gem install --pre pycall Usage Here is a simple example to call Python's math.sin function and compare it to the Math.sin in Ruby: require 'pycall' math = PyCall.import module(\"math\") math.sin(math.p","default_branch":null,"files":null,"tree":[],"storefront":"/r/red-data-tools","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/red-data-tools/pycall.rb/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}