pycall_thread 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb8af01c4091f60fbf0e3255b487817e6779b18d4f3dc1c449f303cea75094d4
4
- data.tar.gz: a8099eecf60897ccc436d5662be887f4ed4641fa1fa655af374b0d322cb64406
3
+ metadata.gz: 5f06a9a4d8b09d14190d2001b9463bdd9101df77ced43e4cf898247718d69b1a
4
+ data.tar.gz: 0e0121315ee956037688ad7016621dc3f667c4ec99e05f7541a3a74b4ea61b2c
5
5
  SHA512:
6
- metadata.gz: 453798c6771820f009dfefb8ffde48039ca4924df3de24af4a6fffb0a07906cb253c4272006a31072b4e310dae0513a8ca60fd04760d2f8e93ac96480d9d80c5
7
- data.tar.gz: 708877b2fbdb55043ed13b84ecbd3ebe6b7c22b9b73b7f074a7435f3294e8762c626aef61695c912a79568672b016b1fa1e7679635db2233ee89b8bdebb45bb6
6
+ metadata.gz: 168d6a9aa3c30ece2692ee3bb92502dbabd766097c3e2a90849f3d7d61384806b1e658cb8008c34714a2617c83ca416c395da55c44d2da4d62318d30062385a8
7
+ data.tar.gz: fc32925321e4ea1812ecde6416ef6d90130bbc6254a72beaeb265710ed18fc6f44fd1ebc0bf9fcdf7b7eb8d01829ab126cb2f0676c72b86039dda5e0c4c39683
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pycall_thread (0.1.1)
4
+ pycall_thread (0.1.2)
5
5
  pycall
6
6
 
7
7
  GEM
@@ -1,4 +1,4 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'pycall_thread'
4
- gem 'puma'
3
+ gem "puma", "~> 6.4.2"
4
+ gem "pycall_thread", "~> 0.1.2"
data/examples/puma/app.rb CHANGED
@@ -1,25 +1,26 @@
1
- require 'pycall_thread'
1
+ require "pycall_thread"
2
2
 
3
3
  PyCallThread.init do
4
4
  # Setup our local venv (using pdm, in .venv)
5
- ENV['PYTHON'] = `pdm run which python`.strip
5
+ ENV["PYTHON"] = `pdm run which python`.strip
6
6
  site_dir = `pdm run python -c 'import site; print(site.getsitepackages()[0])'`.strip
7
7
 
8
- require 'pycall'
8
+ require "pycall"
9
9
 
10
10
  # This is to setup our local venv
11
- site = PyCall.import_module('site')
11
+ site = PyCall.import_module("site")
12
12
  site.addsitedir(site_dir)
13
13
  end
14
14
 
15
+ # Simple Puma App that demonstrates PyCallThread
15
16
  class App
16
- def call(env)
17
+ def call(_)
17
18
  winequality = PyCallThread.run do
18
- pandas = PyCall.import_module('pandas')
19
- data = pandas.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-red.csv', sep: ';')
20
- data.to_json()
19
+ pandas = PyCall.import_module("pandas")
20
+ data = pandas.read_csv("https://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-red.csv", sep: ";")
21
+ data.to_html
21
22
  end
22
23
 
23
- [200, { 'Content-Type' => 'text/html' }, [winequality]]
24
+ [200, { "Content-Type" => "text/html" }, [winequality]]
24
25
  end
25
- end
26
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PycallThread
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
data/lib/pycall_thread.rb CHANGED
@@ -22,7 +22,7 @@ module PyCallThread
22
22
  @initialized = true
23
23
  end
24
24
 
25
- def require_pycall(&require_pycall_block)
25
+ def self.require_pycall(&require_pycall_block)
26
26
  # Only safe to use PyCallThread if PyCall hasn't already been loaded
27
27
  raise "PyCall::LibPython already exists: PyCall can't have been initialized already" if defined?(PyCall::LibPython)
28
28
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pycall_thread
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Nickell