Skip to content

Commit 112eb31

Browse files
authored
Merge branch 'master' into markdown_fix
2 parents 81c89a5 + 72126af commit 112eb31

38 files changed

+1752
-137
lines changed

.travis.yml

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,41 @@
1+
sudo: required
2+
13
language: ruby
24

3-
addons:
4-
apt:
5-
sources:
6-
- sourceline: 'deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-draft/xUbuntu_12.04/ ./'
7-
key_url: 'http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-draft/xUbuntu_12.04/Release.key'
8-
packages:
9-
- libsodium-dev
10-
- libczmq-dev
11-
12-
rvm:
13-
- ruby-head
14-
- 2.4.0
15-
- 2.3.1
16-
- 2.2.5
17-
- 2.1.10
5+
services:
6+
- docker
187

198
before_install:
20-
- "sudo pip install 'jupyter'"
9+
- docker images
10+
- rake ci:docker:before_install
11+
12+
install:
13+
- rake ci:docker:install
14+
- docker images
15+
16+
after_install:
17+
- rake ci:docker:install
18+
- docker images
19+
20+
script: rake ci:docker:script
2121

22-
script: bundle exec rake
22+
matrix:
23+
include:
24+
- name: "Ruby trunk-nightly"
25+
env:
26+
- ruby_version=trunk-nightly
27+
- name: "Ruby 2.6"
28+
env:
29+
- ruby_version=2.6.1
30+
- name: "Ruby 2.5"
31+
env:
32+
- ruby_version=2.5.3
33+
- name: "Ruby 2.4"
34+
env:
35+
- ruby_version=2.4.5
36+
- name: "Ruby 2.3"
37+
env:
38+
- ruby_version=2.3.8
2339

24-
notifications:
25-
irc: "chat.freenode.net#sciruby"
40+
allow_failures:
41+
- name: "Ruby trunk-nightly"

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ end
1515

1616
group :test do
1717
gem 'cztop'
18+
gem 'rbczmq'
1819
end

README.md

Lines changed: 81 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
# IRuby
22

3-
This is a Ruby kernel for 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://travis-ci.org/SciRuby/iruby.svg?branch=master)](https://travis-ci.org/SciRuby/iruby)
45

5-
![Screenshot](https://cloud.githubusercontent.com/assets/50754/7956845/3fa46df8-09e3-11e5-8641-f5b8669061b5.png)
6+
IRuby is a Ruby kernel for [Jupyter project](http://try.jupyter.org/).
67

7-
## Quick start
8-
The installation instructions are divided according to environments mainly because of ZeroMQ.
8+
## Installation
9+
How to set up [ZeroMQ](http://zeromq.org/) depends on your environment.
10+
You can use one of the following libraries.
11+
* [CZTop](https://gitlab.com/paddor/cztop) and [CZMQ](https://github.com/zeromq/czmq) >= 4.0.0
12+
* [ffi-rzmq](https://github.com/chuckremes/ffi-rzmq) and [libzmq
13+
](https://github.com/zeromq/libzmq) >= 3.2
914

1015
### Ubuntu
11-
At first install Jupyter. I recommend an installation using [Anaconda](https://www.continuum.io/downloads) Python 3.6 version.
16+
Install Jupyter with [Anaconda](https://www.anaconda.com/) (recommended).
1217

13-
#### Preparing dependencies on 16.04
14-
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.
18+
#### Setup ZeroMQ on Ubuntu 16.04
19+
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.
1520

1621
```shell
1722
sudo apt install libtool libffi-dev ruby ruby-dev make
@@ -21,59 +26,56 @@ cd czmq
2126
./autogen.sh && ./configure && sudo make && sudo make install
2227
```
2328

24-
#### Preparing dependencies on 17.04
25-
In 17.04, you can use official packages.
29+
#### Setup ZeroMQ on Ubuntu 17.04 to 18.10
30+
Use official packages.
2631

2732
```shell
2833
sudo apt install libtool libffi-dev ruby ruby-dev make
2934
sudo apt install libzmq3-dev libczmq-dev
3035
```
3136

32-
#### Version-independent things
33-
After preparing dependencies, install the Ruby gem.
34-
37+
#### Install CZTop and IRuby
3538
```shell
36-
gem install cztop iruby
39+
gem install cztop
40+
gem install iruby --pre
3741
iruby register --force
3842
```
3943

40-
Now you can select Ruby kernel in Jupyter Notebook with:
41-
42-
jupyter-notebook
43-
4444
### Windows
45-
At first install **git** and Jupyter. I recommend an installation using [Anaconda](https://www.continuum.io/downloads).
46-
47-
Run the following commands on **Ruby command prompt**:
45+
Install git and Jupyter with [Anaconda](https://www.anaconda.com/) (recommended).
46+
[DevKit](https://rubyinstaller.org/add-ons/devkit.html) is necessary for building RubyGems with native C-based extensions.
4847

4948
```shell
5049
gem install cztop
51-
gem install iruby
50+
gem install iruby --pre
5251
iruby register --force
5352
```
5453

55-
Now you can select Ruby kernel in Jupyter Notebook with:
54+
### macOS
55+
Install ruby with rbenv or rvm.
56+
Install Jupyter with [Anaconda](https://www.anaconda.com/) (recommended).
5657

57-
jupyter-notebook
58-
59-
### Mac
60-
I recommend an installation using [Anaconda](https://www.continuum.io/downloads).
58+
#### Homebrew
59+
```shell
60+
brew install automake gmp libtool wget
61+
brew install zeromq --HEAD
62+
brew install czmq --HEAD
63+
```
6164

62-
After that, run the following commands.
65+
Setup environment variables.
66+
```
67+
export LIBZMQ_PATH=$(brew --prefix zeromq)/lib
68+
export LIBCZMQ_PATH=$(brew --prefix czmq)/lib
69+
```
6370

6471
```shell
65-
brew install rbenv automake gmp libtool wget
66-
rbenv install 2.4.1
67-
rbenv global 2.4.1
68-
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
69-
source ~/.bashrc
70-
71-
brew install zeromq
72-
brew install czmq --HEAD
73-
gem install cztop iruby
72+
gem install cztop
73+
# gem install ffi-rzmq
74+
gem install iruby --pre
7475
iruby register --force
7576
```
7677

78+
#### MacPorts
7779
If you are using macports, run the following commands.
7880

7981
```shell
@@ -82,89 +84,80 @@ gem install ffi-rzmq
8284
gem install iruby
8385
```
8486

85-
8687
### FreeBSD
87-
8888
At first install IPython/Jupyter.
8989
There is a pyzmq ports (ports/net/py-pyzmq) which depends on libzmq4, however, it doesn't works with ipython.
9090
Therefore we use libzmq3 like the following:
9191

9292
1. make your ports tree up-to-date.
9393
2. replace LIBDEPENDS line in ports/net/py-pyzmq/Makefile
9494

95-
```shell
96-
LIB_DEPENDS= libzmq.so:${PORTSDIR}/net/libzmq4
97-
```
98-
with
99-
```shell
100-
LIB_DEPENDS= libzmq.so:${PORTSDIR}/net/libzmq3
101-
```
95+
```shell
96+
LIB_DEPENDS= libzmq.so:${PORTSDIR}/net/libzmq4
97+
```
98+
with
99+
```shell
100+
LIB_DEPENDS= libzmq.so:${PORTSDIR}/net/libzmq3
101+
```
102102
3. install related packages
103103

104-
```shell
105-
$ sudo pkg install libzmq3 py27-qt4-gui py27-pexpect-3.3 py27-qt4-svg py27-pygments py27-Jinja2 py27-tornado py27-jsonschema
106-
```
104+
```shell
105+
sudo pkg install libzmq3 py27-qt4-gui py27-pexpect-3.3 py27-qt4-svg py27-pygments py27-Jinja2 py27-tornado py27-jsonschema
106+
```
107107
4. make install using ports
108108

109-
```shell
110-
$ cd /usr/ports/net/py-pyzmq
111-
$ sudo make install
112-
$ cd /usr/ports/devel/ipython
113-
$ sudo make install
114-
```
115-
Then, install iruby and related ports and gems.
116-
```shell
117-
$ sudo pkg install rubygem-mimemagic
118-
$ sudo gem install ffi-rzmq # install ffi, ffi-rzmq-core and ffi-rzmq
119-
$ git clone https://github.com/SciRuby/iruby.git
120-
$ cd iruby
121-
$ gem build iruby.gemspec
122-
$ sudo gem install iruby-0.2.7.gem
123-
```
124-
## Installation for jRuby
125-
126-
Since jRuby is fully compatible with Ruby version 2.2, it is possible to use iruby with jRuby.
127-
It can be helpful if you want to use java classes in your iruby notebook.
128-
This will require the following software:
129-
* jRuby version >= 9.0.4.0
109+
```shell
110+
cd /usr/ports/net/py-pyzmq
111+
sudo make install
112+
cd /usr/ports/devel/ipython
113+
sudo make install
114+
```
115+
Then, install IRuby and related ports and gems.
116+
```shell
117+
sudo pkg install rubygem-mimemagic
118+
sudo gem install ffi-rzmq # install ffi, ffi-rzmq-core and ffi-rzmq
119+
git clone https://github.com/SciRuby/iruby.git
120+
cd iruby
121+
gem build iruby.gemspec
122+
sudo gem install iruby-0.2.7.gem
123+
```
124+
125+
### Installation for JRuby
126+
127+
You can use Java classes in your IRuby notebook.
128+
129+
* JRuby version >= 9.0.4.0
130130
* cztop gem
131-
* this iruby gem
131+
* iruby gem
132+
133+
After installation, make sure that your `env` is set up to use jruby.
132134

133-
After installation, make sure that your `env` is set up to jruby.
134135
```shell
135136
$ env ruby -v
136137
```
138+
137139
If you use RVM, it is enough to switch the current version to jruby.
138-
If you have already used iruby with a different version, you need to generate a new kernel:
140+
141+
If you have already used IRuby with a different version, you need to generate a new kernel:
142+
139143
```shell
140144
$ iruby register --force
141145
```
142-
After that you can use iruby with jRuby in usual way.
143-
144-
## After the installation
145146

147+
## Notebooks
146148
Take a look at the [example notebook](http://nbviewer.ipython.org/urls/raw.github.com/SciRuby/sciruby-notebooks/master/getting_started.ipynb)
147149
and the [collection of notebooks](https://github.com/SciRuby/sciruby-notebooks/) which includes a Dockerfile to create a containerized installation of iruby
148150
and other scientific gems. You can find the prebuild image at [dockerhub](https://registry.hub.docker.com/u/minad/sciruby-notebooks/).
149151

150-
151-
## Required dependencies
152-
153-
* Jupyter >= 3.0.0
154-
* Ruby >= 2.1.0
155-
156-
If you install IRuby with CZTop, CZMQ >= 4.0.0 is added to the list above.
157-
158-
If you install IRuby with ffi-rzmq, libzmq >= 3.2 is added to the list above.
152+
## Contributing
153+
We welcome contributions from everyone.
159154

160155
## Authors
161-
162156
See the [CONTRIBUTORS](CONTRIBUTORS) file.
163157

164158
## License
165-
166-
Copyright © 2013-15, IRuby contributors and the Ruby Science Foundation.
159+
Copyright © 2013-19, IRuby contributors and the Ruby Science Foundation.
167160

168161
All rights reserved.
169162

170-
IRuby, along with [SciRuby](http://sciruby.com/), is licensed under the MIT license. See the [LICENSE](LICENSE) file for details.
163+
IRuby, along with [SciRuby](http://sciruby.com/), is licensed under the MIT license. See the [LICENSE](LICENSE) file.

Rakefile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ begin
55
rescue Exception
66
end
77

8+
FileList['tasks/**.rake'].each {|f| load f }
9+
810
Rake::TestTask.new('test') do |t|
911
t.libs << 'lib'
1012
t.libs << 'test'
@@ -13,3 +15,27 @@ Rake::TestTask.new('test') do |t|
1315
end
1416

1517
task default: 'test'
18+
19+
namespace :docker do
20+
def root_dir
21+
@root_dir ||= File.expand_path("..", __FILE__)
22+
end
23+
24+
task :build do
25+
container_name = "iruby_build"
26+
image_name = "mrkn/iruby"
27+
sh "docker", "run",
28+
"--name", container_name,
29+
"-v", "#{root_dir}:/tmp/iruby",
30+
"rubylang/ruby", "/bin/bash", "/tmp/iruby/docker/setup.sh"
31+
sh "docker", "commit", container_name, image_name
32+
sh "docker", "rm", container_name
33+
end
34+
35+
task :test do
36+
root_dir = File.expand_path("..", __FILE__)
37+
sh "docker", "run", "-it", "--rm",
38+
"-v", "#{root_dir}:/tmp/iruby",
39+
"mrkn/iruby", "/bin/bash", "/tmp/iruby/docker/test.sh"
40+
end
41+
end

ci/Dockerfile.base.erb

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM rubylang/ruby:<%= ruby_version %>-bionic
2+
3+
ADD ci/requirements.txt /tmp
4+
5+
RUN apt-get update \
6+
&& apt-get install -y --no-install-recommends \
7+
libczmq-dev \
8+
python3 \
9+
python3-pip \
10+
python3-setuptools \
11+
libpython3.6 \
12+
&& pip3 install wheel \
13+
&& pip3 install -r /tmp/requirements.txt \
14+
&& rm -f /tmp/requirements.txt
15+
16+
# ZeroMQ version 4.1.6 and CZMQ version 3.0.2 for rbczmq
17+
RUN apt-get update \
18+
&& apt-get install -y --no-install-recommends \
19+
build-essential \
20+
file \
21+
wget \
22+
&& cd /tmp \
23+
&& wget https://github.com/zeromq/zeromq4-1/releases/download/v4.1.6/zeromq-4.1.6.tar.gz \
24+
&& wget https://archive.org/download/zeromq_czmq_3.0.2/czmq-3.0.2.tar.gz \
25+
&& tar xf zeromq-4.1.6.tar.gz \
26+
&& tar xf czmq-3.0.2.tar.gz \
27+
&& \
28+
( \
29+
cd zeromq-4.1.6 \
30+
&& ./configure \
31+
&& make install \
32+
) \
33+
&& \
34+
( \
35+
cd czmq-3.0.2 \
36+
&& wget -O 1.patch https://github.com/zeromq/czmq/commit/2594d406d8ec6f54e54d7570d7febba10a6906b2.diff \
37+
&& wget -O 2.patch https://github.com/zeromq/czmq/commit/b651cb479235751b22b8f9a822a2fc6bc1be01ab.diff \
38+
&& cat *.patch | patch -p1 \
39+
&& ./configure \
40+
&& make install \
41+
)

0 commit comments

Comments
 (0)