Socket
Book a DemoInstallSign in
Socket

pycall_thread

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pycall_thread

0.1.3
bundlerRubygems
Version published
Maintainers
1
Created
Source

PyCallThread

PyCallThread provides PyCallThread.run(&block), which lets you safely run a block of pycall.rb code: even if you're in a thread.

This makes PyCall easier to use from Ruby on Rails, Puma and other threaded web servers.

Usage

require 'pycall_thread'

# Initialization is optional but gives you a few config settings
PyCallThread.init do
  # If you need to do anything to setup you venv, you can do it here
  require 'pycall'
end

# We can safely call PyCall, even from a thread (or web request) using `PyCallThread.run`:
Thread.new do
  data_table = PyCallThread.run do
    pandas = PyCall.import('pandas')
    data = pandas.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-red.csv', sep: ';')
    data.head().to_string()
  end
  puts "Data is:"
  puts data_table
end

Examples of using PyCall with webservers:

  • Puma
  • Ruby on Rails: todo

Installation

Gemfile:

gem 'pycall_thread'

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

TODO: make run rake test run the tests

FAQs

Package last updated on 08 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.