iruby 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +124 -0
- data/CHANGES.md +8 -0
- data/README.md +44 -46
- data/ext/Rakefile +19 -0
- data/iruby.gemspec +4 -0
- data/lib/iruby/session/mixin.rb +1 -1
- data/lib/iruby/session_adapter.rb +3 -2
- data/lib/iruby/version.rb +1 -1
- data/test/iruby/session_adapter_test.rb +0 -28
- data/test/iruby/session_test.rb +0 -4
- metadata +23 -7
- data/.github/workflows/ubuntu.yml +0 -69
- data/lib/iruby/session_adapter/pyzmq_adapter.rb +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e37561d8cd48b57f5ad431cfdf984306e638a262113f2cb741cf3a7d7a8e2e1
|
4
|
+
data.tar.gz: b1cd1da09bd9a6158749225e0097f92442ec5d600ab6f40a6189b50d0f2a4bb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f70bdf2fa9da79a2e072f8a27ae729f5656a02a1d34a14bdd01287a16bfe257732875fc7a76db3f498cfd25cf49f4a9aa5ce2c82040ec90082bfca5e5d2f4e2
|
7
|
+
data.tar.gz: 789fe4b197775ef1245e96db8ac039a0df166898652c689ce2f66a7eb25db99a5f4806bccb7b76cc52cbdc7c4e6a3749eebda903b586b170842c9630f50af082
|
@@ -0,0 +1,124 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
types:
|
9
|
+
- opened
|
10
|
+
- synchronize
|
11
|
+
- reopened
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
ubuntu:
|
15
|
+
name: Ubuntu
|
16
|
+
runs-on: ${{ matrix.os }}
|
17
|
+
|
18
|
+
strategy:
|
19
|
+
fail-fast: false
|
20
|
+
matrix:
|
21
|
+
os:
|
22
|
+
- ubuntu-latest
|
23
|
+
ruby:
|
24
|
+
- "3.0"
|
25
|
+
- "2.7"
|
26
|
+
- "2.6"
|
27
|
+
- "2.5"
|
28
|
+
- "2.4"
|
29
|
+
- "2.3"
|
30
|
+
- debug
|
31
|
+
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v2
|
34
|
+
with:
|
35
|
+
fetch-depth: 1
|
36
|
+
|
37
|
+
- uses: ruby/setup-ruby@v1
|
38
|
+
with:
|
39
|
+
ruby-version: ${{ matrix.ruby }}
|
40
|
+
|
41
|
+
- run: rake build
|
42
|
+
|
43
|
+
- name: Install irb for old Ruby
|
44
|
+
if: |
|
45
|
+
matrix.ruby == '2.5' ||
|
46
|
+
matrix.ruby == '2.4' ||
|
47
|
+
matrix.ruby == '2.3'
|
48
|
+
run: |
|
49
|
+
cat <<GEMFILE > Gemfile.irb
|
50
|
+
source 'https://rubygems.org'
|
51
|
+
gem 'irb'
|
52
|
+
GEMFILE
|
53
|
+
BUNDLE_GEMFILE=Gemfile.irb bundle install --jobs 4 --retry 3
|
54
|
+
|
55
|
+
- run: gem install pkg/*.gem
|
56
|
+
|
57
|
+
- run: ruby -r iruby -e "p IRuby::SessionAdapter.select_adapter_class"
|
58
|
+
env:
|
59
|
+
IRUBY_SESSION_ADAPTER: ffi-rzmq
|
60
|
+
|
61
|
+
- name: Install requirements on ubuntu
|
62
|
+
run: |
|
63
|
+
sudo apt update
|
64
|
+
sudo apt install -y --no-install-recommends \
|
65
|
+
libczmq-dev \
|
66
|
+
python3 \
|
67
|
+
python3-pip \
|
68
|
+
python3-setuptools
|
69
|
+
sudo pip3 install wheel
|
70
|
+
sudo pip3 install -r ci/requirements.txt
|
71
|
+
|
72
|
+
- run: bundle install --jobs 4 --retry 3
|
73
|
+
|
74
|
+
- name: Run tests
|
75
|
+
env:
|
76
|
+
PYTHON: python3
|
77
|
+
ADAPTERS: cztop ffi-rzmq
|
78
|
+
run: |
|
79
|
+
for adapter in $ADAPTERS; do
|
80
|
+
export IRUBY_TEST_SESSION_ADAPTER_NAME=$adapter
|
81
|
+
bundle exec rake test TESTOPTS=-v
|
82
|
+
done
|
83
|
+
|
84
|
+
windows:
|
85
|
+
name: Windows
|
86
|
+
runs-on: windows-latest
|
87
|
+
|
88
|
+
steps:
|
89
|
+
- uses: actions/checkout@v2
|
90
|
+
with:
|
91
|
+
fetch-depth: 1
|
92
|
+
|
93
|
+
- uses: ruby/setup-ruby@v1
|
94
|
+
with:
|
95
|
+
ruby-version: "3.0"
|
96
|
+
|
97
|
+
- run: rake build
|
98
|
+
|
99
|
+
- run: gem install pkg/*.gem
|
100
|
+
|
101
|
+
- run: ruby -r iruby -e "p IRuby::SessionAdapter.select_adapter_class"
|
102
|
+
env:
|
103
|
+
IRUBY_SESSION_ADAPTER: ffi-rzmq
|
104
|
+
|
105
|
+
macos:
|
106
|
+
name: macOS
|
107
|
+
runs-on: macos-latest
|
108
|
+
|
109
|
+
steps:
|
110
|
+
- uses: actions/checkout@v2
|
111
|
+
with:
|
112
|
+
fetch-depth: 1
|
113
|
+
|
114
|
+
- uses: ruby/setup-ruby@v1
|
115
|
+
with:
|
116
|
+
ruby-version: "3.0"
|
117
|
+
|
118
|
+
- run: rake build
|
119
|
+
|
120
|
+
- run: gem install pkg/*.gem
|
121
|
+
|
122
|
+
- run: ruby -r iruby -e "p IRuby::SessionAdapter.select_adapter_class"
|
123
|
+
env:
|
124
|
+
IRUBY_SESSION_ADAPTER: ffi-rzmq
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 0.7.4 (2021-08-16)
|
2
|
+
|
3
|
+
## Enhancements
|
4
|
+
|
5
|
+
* Install zeromq library automatically https://github.com/SciRuby/iruby/pull/307, https://github.com/SciRuby/iruby/pull/308 (@mrkn, @kou)
|
6
|
+
* Remove pyzmq session adapter (@mrkn)
|
7
|
+
* Make cztop session adapter deprecated (@mrkn)
|
8
|
+
|
1
9
|
# 0.7.3 (2021-07-08)
|
2
10
|
|
3
11
|
## Bug Fixes
|
data/README.md
CHANGED
@@ -21,67 +21,53 @@ https://mybinder.org/v2/gh/RubyData/binder/master?filepath=../lab
|
|
21
21
|
### Requirements
|
22
22
|
|
23
23
|
* [Jupyter](https://jupyter.org)
|
24
|
-
* One of the following is required
|
25
|
-
* [ffi-rzmq](https://github.com/chuckremes/ffi-rzmq) and [libzmq](https://github.com/zeromq/libzmq)
|
26
|
-
* [CZTop](https://gitlab.com/paddor/cztop) and [CZMQ](https://github.com/zeromq/czmq)
|
27
24
|
|
28
|
-
|
25
|
+
The following requirements are automatically installed.
|
29
26
|
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
* [ffi-rzmq](https://github.com/chuckremes/ffi-rzmq)
|
28
|
+
* [libzmq](https://github.com/zeromq/libzmq)
|
29
|
+
|
30
|
+
The following dependencies are optional.
|
33
31
|
|
34
32
|
* [Pry][Pry], if you want to use [Pry][Pry] instead of IRB for the code execution backend
|
35
|
-
* If you want to install the development version of IRuby from the source code, try [specific_install](https://github.com/rdp/specific_install).
|
36
33
|
|
37
|
-
```
|
38
|
-
gem specific_install https://github.com/SciRuby/iruby
|
39
|
-
```
|
40
34
|
|
41
|
-
###
|
35
|
+
### Installing Jupyter Notebook and/or JupyterLab
|
42
36
|
|
43
|
-
|
37
|
+
See the official document to know how to install Jupyter Notebook and/or JupyterLab.
|
38
|
+
|
39
|
+
* https://jupyter.readthedocs.io/en/latest/install/notebook-classic.html
|
40
|
+
* https://jupyter.readthedocs.io/en/latest/install.html
|
41
|
+
|
42
|
+
### Ubuntu
|
44
43
|
|
45
44
|
#### Ubuntu 17+
|
46
45
|
|
47
46
|
```shell
|
48
47
|
sudo apt install libtool libffi-dev ruby ruby-dev make
|
49
|
-
sudo apt install libzmq3-dev libczmq-dev
|
50
48
|
|
51
|
-
gem install
|
52
|
-
gem install iruby --pre
|
49
|
+
gem install --user-install iruby
|
53
50
|
iruby register --force
|
54
51
|
```
|
55
52
|
|
56
53
|
#### Ubuntu 16
|
57
54
|
|
58
|
-
|
55
|
+
The latest IRuby requires Ruby >= 2.4 while Ubuntu's official Ruby package is version 2.3.
|
56
|
+
So you need to install Ruby >= 2.4 by yourself before preparing IRuby.
|
57
|
+
We recommend to use rbenv.
|
59
58
|
|
60
59
|
```shell
|
61
60
|
sudo apt install libtool libffi-dev ruby ruby-dev make
|
62
|
-
|
63
|
-
git clone https://github.com/zeromq/czmq
|
64
|
-
cd czmq
|
65
|
-
./autogen.sh && ./configure && sudo make && sudo make install
|
66
|
-
|
67
|
-
gem install cztop
|
68
|
-
gem install iruby --pre
|
61
|
+
gem install --user-install iruby
|
69
62
|
iruby register --force
|
70
63
|
```
|
71
64
|
|
72
65
|
### Windows
|
73
66
|
|
74
|
-
Install git and Jupyter.
|
75
67
|
[DevKit](https://rubyinstaller.org/add-ons/devkit.html) is necessary for building RubyGems with native C-based extensions.
|
76
68
|
|
77
|
-
Install ZeroMQ.
|
78
|
-
```shell
|
79
|
-
pacman -S mingw64/mingw-w64-x86_64-zeromq
|
80
|
-
```
|
81
|
-
|
82
69
|
```shell
|
83
|
-
gem install
|
84
|
-
gem install iruby --pre
|
70
|
+
gem install iruby
|
85
71
|
iruby register --force
|
86
72
|
```
|
87
73
|
|
@@ -93,17 +79,7 @@ Install Jupyter.
|
|
93
79
|
#### Homebrew
|
94
80
|
|
95
81
|
```shell
|
96
|
-
|
97
|
-
brew install zeromq --HEAD
|
98
|
-
brew install czmq --HEAD
|
99
|
-
```
|
100
|
-
|
101
|
-
```shell
|
102
|
-
# export LIBZMQ_PATH=$(brew --prefix zeromq)/lib
|
103
|
-
# export LIBCZMQ_PATH=$(brew --prefix czmq)/lib
|
104
|
-
# gem install cztop
|
105
|
-
gem install ffi-rzmq
|
106
|
-
gem install iruby --pre
|
82
|
+
gem install iruby
|
107
83
|
iruby register --force
|
108
84
|
```
|
109
85
|
|
@@ -113,8 +89,8 @@ If you are using macports, run the following commands.
|
|
113
89
|
|
114
90
|
```shell
|
115
91
|
port install libtool autoconf automake autogen
|
116
|
-
gem install ffi-rzmq
|
117
92
|
gem install iruby
|
93
|
+
iruby register --force
|
118
94
|
```
|
119
95
|
|
120
96
|
### Docker
|
@@ -123,7 +99,7 @@ Try [RubyData Docker Stacks](https://github.com/RubyData/docker-stacks).
|
|
123
99
|
Running jupyter notebook:
|
124
100
|
|
125
101
|
```shell
|
126
|
-
docker run -p 8888:8888 rubydata/datascience-notebook
|
102
|
+
docker run --rm -it -p 8888:8888 rubydata/datascience-notebook
|
127
103
|
```
|
128
104
|
|
129
105
|
### Installation for JRuby
|
@@ -131,7 +107,6 @@ docker run -p 8888:8888 rubydata/datascience-notebook
|
|
131
107
|
You can use Java classes in your IRuby notebook.
|
132
108
|
|
133
109
|
* JRuby version >= 9.0.4.0
|
134
|
-
* cztop gem
|
135
110
|
* iruby gem
|
136
111
|
|
137
112
|
After installation, make sure that your `env` is set up to use jruby.
|
@@ -148,6 +123,29 @@ If you have already used IRuby with a different version, you need to generate a
|
|
148
123
|
$ iruby register --force
|
149
124
|
```
|
150
125
|
|
126
|
+
### Install the development version of IRuby
|
127
|
+
|
128
|
+
**Be careful to use the development version because it is usually unstable.**
|
129
|
+
|
130
|
+
If you want to install the development version of IRuby from the source code, try [specific_install](https://github.com/rdp/specific_install).
|
131
|
+
|
132
|
+
```
|
133
|
+
gem specific_install https://github.com/SciRuby/iruby
|
134
|
+
```
|
135
|
+
|
136
|
+
### Note for using with CZTop and CZMQ
|
137
|
+
|
138
|
+
[CZTop](https://gitlab.com/paddor/cztop) adapter has been deprecated since IRuby version 0.7.4.
|
139
|
+
It will be removed after several versions.
|
140
|
+
|
141
|
+
If you want to use IRuby with CZTop, you need to install it and [CZMQ](https://github.com/zeromq/czmq).
|
142
|
+
|
143
|
+
If both ffi-rzmq and cztop are installed, ffi-rzmq is used. If you prefer cztop, set the following environment variable.
|
144
|
+
|
145
|
+
```sh
|
146
|
+
export IRUBY_SESSION_ADAPTER="cztop"
|
147
|
+
```
|
148
|
+
|
151
149
|
## Backends
|
152
150
|
|
153
151
|
There are two backends: PlainBackend and PryBackend.
|
data/ext/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
task default: :all
|
2
|
+
|
3
|
+
task all: [:ensure_zeromq]
|
4
|
+
|
5
|
+
task :ensure_zeromq do
|
6
|
+
begin
|
7
|
+
require 'ffi-rzmq'
|
8
|
+
rescue LoadError
|
9
|
+
require 'native-package-installer'
|
10
|
+
unless NativePackageInstaller.install(arch_linux: 'zeromq',
|
11
|
+
debian: 'libzmq3-dev',
|
12
|
+
freebsd: 'libzmq4',
|
13
|
+
homebrew: 'zmq',
|
14
|
+
macports: 'zmq',
|
15
|
+
redhat: 'zeromq-devel')
|
16
|
+
raise 'Failed to install ZeroMQ'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/iruby.gemspec
CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
15
|
s.test_files = s.files.grep(%r{^test/})
|
16
16
|
s.require_paths = %w[lib]
|
17
|
+
s.extensions = %w[ext/Rakefile]
|
17
18
|
|
18
19
|
s.required_ruby_version = '>= 2.3.0'
|
19
20
|
|
@@ -22,9 +23,12 @@ Gem::Specification.new do |s|
|
|
22
23
|
s.add_dependency 'irb'
|
23
24
|
s.add_dependency 'mime-types', '>= 3.3.1'
|
24
25
|
s.add_dependency 'multi_json', '~> 1.11'
|
26
|
+
s.add_dependency 'native-package-installer'
|
25
27
|
|
26
28
|
s.add_development_dependency 'pycall', '>= 1.2.1'
|
27
29
|
s.add_development_dependency 'rake'
|
28
30
|
s.add_development_dependency 'test-unit'
|
29
31
|
s.add_development_dependency 'test-unit-rr'
|
32
|
+
|
33
|
+
s.metadata['msys2_mingw_dependencies'] = 'zeromq'
|
30
34
|
end
|
data/lib/iruby/session/mixin.rb
CHANGED
@@ -23,7 +23,7 @@ module IRuby
|
|
23
23
|
idents, msg_list = frames[0..i-1], frames[i+1..-1]
|
24
24
|
|
25
25
|
minlen = 5
|
26
|
-
raise
|
26
|
+
raise "malformed message, must have at least #{minlen} elements" unless msg_list.length >= minlen
|
27
27
|
s, header, parent_header, metadata, content, buffers = *msg_list
|
28
28
|
raise 'Invalid signature' unless s == sign(msg_list[1..-1])
|
29
29
|
{
|
@@ -40,14 +40,12 @@ module IRuby
|
|
40
40
|
|
41
41
|
require_relative 'session_adapter/ffirzmq_adapter'
|
42
42
|
require_relative 'session_adapter/cztop_adapter'
|
43
|
-
require_relative 'session_adapter/pyzmq_adapter'
|
44
43
|
require_relative 'session_adapter/test_adapter'
|
45
44
|
|
46
45
|
def self.select_adapter_class(name=nil)
|
47
46
|
classes = {
|
48
47
|
'ffi-rzmq' => SessionAdapter::FfirzmqAdapter,
|
49
48
|
'cztop' => SessionAdapter::CztopAdapter,
|
50
|
-
# 'pyzmq' => SessionAdapter::PyzmqAdapter
|
51
49
|
'test' => SessionAdapter::TestAdapter,
|
52
50
|
}
|
53
51
|
if (name ||= ENV.fetch('IRUBY_SESSION_ADAPTER', nil))
|
@@ -61,6 +59,9 @@ module IRuby
|
|
61
59
|
"Session adapter `#{name}` is unavailable"
|
62
60
|
end
|
63
61
|
end
|
62
|
+
if name == 'cztop'
|
63
|
+
warn "WARNING: cztop was deprecated and will be removed; Use ffi-rzmq, instead."
|
64
|
+
end
|
64
65
|
return cls
|
65
66
|
end
|
66
67
|
classes.each_value do |cls|
|
data/lib/iruby/version.rb
CHANGED
@@ -14,7 +14,6 @@ module IRubyTest
|
|
14
14
|
assert_rr do
|
15
15
|
stub(IRuby::SessionAdapter::CztopAdapter).available? { true }
|
16
16
|
stub(IRuby::SessionAdapter::FfirzmqAdapter).available? { false }
|
17
|
-
stub(IRuby::SessionAdapter::PyzmqAdapter).available? { false }
|
18
17
|
|
19
18
|
cls = IRuby::SessionAdapter.select_adapter_class
|
20
19
|
assert_equal IRuby::SessionAdapter::CztopAdapter, cls
|
@@ -25,25 +24,12 @@ module IRubyTest
|
|
25
24
|
assert_rr do
|
26
25
|
stub(IRuby::SessionAdapter::FfirzmqAdapter).available? { true }
|
27
26
|
stub(IRuby::SessionAdapter::CztopAdapter).available? { false }
|
28
|
-
stub(IRuby::SessionAdapter::PyzmqAdapter).available? { false }
|
29
27
|
|
30
28
|
cls = IRuby::SessionAdapter.select_adapter_class
|
31
29
|
assert_equal IRuby::SessionAdapter::FfirzmqAdapter, cls
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
35
|
-
def test_select_adapter_class_with_pyzmq
|
36
|
-
omit("pyzmq adapter is disabled")
|
37
|
-
assert_rr do
|
38
|
-
stub(IRuby::SessionAdapter::PyzmqAdapter).available? { true }
|
39
|
-
stub(IRuby::SessionAdapter::FfirzmqAdapter).available? { false }
|
40
|
-
stub(IRuby::SessionAdapter::CztopAdapter).available? { false }
|
41
|
-
|
42
|
-
cls = IRuby::SessionAdapter.select_adapter_class
|
43
|
-
assert_equal IRuby::SessionAdapter::PyzmqAdapter, cls
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
33
|
def test_select_adapter_class_with_env
|
48
34
|
with_env('IRUBY_SESSION_ADAPTER' => 'cztop') do
|
49
35
|
assert_rr do
|
@@ -72,20 +58,6 @@ module IRubyTest
|
|
72
58
|
end
|
73
59
|
end
|
74
60
|
end
|
75
|
-
|
76
|
-
with_env('IRUBY_SESSION_ADAPTER' => 'pyzmq') do
|
77
|
-
# pyzmq adapter is disabled
|
78
|
-
#
|
79
|
-
# IRuby::SessionAdapter::PyzmqAdapter.stub :available?, true do
|
80
|
-
# assert_equal IRuby::SessionAdapter::PyzmqAdapter, IRuby::SessionAdapter.select_adapter_class
|
81
|
-
# end
|
82
|
-
#
|
83
|
-
# IRuby::SessionAdapter::PyzmqAdapter.stub :available?, false do
|
84
|
-
# assert_raises IRuby::SessionAdapterNotFound do
|
85
|
-
# IRuby::SessionAdapter.select_adapter_class
|
86
|
-
# end
|
87
|
-
# end
|
88
|
-
end
|
89
61
|
end
|
90
62
|
end
|
91
63
|
end
|
data/test/iruby/session_test.rb
CHANGED
@@ -22,9 +22,6 @@ module IRubyTest
|
|
22
22
|
IRuby::SessionAdapter::CztopAdapter
|
23
23
|
when 'ffi-rzmq'
|
24
24
|
IRuby::SessionAdapter::FfirzmqAdapter
|
25
|
-
when 'pyzmq'
|
26
|
-
omit("pyzmq adapter is disabled")
|
27
|
-
# IRuby::SessionAdapter::PyzmqAdapter
|
28
25
|
else
|
29
26
|
flunk "Unknown session adapter: #{adapter_name.inspect}"
|
30
27
|
end
|
@@ -37,7 +34,6 @@ module IRubyTest
|
|
37
34
|
assert_rr do
|
38
35
|
stub(IRuby::SessionAdapter::CztopAdapter).available? { false }
|
39
36
|
stub(IRuby::SessionAdapter::FfirzmqAdapter).available? { false }
|
40
|
-
stub(IRuby::SessionAdapter::PyzmqAdapter).available? { false }
|
41
37
|
stub(IRuby::SessionAdapter::TestAdapter).available? { false }
|
42
38
|
assert_raises IRuby::SessionAdapterNotFound do
|
43
39
|
IRuby::Session.new(@session_config)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Mendler
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-08-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: data_uri
|
@@ -81,6 +81,20 @@ dependencies:
|
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '1.11'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: native-package-installer
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
84
98
|
- !ruby/object:Gem::Dependency
|
85
99
|
name: pycall
|
86
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,10 +156,11 @@ email:
|
|
142
156
|
- mail@daniel-mendler.de
|
143
157
|
executables:
|
144
158
|
- iruby
|
145
|
-
extensions:
|
159
|
+
extensions:
|
160
|
+
- ext/Rakefile
|
146
161
|
extra_rdoc_files: []
|
147
162
|
files:
|
148
|
-
- ".github/workflows/
|
163
|
+
- ".github/workflows/ci.yml"
|
149
164
|
- ".gitignore"
|
150
165
|
- CHANGES.md
|
151
166
|
- Gemfile
|
@@ -158,6 +173,7 @@ files:
|
|
158
173
|
- ci/requirements.txt
|
159
174
|
- docker/setup.sh
|
160
175
|
- docker/test.sh
|
176
|
+
- ext/Rakefile
|
161
177
|
- iruby.gemspec
|
162
178
|
- lib/iruby.rb
|
163
179
|
- lib/iruby/assets/kernel.css
|
@@ -200,7 +216,6 @@ files:
|
|
200
216
|
- lib/iruby/session_adapter.rb
|
201
217
|
- lib/iruby/session_adapter/cztop_adapter.rb
|
202
218
|
- lib/iruby/session_adapter/ffirzmq_adapter.rb
|
203
|
-
- lib/iruby/session_adapter/pyzmq_adapter.rb
|
204
219
|
- lib/iruby/session_adapter/test_adapter.rb
|
205
220
|
- lib/iruby/utils.rb
|
206
221
|
- lib/iruby/version.rb
|
@@ -229,7 +244,8 @@ files:
|
|
229
244
|
homepage: https://github.com/SciRuby/iruby
|
230
245
|
licenses:
|
231
246
|
- MIT
|
232
|
-
metadata:
|
247
|
+
metadata:
|
248
|
+
msys2_mingw_dependencies: zeromq
|
233
249
|
post_install_message:
|
234
250
|
rdoc_options: []
|
235
251
|
require_paths:
|
@@ -245,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
261
|
- !ruby/object:Gem::Version
|
246
262
|
version: '0'
|
247
263
|
requirements: []
|
248
|
-
rubygems_version: 3.2.
|
264
|
+
rubygems_version: 3.2.23
|
249
265
|
signing_key:
|
250
266
|
specification_version: 4
|
251
267
|
summary: Ruby Kernel for Jupyter
|
@@ -1,69 +0,0 @@
|
|
1
|
-
name: CI
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- master
|
7
|
-
pull_request:
|
8
|
-
types:
|
9
|
-
- opened
|
10
|
-
- synchronize
|
11
|
-
- reopened
|
12
|
-
|
13
|
-
jobs:
|
14
|
-
test:
|
15
|
-
name: Test
|
16
|
-
runs-on: ${{ matrix.os }}
|
17
|
-
|
18
|
-
strategy:
|
19
|
-
fail-fast: false
|
20
|
-
matrix:
|
21
|
-
os:
|
22
|
-
- ubuntu-20.04
|
23
|
-
- ubuntu-latest
|
24
|
-
ruby:
|
25
|
-
- 3.0
|
26
|
-
- 2.7
|
27
|
-
- 2.6
|
28
|
-
- 2.5
|
29
|
-
- 2.4
|
30
|
-
- 2.3
|
31
|
-
- debug
|
32
|
-
|
33
|
-
steps:
|
34
|
-
- uses: actions/checkout@v2
|
35
|
-
with:
|
36
|
-
fetch-depth: 1
|
37
|
-
|
38
|
-
- uses: ruby/setup-ruby@v1
|
39
|
-
with:
|
40
|
-
ruby-version: ${{ matrix.ruby }}
|
41
|
-
|
42
|
-
- name: Install requirements on ubuntu
|
43
|
-
run: |
|
44
|
-
sudo apt update
|
45
|
-
sudo apt install -y --no-install-recommends \
|
46
|
-
libczmq-dev \
|
47
|
-
python3 \
|
48
|
-
python3-pip \
|
49
|
-
python3-setuptools
|
50
|
-
sudo pip3 install wheel
|
51
|
-
sudo pip3 install -r ci/requirements.txt
|
52
|
-
|
53
|
-
- run: gem install bundler
|
54
|
-
|
55
|
-
- run: bundle install --jobs 4 --retry 3
|
56
|
-
|
57
|
-
- name: Run tests
|
58
|
-
env:
|
59
|
-
PYTHON: python3
|
60
|
-
ADAPTERS: cztop ffi-rzmq pyzmq
|
61
|
-
run: |
|
62
|
-
for adapter in $ADAPTERS; do
|
63
|
-
export IRUBY_TEST_SESSION_ADAPTER_NAME=$adapter
|
64
|
-
bundle exec rake test TESTOPTS=-v
|
65
|
-
done
|
66
|
-
|
67
|
-
- run: rake build
|
68
|
-
|
69
|
-
- run: gem install pkg/*.gem
|
@@ -1,77 +0,0 @@
|
|
1
|
-
module IRuby
|
2
|
-
module SessionAdapter
|
3
|
-
class PyzmqAdapter < BaseAdapter
|
4
|
-
|
5
|
-
class << self
|
6
|
-
def load_requirements
|
7
|
-
require 'pycall'
|
8
|
-
import_pyzmq
|
9
|
-
end
|
10
|
-
|
11
|
-
def import_pyzmq
|
12
|
-
@zmq = PyCall.import_module('zmq')
|
13
|
-
rescue PyCall::PyError => error
|
14
|
-
raise LoadError, error.message
|
15
|
-
end
|
16
|
-
|
17
|
-
attr_reader :zmq
|
18
|
-
end
|
19
|
-
|
20
|
-
def make_router_socket(protocol, host, port)
|
21
|
-
make_socket(:ROUTER, protocol, host, port)
|
22
|
-
end
|
23
|
-
|
24
|
-
def make_pub_socket(protocol, host, port)
|
25
|
-
make_socket(:PUB, protocol, host, port)
|
26
|
-
end
|
27
|
-
|
28
|
-
def heartbeat_loop(sock)
|
29
|
-
PyCall.sys.path.append(File.expand_path('../pyzmq', __FILE__))
|
30
|
-
heartbeat = PyCall.import_module('iruby.heartbeat')
|
31
|
-
@heartbeat_thread = heartbeat.Heartbeat.new(sock)
|
32
|
-
@heartbeat_thread.start
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def socket_type(type_symbol)
|
38
|
-
case type_symbol
|
39
|
-
when :ROUTER, :PUB, :REP
|
40
|
-
zmq[type_symbol]
|
41
|
-
else
|
42
|
-
raise ArgumentError, "Unknown ZMQ socket type: #{type_symbol}"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def make_socket(type_symbol, protocol, host, port)
|
47
|
-
type = socket_type(type_symbol)
|
48
|
-
sock = zmq_context.socket(type)
|
49
|
-
bind_socket(sock, protocol, host, port)
|
50
|
-
sock
|
51
|
-
end
|
52
|
-
|
53
|
-
def bind_socket(sock, protocol, host, port)
|
54
|
-
iface = "#{protocol}://#{host}"
|
55
|
-
case protocol
|
56
|
-
when 'tcp'
|
57
|
-
if port <= 0
|
58
|
-
port = sock.bind_to_random_port(iface)
|
59
|
-
else
|
60
|
-
sock.bind("#{iface}:#{port}")
|
61
|
-
end
|
62
|
-
else
|
63
|
-
raise ArgumentError, "Unsupported protocol: #{protocol}"
|
64
|
-
end
|
65
|
-
[sock, port]
|
66
|
-
end
|
67
|
-
|
68
|
-
def zmq_context
|
69
|
-
zmq.Context.instance
|
70
|
-
end
|
71
|
-
|
72
|
-
def zmq
|
73
|
-
self.class.zmq
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|