iruby 0.3 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ubuntu.yml +62 -0
  3. data/CHANGES.md +203 -0
  4. data/Gemfile +3 -1
  5. data/LICENSE +1 -1
  6. data/README.md +137 -87
  7. data/Rakefile +36 -10
  8. data/ci/Dockerfile.base.erb +41 -0
  9. data/ci/Dockerfile.main.erb +7 -0
  10. data/ci/requirements.txt +1 -0
  11. data/docker/setup.sh +15 -0
  12. data/docker/test.sh +7 -0
  13. data/iruby.gemspec +14 -18
  14. data/lib/iruby.rb +14 -8
  15. data/lib/iruby/backend.rb +38 -10
  16. data/lib/iruby/command.rb +67 -15
  17. data/lib/iruby/display.rb +77 -41
  18. data/lib/iruby/event_manager.rb +40 -0
  19. data/lib/iruby/formatter.rb +3 -3
  20. data/lib/iruby/input.rb +6 -6
  21. data/lib/iruby/input/README.md +299 -0
  22. data/lib/iruby/input/autoload.rb +1 -1
  23. data/lib/iruby/input/builder.rb +4 -4
  24. data/lib/iruby/input/button.rb +2 -2
  25. data/lib/iruby/input/cancel.rb +1 -1
  26. data/lib/iruby/input/checkbox.rb +3 -3
  27. data/lib/iruby/input/date.rb +3 -3
  28. data/lib/iruby/input/field.rb +2 -2
  29. data/lib/iruby/input/file.rb +3 -3
  30. data/lib/iruby/input/form.rb +6 -6
  31. data/lib/iruby/input/label.rb +4 -4
  32. data/lib/iruby/input/multiple.rb +10 -10
  33. data/lib/iruby/input/popup.rb +2 -2
  34. data/lib/iruby/input/radio.rb +6 -6
  35. data/lib/iruby/input/select.rb +8 -8
  36. data/lib/iruby/input/textarea.rb +1 -1
  37. data/lib/iruby/input/widget.rb +2 -2
  38. data/lib/iruby/jupyter.rb +77 -0
  39. data/lib/iruby/kernel.rb +204 -36
  40. data/lib/iruby/ostream.rb +29 -8
  41. data/lib/iruby/session.rb +117 -0
  42. data/lib/iruby/session/cztop.rb +4 -0
  43. data/lib/iruby/session_adapter.rb +72 -0
  44. data/lib/iruby/session_adapter/cztop_adapter.rb +45 -0
  45. data/lib/iruby/session_adapter/ffirzmq_adapter.rb +55 -0
  46. data/lib/iruby/session_adapter/pyzmq_adapter.rb +77 -0
  47. data/lib/iruby/session_adapter/test_adapter.rb +49 -0
  48. data/lib/iruby/utils.rb +13 -2
  49. data/lib/iruby/version.rb +1 -1
  50. data/run-test.sh +12 -0
  51. data/tasks/ci.rake +65 -0
  52. data/test/helper.rb +136 -0
  53. data/test/integration_test.rb +22 -11
  54. data/test/iruby/backend_test.rb +37 -0
  55. data/test/iruby/command_test.rb +207 -0
  56. data/test/iruby/event_manager_test.rb +92 -0
  57. data/test/iruby/jupyter_test.rb +27 -0
  58. data/test/iruby/kernel_test.rb +185 -0
  59. data/test/iruby/mime_test.rb +50 -0
  60. data/test/iruby/multi_logger_test.rb +1 -5
  61. data/test/iruby/session_adapter/cztop_adapter_test.rb +20 -0
  62. data/test/iruby/session_adapter/ffirzmq_adapter_test.rb +20 -0
  63. data/test/iruby/session_adapter/session_adapter_test_base.rb +27 -0
  64. data/test/iruby/session_adapter_test.rb +91 -0
  65. data/test/iruby/session_test.rb +48 -0
  66. data/test/run-test.rb +19 -0
  67. metadata +120 -50
  68. data/.travis.yml +0 -16
  69. data/CHANGES +0 -143
  70. data/CONTRIBUTORS +0 -19
  71. data/lib/iruby/session/rbczmq.rb +0 -68
  72. data/test/test_helper.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 535b2e6920da18e1d6610cda01d192814a5f9595
4
- data.tar.gz: 401889f3e858262e478fa15a3c709bcd6d09bd16
2
+ SHA256:
3
+ metadata.gz: 14aea673b75a6fe8884eff08c52b8831bbcec141df2525ed4c0a877738654271
4
+ data.tar.gz: 89e5e091e67b7ef85f98ca0cb9ebe65cef0e32aacd75351c81b0c287666939c0
5
5
  SHA512:
6
- metadata.gz: 5d35b89326c32a1dcb52fc2242e366b693ffcac70b3b0ad232233010a6cd1de7c894429c724fb96a766ed35d995465c7b61e3274c7836639a8afd7a9fa56f0e9
7
- data.tar.gz: 423d15b33c265bd943b5811fb3993f79d2da741790948f9efdd5890ca0f755f94d9fdb51ee78faf5adfa612a30d031e4014758725322f4fe22fd099c37a093c4
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
@@ -10,6 +10,8 @@ end
10
10
  group :plot do
11
11
  gem 'gnuplot'
12
12
  gem 'rubyvis'
13
- gem 'nyaplot', github: 'sciruby/nyaplot'
14
13
  end
15
14
 
15
+ group :test do
16
+ gem 'cztop'
17
+ end
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013-2015 IRuby contributors and the Ruby Science Foundation
1
+ Copyright (c) 2013 - present IRuby contributors and the Ruby Science Foundation
2
2
 
3
3
  MIT License
4
4
 
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
- This is a Ruby kernel for IPython/Jupyter and is part of [SciRuby](http://sciruby.com/). You can try it at [try.jupyter.org](http://try.jupyter.org/).
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
- ![Screenshot](https://cloud.githubusercontent.com/assets/50754/7956845/3fa46df8-09e3-11e5-8641-f5b8669061b5.png)
7
+ IRuby is a Ruby kernel for [Jupyter project](http://try.jupyter.org/).
8
8
 
9
- ### Quick start
10
- The installation instructions are divided according to environments mainly because of ZeroMQ.
9
+ ## Try IRuby
11
10
 
12
- #### Ubuntu/Debian
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
- sudo apt-get install python3-dev python-virtualenv
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
- After that, install the Ruby gem.
15
+ The following URL launches JupyterLab directly on Binder.
21
16
 
22
- gem install cztop
23
- gem install iruby
17
+ https://mybinder.org/v2/gh/RubyData/binder/master?filepath=../lab
24
18
 
25
- Now you can run iruby with:
19
+ ## Installation
26
20
 
27
- iruby notebook
21
+ ### Requirements
28
22
 
29
- #### Windows
30
- At first install IPython/Jupyter. I recommend an installation using [Enthought Canopy](https://www.enthought.com/).
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
- Run two commands below:
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
- gem install cztop
35
- gem install iruby
30
+ ```sh
31
+ export IRUBY_SESSION_ADAPTER="cztop"
32
+ ```
36
33
 
37
- Now you can run iruby with:
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
- iruby notebook
37
+ ```
38
+ gem specific_install https://github.com/SciRuby/iruby
39
+ ```
40
40
 
41
- #### Mac
42
- I recommend an installation using [Anaconda](https://store.continuum.io/cshop/anaconda/).
41
+ ### Ubuntu
43
42
 
44
- After that, run three commands shown below.
43
+ Install Jupyter.
45
44
 
46
- brew install libtool autoconf automake autogen
47
- gem install cztop
48
- gem install iruby
45
+ #### Ubuntu 17+
49
46
 
50
- #### FreeBSD
47
+ ```shell
48
+ sudo apt install libtool libffi-dev ruby ruby-dev make
49
+ sudo apt install libzmq3-dev libczmq-dev
51
50
 
52
- At first install IPython/Jupyter.
53
- There is a pyzmq ports (ports/net/py-pyzmq) which depends on libzmq4, however, it doesn't works with ipython.
54
- Therefore we use libzmq3 like the following:
51
+ gem install ffi-rzmq
52
+ gem install iruby --pre
53
+ iruby register --force
54
+ ```
55
55
 
56
- 1. make your ports tree up-to-date.
57
- 2. replace LIBDEPENDS line in ports/net/py-pyzmq/Makefile
56
+ #### Ubuntu 16
58
57
 
59
- ```shell
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
- ```shell
69
- $ sudo pkg install libzmq3 py27-qt4-gui py27-pexpect-3.3 py27-qt4-svg py27-pygments py27-Jinja2 py27-tornado py27-jsonschema
70
- ```
71
- 4. make install using ports
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
- ```shell
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
- Since jRuby is fully compatible with Ruby version 2.2, it is possible to use iruby with jRuby.
91
- It can be helpful if you want to use java classes in your iruby notebook.
92
- This will require the following software:
93
- * jRuby version >= 9.0.4.0
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
- * this iruby gem
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
- If you have already used iruby with a different version, you need to generate a new kernel:
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
- ### After the installation
151
+ ## Backends
109
152
 
110
- Take a look at the [example notebook](http://nbviewer.ipython.org/urls/raw.github.com/SciRuby/sciruby-notebooks/master/getting_started.ipynb)
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
- ### Required dependencies
158
+ You can switch the backend to PryBackend by running the code below.
116
159
 
117
- * IPython/Jupyter >= 3.0.0
118
- * Ruby >= 2.1.0
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
- If you install IRuby with CZTop, CZMQ >= 4.0.0 is added to the list above.
170
+ ## Contributing
121
171
 
122
- If you install IRuby with ffi-rzmq, libzmq >= 3.2 is added to the list above.
172
+ Contributions to IRuby are very welcome.
123
173
 
124
- ### Authors
174
+ To former contributors
125
175
 
126
- See the [CONTRIBUTORS](CONTRIBUTORS) file.
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
- ### License
178
+ ## License
129
179
 
130
- Copyright © 2013-15, IRuby contributors and the Ruby Science Foundation.
180
+ Copyright (c) IRuby contributors and the Ruby Science Foundation.
131
181
 
132
- All rights reserved.
182
+ Licensed under the [MIT](LICENSE) license.
133
183
 
134
- IRuby, along with [SciRuby](http://sciruby.com/), is licensed under the MIT license. See the [LICENSE](LICENSE) file for details.
184
+ [Pry]: https://github.com/pry/pry