iruby 0.3 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ubuntu.yml +62 -0
- data/CHANGES.md +203 -0
- data/Gemfile +3 -1
- data/LICENSE +1 -1
- data/README.md +137 -87
- data/Rakefile +36 -10
- data/ci/Dockerfile.base.erb +41 -0
- data/ci/Dockerfile.main.erb +7 -0
- data/ci/requirements.txt +1 -0
- data/docker/setup.sh +15 -0
- data/docker/test.sh +7 -0
- data/iruby.gemspec +14 -18
- data/lib/iruby.rb +14 -8
- data/lib/iruby/backend.rb +38 -10
- data/lib/iruby/command.rb +67 -15
- data/lib/iruby/display.rb +77 -41
- data/lib/iruby/event_manager.rb +40 -0
- data/lib/iruby/formatter.rb +3 -3
- data/lib/iruby/input.rb +6 -6
- data/lib/iruby/input/README.md +299 -0
- data/lib/iruby/input/autoload.rb +1 -1
- data/lib/iruby/input/builder.rb +4 -4
- data/lib/iruby/input/button.rb +2 -2
- data/lib/iruby/input/cancel.rb +1 -1
- data/lib/iruby/input/checkbox.rb +3 -3
- data/lib/iruby/input/date.rb +3 -3
- data/lib/iruby/input/field.rb +2 -2
- data/lib/iruby/input/file.rb +3 -3
- data/lib/iruby/input/form.rb +6 -6
- data/lib/iruby/input/label.rb +4 -4
- data/lib/iruby/input/multiple.rb +10 -10
- data/lib/iruby/input/popup.rb +2 -2
- data/lib/iruby/input/radio.rb +6 -6
- data/lib/iruby/input/select.rb +8 -8
- data/lib/iruby/input/textarea.rb +1 -1
- data/lib/iruby/input/widget.rb +2 -2
- data/lib/iruby/jupyter.rb +77 -0
- data/lib/iruby/kernel.rb +204 -36
- data/lib/iruby/ostream.rb +29 -8
- data/lib/iruby/session.rb +117 -0
- data/lib/iruby/session/cztop.rb +4 -0
- data/lib/iruby/session_adapter.rb +72 -0
- data/lib/iruby/session_adapter/cztop_adapter.rb +45 -0
- data/lib/iruby/session_adapter/ffirzmq_adapter.rb +55 -0
- data/lib/iruby/session_adapter/pyzmq_adapter.rb +77 -0
- data/lib/iruby/session_adapter/test_adapter.rb +49 -0
- data/lib/iruby/utils.rb +13 -2
- data/lib/iruby/version.rb +1 -1
- data/run-test.sh +12 -0
- data/tasks/ci.rake +65 -0
- data/test/helper.rb +136 -0
- data/test/integration_test.rb +22 -11
- data/test/iruby/backend_test.rb +37 -0
- data/test/iruby/command_test.rb +207 -0
- data/test/iruby/event_manager_test.rb +92 -0
- data/test/iruby/jupyter_test.rb +27 -0
- data/test/iruby/kernel_test.rb +185 -0
- data/test/iruby/mime_test.rb +50 -0
- data/test/iruby/multi_logger_test.rb +1 -5
- data/test/iruby/session_adapter/cztop_adapter_test.rb +20 -0
- data/test/iruby/session_adapter/ffirzmq_adapter_test.rb +20 -0
- data/test/iruby/session_adapter/session_adapter_test_base.rb +27 -0
- data/test/iruby/session_adapter_test.rb +91 -0
- data/test/iruby/session_test.rb +48 -0
- data/test/run-test.rb +19 -0
- metadata +120 -50
- data/.travis.yml +0 -16
- data/CHANGES +0 -143
- data/CONTRIBUTORS +0 -19
- data/lib/iruby/session/rbczmq.rb +0 -68
- data/test/test_helper.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 14aea673b75a6fe8884eff08c52b8831bbcec141df2525ed4c0a877738654271
|
4
|
+
data.tar.gz: 89e5e091e67b7ef85f98ca0cb9ebe65cef0e32aacd75351c81b0c287666939c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53b824e32c52cbf2893b24310ba4d3c7caa52ec872f36f57644a95bdd139232b4b5e032f161fb86baf94d011964caf9d739a4795af6805fd174360ed866477fa
|
7
|
+
data.tar.gz: ee663bca3c4a67730d73e709c24d827af73e7c58734afe4dffc22c685c909462e9c9113f9548a8f1c8b5ce33b0b94338386b24c07978db547fab1caa21828ea7
|
@@ -0,0 +1,62 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
- push
|
5
|
+
- pull_request
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
name: Test
|
10
|
+
runs-on: ${{ matrix.os }}
|
11
|
+
|
12
|
+
strategy:
|
13
|
+
fail-fast: false
|
14
|
+
matrix:
|
15
|
+
os:
|
16
|
+
- ubuntu-20.04
|
17
|
+
- ubuntu-latest
|
18
|
+
ruby:
|
19
|
+
- 3.0
|
20
|
+
- 2.7
|
21
|
+
- 2.6
|
22
|
+
- 2.5
|
23
|
+
- 2.4
|
24
|
+
- 2.3
|
25
|
+
- debug
|
26
|
+
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v2
|
29
|
+
with:
|
30
|
+
fetch-depth: 1
|
31
|
+
|
32
|
+
- uses: ruby/setup-ruby@v1
|
33
|
+
with:
|
34
|
+
ruby-version: ${{ matrix.ruby }}
|
35
|
+
|
36
|
+
- name: Install requirements on ubuntu
|
37
|
+
run: |
|
38
|
+
sudo apt install -y --no-install-recommends \
|
39
|
+
libczmq-dev \
|
40
|
+
python3 \
|
41
|
+
python3-pip \
|
42
|
+
python3-setuptools
|
43
|
+
sudo pip3 install wheel
|
44
|
+
sudo pip3 install -r ci/requirements.txt
|
45
|
+
|
46
|
+
- run: gem install bundler
|
47
|
+
|
48
|
+
- run: bundle install --jobs 4 --retry 3
|
49
|
+
|
50
|
+
- name: Run tests
|
51
|
+
env:
|
52
|
+
PYTHON: python3
|
53
|
+
ADAPTERS: cztop ffi-rzmq pyzmq
|
54
|
+
run: |
|
55
|
+
for adapter in $ADAPTERS; do
|
56
|
+
export IRUBY_TEST_SESSION_ADAPTER_NAME=$adapter
|
57
|
+
bundle exec rake test TESTOPTS=-v
|
58
|
+
done
|
59
|
+
|
60
|
+
- run: rake build
|
61
|
+
|
62
|
+
- run: gem install pkg/*.gem
|
data/CHANGES.md
ADDED
@@ -0,0 +1,203 @@
|
|
1
|
+
# 0.7.0 (2021-05-28)
|
2
|
+
|
3
|
+
## Enhancements
|
4
|
+
|
5
|
+
* The default backend is changed to IRB (@mrkn)
|
6
|
+
* Add IRuby::Kernel#switch_backend! method (@mrkn)
|
7
|
+
|
8
|
+
## Bug Fixes
|
9
|
+
|
10
|
+
* Follow the messages and hooks orders during execute_request processing (@mrkn)
|
11
|
+
* Fix the handling of image/svg+xml https://github.com/SciRuby/iruby/pull/300, https://github.com/SciRuby/iruby/pull/301 (@kojix2)
|
12
|
+
|
13
|
+
# 0.6.0 (2021-05-25)
|
14
|
+
|
15
|
+
## Bug Fixes
|
16
|
+
|
17
|
+
* Fix the handling of application/javascript https://github.com/SciRuby/iruby/issues/292, https://github.com/SciRuby/iruby/pull/294 (@kylekyle, @mrkn)
|
18
|
+
|
19
|
+
## Enhancements
|
20
|
+
|
21
|
+
* Add the `initialized` event in `IRuby::Kernel` class https://github.com/SciRuby/iruby/pull/168, https://github.com/SciRuby/iruby/pull/296 (@Yuki-Inoue, @mrkn)
|
22
|
+
* Add the following four events https://github.com/SciRuby/iruby/pull/295 (@mrkn):
|
23
|
+
* `pre-execute` -- occurs before every code execution
|
24
|
+
* `pre-run-cell` -- occurs before every non-silent code execution
|
25
|
+
* `post-execute` -- occurs after every code execution
|
26
|
+
* `post-run-cell` -- occurs after every non-silent code execution
|
27
|
+
* Replace Bond with IRB in PlainBackend https://github.com/SciRuby/iruby/pull/276, https://github.com/SciRuby/iruby/pull/297 (@cfis, @mrkn)
|
28
|
+
|
29
|
+
# 0.5.0 (2021-03-25)
|
30
|
+
|
31
|
+
## Bug Fixes
|
32
|
+
|
33
|
+
* Fix Jupyter console crashes issue https://github.com/SciRuby/iruby/pull/210 (@kojix2)
|
34
|
+
* Fix syntax highlighting issue on Jpyter Lab https://github.com/SciRuby/iruby/issues/224 (@kojix2)
|
35
|
+
* Fix interoperability issue with ruby-git https://github.com/SciRuby/iruby/pull/139 (@habemus-papadum)
|
36
|
+
* Fix the issue of `$stderr.write` that cannot handle multiple arguments https://github.com/SciRuby/iruby/issues/206 (@kojix2)
|
37
|
+
* Remove a buggy `inspect_request` implementation https://github.com/SciRuby/iruby/pull/119 (@LunarLanding)
|
38
|
+
* Fix uninitialized constant `Fiddle` caused in initialization phase https://github.com/SciRuby/iruby/issues/264 (@MatthewSteen, @kjoix2)
|
39
|
+
* Fix the issue on displaying a table https://github.com/SciRuby/iruby/pull/281 (@ankane)
|
40
|
+
|
41
|
+
## Enhancements
|
42
|
+
|
43
|
+
* Add `IRuby.clear_output` method https://github.com/SciRuby/iruby/pull/220 (@kojix2)
|
44
|
+
* Make backtrace on exception simplify and more appropriate for code in a cell https://github.com/SciRuby/iruby/pull/249 (@zheng-yongping)
|
45
|
+
* Make syntax error message more appropriate https://github.com/SciRuby/iruby/pull/251 (@zheng-yongping)
|
46
|
+
* Remove top-level `In` and `Out` constants https://github.com/SciRuby/iruby/pull/229 (@kojix2)
|
47
|
+
* Use text/plain for the default format of `Numo::NArray` objects https://github.com/SciRuby/iruby/pull/255 (@kojix2)
|
48
|
+
* Use ffi-rzmq as the default ZeroMQ adapter https://github.com/SciRuby/iruby/pull/256 (@kojix2)
|
49
|
+
* Drop rbczmq support https://github.com/SciRuby/iruby/pull/260 (@rstammer)
|
50
|
+
* Add ruby-vips image support https://github.com/SciRuby/iruby/pull/279 (@ankane)
|
51
|
+
* Replace mimemagic with mime-types https://github.com/SciRuby/iruby/pull/291 (@mrkn)
|
52
|
+
|
53
|
+
# 0.4.0 (2019-07-31)
|
54
|
+
|
55
|
+
(TBD)
|
56
|
+
|
57
|
+
# 0.3 (2017-03-26)
|
58
|
+
|
59
|
+
## Bug Fixes
|
60
|
+
|
61
|
+
* Disable Jupyter keyboard manager for all popups made using IRuby.popup (@kylekyle).
|
62
|
+
* Fix Iruby/Input date values bug that set date fields to whatever the last date value was (@kylekyle).
|
63
|
+
* Fix a bug where time strings put into prompter would give an 'out of range' error (@kylekyle).
|
64
|
+
|
65
|
+
## Enhancements
|
66
|
+
|
67
|
+
* Improvements to IRuby dependency detection using `Bundler::Dependencies#specs` (@kou).
|
68
|
+
* Use less memory forcing pry to store only the last 3 commands in memory (@kylekyle).
|
69
|
+
* Use bigger z-index that is used accross all browsers (@kylekyle).
|
70
|
+
* Ability to input date values as DateTime objects in IRuby/Input (@kylekyle).
|
71
|
+
* Add option to have check boxes checked by default (@kylekyle).
|
72
|
+
* Option for multi-select in drop down menus in the prompter (@kylekyle).
|
73
|
+
* Add support for multiple widgets using `IRuby::Input::Multiple` (@kylekyle).
|
74
|
+
* Calender icon for date selector icon (@kylekyle).
|
75
|
+
* Add support for Numo/NArray (@zalt50).
|
76
|
+
* Text now only completes after a space (@zalt50).
|
77
|
+
* Remove the DONTWAIT flag when receiving a message (@cloud-oak).
|
78
|
+
* Add support for CZTop (@kou).
|
79
|
+
|
80
|
+
# 0.2.9 (2016-05-02)
|
81
|
+
|
82
|
+
## Bug Fixes
|
83
|
+
|
84
|
+
* Fix an error where a NoMethodError was being raised where a table rendered using an Array of Hashes has more than `maxcols` columns. (@CGamesPlay)
|
85
|
+
* Patch PryBackend to throw unterminated string and unexpected end-of-file syntax errors (@kylekyle)
|
86
|
+
|
87
|
+
## Enhnacements
|
88
|
+
|
89
|
+
* Add an IRuby::Input class which provides widgets for getting inputs from users. (@kylekyle)
|
90
|
+
* Add data_uri dependency (@kylekyle)
|
91
|
+
* Added a clear_output display function (@mrkn)
|
92
|
+
* Doc fixes for installation (@kozo2, @generall)
|
93
|
+
|
94
|
+
# 0.2.8 (2015-12-06)
|
95
|
+
|
96
|
+
* Add compatibility with ffi-rzmq
|
97
|
+
* Windows support
|
98
|
+
|
99
|
+
# 0.2.7 (2015-07-02)
|
100
|
+
|
101
|
+
* Fix problem with autoloaded constants in Display, problem with sciruby gem
|
102
|
+
|
103
|
+
# 0.2.6 (2015-06-21)
|
104
|
+
|
105
|
+
* Check registered kernel and Gemfile to prevent gem loading problems
|
106
|
+
* Support to_tex method for the rendering
|
107
|
+
|
108
|
+
# 0.2.5 (2015-06-07)
|
109
|
+
|
110
|
+
* Fix #29, empty signatures
|
111
|
+
* Move iruby utils to IRuby::Utils module
|
112
|
+
* Add IRuby.tex alias for IRuby.latex
|
113
|
+
* Remove example notebooks from gem
|
114
|
+
|
115
|
+
# 0.2.4 (2015-06-02)
|
116
|
+
|
117
|
+
* Better exception handling
|
118
|
+
* Fix ctrl-C issue #17
|
119
|
+
* Fix timeout issue #19
|
120
|
+
|
121
|
+
# 0.2.3 (2015-05-31)
|
122
|
+
|
123
|
+
* Fix notebook indentation
|
124
|
+
* Fix tab completion for multiple lines
|
125
|
+
|
126
|
+
# 0.2.2 (2015-05-26)
|
127
|
+
|
128
|
+
* Support history variables In, Out, _, _i etc
|
129
|
+
* Internal refactoring and minor bugfixes
|
130
|
+
|
131
|
+
# 0.2.1 (2015-05-26)
|
132
|
+
|
133
|
+
* Copy Ruby logo to kernel specification
|
134
|
+
|
135
|
+
# 0.2.0 (2015-05-25)
|
136
|
+
|
137
|
+
* Dropped IPython2 support
|
138
|
+
* Dropped Ruby < 2.0.0 support
|
139
|
+
* Supports and requires now IPython3/Jupyter
|
140
|
+
* Switch from ffi-rzmq to rbczmq
|
141
|
+
* Added IRuby::Conn (experimental, to be used by widgets)
|
142
|
+
* iruby register/unregister commands to register IRuby kernel in Jupyter
|
143
|
+
|
144
|
+
# 0.1.13 (2014-08-19)
|
145
|
+
|
146
|
+
* Improved IRuby.table, supports :maxrows and :maxcols
|
147
|
+
* IRuby#javascript workaround (https://github.com/ipython/ipython/issues/6259)
|
148
|
+
|
149
|
+
# 0.1.12 (2014-08-01)
|
150
|
+
|
151
|
+
* IRuby#table add option maxrows
|
152
|
+
* powerful display system with format and datatype registry, see #25
|
153
|
+
* Add IRuby#javascript
|
154
|
+
* Add IRuby#svg
|
155
|
+
|
156
|
+
# 0.1.11 (2014-07-08)
|
157
|
+
|
158
|
+
* Push binding if pry binding stack is empty
|
159
|
+
|
160
|
+
# 0.1.10 (2014-07-08)
|
161
|
+
|
162
|
+
* Fix #19 (pp)
|
163
|
+
* Handle exception when symlink cannot be created
|
164
|
+
* Fix dependencies and Pry backend
|
165
|
+
|
166
|
+
# 0.1.9 (2014-02-28)
|
167
|
+
|
168
|
+
* Check IPython version
|
169
|
+
|
170
|
+
# 0.1.7/0.1.8
|
171
|
+
|
172
|
+
* Bugfixes #11, #12, #13
|
173
|
+
|
174
|
+
# 0.1.6 (2013-10-11)
|
175
|
+
|
176
|
+
* Print Matrix and GSL::Matrix as LaTeX
|
177
|
+
* Add check for Pry version
|
178
|
+
|
179
|
+
# 0.1.5 (2013-10-03)
|
180
|
+
|
181
|
+
* Implement a rich display system
|
182
|
+
* Fix error output
|
183
|
+
|
184
|
+
# 0.1.4 (2013-10-03)
|
185
|
+
|
186
|
+
* Extract display handler from kernel
|
187
|
+
* Always return a text/plain response
|
188
|
+
|
189
|
+
# 0.1.3 (2013-10-03)
|
190
|
+
|
191
|
+
* Implement missing request handlers
|
192
|
+
* Detect if Bundler is running and set kernel_cmd appropriately
|
193
|
+
* Improve Pry integration
|
194
|
+
* Add support for the gems gnuplot, gruff, rmagick and mini_magick
|
195
|
+
|
196
|
+
# 0.1.2 (2013-10-02)
|
197
|
+
|
198
|
+
* Support for Pry added
|
199
|
+
* Launch `iruby console` if plain `iruby` is started
|
200
|
+
|
201
|
+
# 0.1.0 (2013-10-02)
|
202
|
+
|
203
|
+
* Cleanup and rewrite of some parts
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,134 +1,184 @@
|
|
1
|
-
***The current master branch and gem version >= 0.2 are compatible with IPython3/Jupyter. If you require IPython2 support, please install an older gem version < 0.2 or use the branch ipython2***
|
2
|
-
|
3
1
|
# IRuby
|
4
2
|
|
5
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/iruby.svg)](https://badge.fury.io/rb/iruby)
|
4
|
+
[![Build Status](https://github.com/SciRuby/iruby/workflows/CI/badge.svg)](https://github.com/SciRuby/iruby/actions)
|
5
|
+
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/RubyData/binder/master?filepath=ruby-data.ipynb)
|
6
6
|
|
7
|
-
|
7
|
+
IRuby is a Ruby kernel for [Jupyter project](http://try.jupyter.org/).
|
8
8
|
|
9
|
-
|
10
|
-
The installation instructions are divided according to environments mainly because of ZeroMQ.
|
9
|
+
## Try IRuby
|
11
10
|
|
12
|
-
|
13
|
-
At first install IPython/Jupyter. I recommend an installation using virtualenv.
|
11
|
+
You can try IRuby with a sample notebook on Binder (the same link as the banner placed above):
|
14
12
|
|
15
|
-
|
16
|
-
virtualenv -p python3 venv
|
17
|
-
source venv/bin/activate
|
18
|
-
pip install 'ipython[notebook]'
|
13
|
+
https://mybinder.org/v2/gh/RubyData/binder/master?filepath=ruby-data.ipynb
|
19
14
|
|
20
|
-
|
15
|
+
The following URL launches JupyterLab directly on Binder.
|
21
16
|
|
22
|
-
|
23
|
-
gem install iruby
|
17
|
+
https://mybinder.org/v2/gh/RubyData/binder/master?filepath=../lab
|
24
18
|
|
25
|
-
|
19
|
+
## Installation
|
26
20
|
|
27
|
-
|
21
|
+
### Requirements
|
28
22
|
|
29
|
-
|
30
|
-
|
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)
|
31
27
|
|
32
|
-
|
28
|
+
If both ffi-rzmq and cztop are installed, ffi-rzmq is used. If you prefer cztop, set the following environment variable.
|
33
29
|
|
34
|
-
|
35
|
-
|
30
|
+
```sh
|
31
|
+
export IRUBY_SESSION_ADAPTER="cztop"
|
32
|
+
```
|
36
33
|
|
37
|
-
|
34
|
+
* [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).
|
38
36
|
|
39
|
-
|
37
|
+
```
|
38
|
+
gem specific_install https://github.com/SciRuby/iruby
|
39
|
+
```
|
40
40
|
|
41
|
-
|
42
|
-
I recommend an installation using [Anaconda](https://store.continuum.io/cshop/anaconda/).
|
41
|
+
### Ubuntu
|
43
42
|
|
44
|
-
|
43
|
+
Install Jupyter.
|
45
44
|
|
46
|
-
|
47
|
-
gem install cztop
|
48
|
-
gem install iruby
|
45
|
+
#### Ubuntu 17+
|
49
46
|
|
50
|
-
|
47
|
+
```shell
|
48
|
+
sudo apt install libtool libffi-dev ruby ruby-dev make
|
49
|
+
sudo apt install libzmq3-dev libczmq-dev
|
51
50
|
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
gem install ffi-rzmq
|
52
|
+
gem install iruby --pre
|
53
|
+
iruby register --force
|
54
|
+
```
|
55
55
|
|
56
|
-
|
57
|
-
2. replace LIBDEPENDS line in ports/net/py-pyzmq/Makefile
|
56
|
+
#### Ubuntu 16
|
58
57
|
|
59
|
-
|
60
|
-
LIB_DEPENDS= libzmq.so:${PORTSDIR}/net/libzmq4
|
61
|
-
```
|
62
|
-
with
|
63
|
-
```shell
|
64
|
-
LIB_DEPENDS= libzmq.so:${PORTSDIR}/net/libzmq3
|
65
|
-
```
|
66
|
-
3. install related packages
|
58
|
+
CZTop requires CZMQ >= 4.0.0 and ZMQ >= 4.2.0. The official packages for Ubuntu 16.04 don't satisfy these version requrements, so you need to install from source.
|
67
59
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
60
|
+
```shell
|
61
|
+
sudo apt install libtool libffi-dev ruby ruby-dev make
|
62
|
+
sudo apt install git libzmq-dev autoconf pkg-config
|
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
|
69
|
+
iruby register --force
|
70
|
+
```
|
71
|
+
|
72
|
+
### Windows
|
73
|
+
|
74
|
+
Install git and Jupyter.
|
75
|
+
[DevKit](https://rubyinstaller.org/add-ons/devkit.html) is necessary for building RubyGems with native C-based extensions.
|
76
|
+
|
77
|
+
Install ZeroMQ.
|
78
|
+
```shell
|
79
|
+
pacman -S mingw64/mingw-w64-x86_64-zeromq
|
80
|
+
```
|
81
|
+
|
82
|
+
```shell
|
83
|
+
gem install ffi-rzmq
|
84
|
+
gem install iruby --pre
|
85
|
+
iruby register --force
|
86
|
+
```
|
87
|
+
|
88
|
+
### macOS
|
89
|
+
|
90
|
+
Install ruby with rbenv or rvm.
|
91
|
+
Install Jupyter.
|
92
|
+
|
93
|
+
#### Homebrew
|
94
|
+
|
95
|
+
```shell
|
96
|
+
brew install automake gmp libtool wget
|
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
|
107
|
+
iruby register --force
|
108
|
+
```
|
72
109
|
|
73
|
-
|
74
|
-
$ cd /usr/ports/net/py-pyzmq
|
75
|
-
$ sudo make install
|
76
|
-
$ cd /usr/ports/devel/ipython
|
77
|
-
$ sudo make install
|
78
|
-
```
|
79
|
-
Then, install iruby and related ports and gems.
|
80
|
-
```shell
|
81
|
-
$ sudo pkg install rubygem-mimemagic
|
82
|
-
$ sudo gem install ffi-rzmq # install ffi, ffi-rzmq-core and ffi-rzmq
|
83
|
-
$ git clone https://github.com/SciRuby/iruby.git
|
84
|
-
$ cd iruby
|
85
|
-
$ gem build iruby.gemspec
|
86
|
-
$ sudo gem install iruby-0.2.7.gem
|
87
|
-
```
|
88
|
-
### Installation for jRuby
|
110
|
+
#### MacPorts
|
89
111
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
112
|
+
If you are using macports, run the following commands.
|
113
|
+
|
114
|
+
```shell
|
115
|
+
port install libtool autoconf automake autogen
|
116
|
+
gem install ffi-rzmq
|
117
|
+
gem install iruby
|
118
|
+
```
|
119
|
+
|
120
|
+
### Docker
|
121
|
+
|
122
|
+
Try [RubyData Docker Stacks](https://github.com/RubyData/docker-stacks).
|
123
|
+
Running jupyter notebook:
|
124
|
+
|
125
|
+
```shell
|
126
|
+
docker run -p 8888:8888 rubydata/datascience-notebook
|
127
|
+
```
|
128
|
+
|
129
|
+
### Installation for JRuby
|
130
|
+
|
131
|
+
You can use Java classes in your IRuby notebook.
|
132
|
+
|
133
|
+
* JRuby version >= 9.0.4.0
|
94
134
|
* cztop gem
|
95
|
-
*
|
135
|
+
* iruby gem
|
136
|
+
|
137
|
+
After installation, make sure that your `env` is set up to use jruby.
|
96
138
|
|
97
|
-
After installation, make sure that your `env` is set up to jruby.
|
98
139
|
```shell
|
99
140
|
$ env ruby -v
|
100
141
|
```
|
142
|
+
|
101
143
|
If you use RVM, it is enough to switch the current version to jruby.
|
102
|
-
|
144
|
+
|
145
|
+
If you have already used IRuby with a different version, you need to generate a new kernel:
|
146
|
+
|
103
147
|
```shell
|
104
148
|
$ iruby register --force
|
105
149
|
```
|
106
|
-
After that you can use iruby with jRuby in usual way.
|
107
150
|
|
108
|
-
|
151
|
+
## Backends
|
109
152
|
|
110
|
-
|
111
|
-
and the [collection of notebooks](https://github.com/SciRuby/sciruby-notebooks/) which includes a Dockerfile to create a containerized installation of iruby
|
112
|
-
and other scientific gems. You can find the prebuild image at [dockerhub](https://registry.hub.docker.com/u/minad/sciruby-notebooks/).
|
153
|
+
There are two backends: PlainBackend and PryBackend.
|
113
154
|
|
155
|
+
* PlainBackend is the default backend. It uses [IRB](https://github.com/ruby/irb).
|
156
|
+
* PryBackend uses [Pry][Pry].
|
114
157
|
|
115
|
-
|
158
|
+
You can switch the backend to PryBackend by running the code below.
|
116
159
|
|
117
|
-
|
118
|
-
|
160
|
+
```ruby
|
161
|
+
IRuby::Kernel.instance.switch_backend!(:pry)
|
162
|
+
```
|
163
|
+
|
164
|
+
## Notebooks
|
165
|
+
|
166
|
+
Take a look at the [example notebook](http://nbviewer.ipython.org/urls/raw.github.com/SciRuby/sciruby-notebooks/master/getting_started.ipynb)
|
167
|
+
and the [collection of notebooks](https://github.com/SciRuby/sciruby-notebooks/) which includes a Dockerfile to create a containerized installation of iruby
|
168
|
+
and other scientific gems. You can find the prebuild image at [dockerhub](https://registry.hub.docker.com/u/minad/sciruby-notebooks/).
|
119
169
|
|
120
|
-
|
170
|
+
## Contributing
|
121
171
|
|
122
|
-
|
172
|
+
Contributions to IRuby are very welcome.
|
123
173
|
|
124
|
-
|
174
|
+
To former contributors
|
125
175
|
|
126
|
-
|
176
|
+
In February 2021, [IRuby became the canonical repository](https://github.com/SciRuby/iruby/issues/285) and is no longer a fork from [minrk/iruby](https://github.com/minrk/iruby). Please fork from this repository again before making pull requests.
|
127
177
|
|
128
|
-
|
178
|
+
## License
|
129
179
|
|
130
|
-
Copyright
|
180
|
+
Copyright (c) IRuby contributors and the Ruby Science Foundation.
|
131
181
|
|
132
|
-
|
182
|
+
Licensed under the [MIT](LICENSE) license.
|
133
183
|
|
134
|
-
|
184
|
+
[Pry]: https://github.com/pry/pry
|