iruby 0.1.13 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +13 -0
- data/CHANGES +9 -0
- data/CONTRIBUTORS +7 -1
- data/Gemfile +1 -4
- data/IRuby-Example.ipynb +3826 -3240
- data/{LICENSE → LICENSE.txt} +1 -1
- data/README.rdoc +45 -0
- data/Rakefile +2 -0
- data/bin/iruby +0 -1
- data/examples/display.ipynb +116 -106
- data/examples/stdout.ipynb +91 -93
- data/examples/table.ipynb +307 -282
- data/iruby.gemspec +12 -9
- data/lib/iruby.rb +2 -1
- data/lib/iruby/backend.rb +5 -5
- data/lib/iruby/comm.rb +60 -0
- data/lib/iruby/command.rb +68 -53
- data/lib/iruby/display.rb +4 -10
- data/lib/iruby/formatter.rb +11 -13
- data/lib/iruby/kernel.rb +69 -57
- data/lib/iruby/logger.rb +17 -0
- data/lib/iruby/ostream.rb +11 -9
- data/lib/iruby/session.rb +21 -24
- data/lib/iruby/utils.rb +2 -2
- data/lib/iruby/version.rb +1 -1
- data/{lib/iruby/static/base/images → logo}/favicon.ico +0 -0
- data/{lib/iruby/static/base/images/ipynblogo.png → logo/iruby.png} +0 -0
- data/{lib/iruby/static/base/images/src/ipynblogo.svg → logo/iruby.svg} +0 -0
- data/{lib/iruby/static/base/images/src → logo}/ruby.svg +0 -0
- data/test/integration_test.rb +41 -0
- data/test/iruby/multi_logger_test.rb +15 -0
- data/test/test_helper.rb +5 -0
- metadata +51 -35
- data/README.md +0 -24
- data/lib/iruby/static/custom/custom.css +0 -40
- data/lib/iruby/static/custom/custom.js +0 -15
data/{LICENSE → LICENSE.txt}
RENAMED
data/README.rdoc
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
<b>The current master branch and gem version >= 0.2 are compatible with IPython3. If you require IPython2 support, please install an older gem version < 0.2 or use the branch ipython2</b>
|
2
|
+
|
3
|
+
= IRuby
|
4
|
+
|
5
|
+
This is a Ruby kernel for IPython and is part of SciRuby[http://sciruby.com/].
|
6
|
+
|
7
|
+
link:screenshot.png
|
8
|
+
|
9
|
+
=== Quick start
|
10
|
+
|
11
|
+
At first install IPython. I recommend an installation using virtualenv.
|
12
|
+
|
13
|
+
apt-get install python3-dev virtualenv libzmq3-dev
|
14
|
+
virtualenv -p python3 venv
|
15
|
+
source venv/bin/activate
|
16
|
+
pip install 'ipython[notebook]'
|
17
|
+
|
18
|
+
After that, install the Ruby gem.
|
19
|
+
|
20
|
+
gem install iruby
|
21
|
+
|
22
|
+
Now you can run iruby with:
|
23
|
+
|
24
|
+
iruby
|
25
|
+
iruby notebook
|
26
|
+
|
27
|
+
Take a look at the Example[http://nbviewer.ipython.org/urls/raw.github.com/SciRuby/iruby/master/IRuby-Example.ipynb].
|
28
|
+
|
29
|
+
=== Required dependencies
|
30
|
+
|
31
|
+
* IPython >= 3.0.0
|
32
|
+
* libzmq >= 3.2
|
33
|
+
* Ruby >= 2.0.0
|
34
|
+
|
35
|
+
=== Authors
|
36
|
+
|
37
|
+
See the link:CONTRIBUTORS file.
|
38
|
+
|
39
|
+
=== License
|
40
|
+
|
41
|
+
Copyright © 2013-15, IRuby contributors and the Ruby Science Foundation.
|
42
|
+
|
43
|
+
All rights reserved.
|
44
|
+
|
45
|
+
IRuby, along with SciRuby[http://sciruby.com/], is licensed under the MIT license. See the link:LICENSE.txt file for details.
|
data/Rakefile
CHANGED
data/bin/iruby
CHANGED
data/examples/display.ipynb
CHANGED
@@ -1,119 +1,129 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
"language": "ruby",
|
4
|
-
"name": ""
|
5
|
-
},
|
6
|
-
"nbformat": 3,
|
7
|
-
"nbformat_minor": 0,
|
8
|
-
"worksheets": [
|
2
|
+
"cells": [
|
9
3
|
{
|
10
|
-
"
|
4
|
+
"cell_type": "code",
|
5
|
+
"execution_count": 1,
|
6
|
+
"metadata": {
|
7
|
+
"collapsed": false
|
8
|
+
},
|
9
|
+
"outputs": [
|
11
10
|
{
|
12
|
-
"
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
"data": {
|
12
|
+
"text/latex": [
|
13
|
+
"$1+2\\imath$"
|
14
|
+
],
|
15
|
+
"text/plain": [
|
16
|
+
"(1+2i)"
|
17
|
+
]
|
18
|
+
},
|
18
19
|
"metadata": {},
|
19
|
-
"
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
20
|
+
"output_type": "display_data"
|
21
|
+
}
|
22
|
+
],
|
23
|
+
"source": [
|
24
|
+
"IRuby.display(Complex(1,2))"
|
25
|
+
]
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"cell_type": "code",
|
29
|
+
"execution_count": 2,
|
30
|
+
"metadata": {
|
31
|
+
"collapsed": false
|
32
|
+
},
|
33
|
+
"outputs": [
|
34
|
+
{
|
35
|
+
"data": {
|
36
|
+
"text/latex": [
|
37
|
+
"$$\\left(\\begin{array}{cc}\n",
|
38
|
+
" 1&2\\\\\n",
|
39
|
+
" 3&4\\\\\n",
|
40
|
+
"\\end{array}\\right)$$"
|
41
|
+
],
|
42
|
+
"text/plain": [
|
43
|
+
"Matrix[[1, 2], [3, 4]]"
|
44
|
+
]
|
45
|
+
},
|
46
|
+
"metadata": {},
|
47
|
+
"output_type": "display_data"
|
33
48
|
},
|
34
49
|
{
|
35
|
-
"
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
"
|
43
|
-
|
44
|
-
|
45
|
-
|
50
|
+
"data": {
|
51
|
+
"text/latex": [
|
52
|
+
"$$\\left(\\begin{array}{cc}\n",
|
53
|
+
" 1&2\\\\\n",
|
54
|
+
" 3&4\\\\\n",
|
55
|
+
"\\end{array}\\right)$$"
|
56
|
+
],
|
57
|
+
"text/plain": [
|
58
|
+
"Matrix[[1, 2], [3, 4]]"
|
59
|
+
]
|
60
|
+
},
|
46
61
|
"metadata": {},
|
47
|
-
"
|
48
|
-
{
|
49
|
-
"latex": [
|
50
|
-
"$$\\left(\\begin{array}{cc}\n",
|
51
|
-
" 1&2\\\\\n",
|
52
|
-
" 3&4\\\\\n",
|
53
|
-
"\\end{array}\\right)$$"
|
54
|
-
],
|
55
|
-
"metadata": {},
|
56
|
-
"output_type": "pyout",
|
57
|
-
"prompt_number": 2,
|
58
|
-
"text": [
|
59
|
-
"Matrix[[1, 2], [3, 4]]"
|
60
|
-
]
|
61
|
-
},
|
62
|
-
{
|
63
|
-
"latex": [
|
64
|
-
"$$\\left(\\begin{array}{cc}\n",
|
65
|
-
" 1&2\\\\\n",
|
66
|
-
" 3&4\\\\\n",
|
67
|
-
"\\end{array}\\right)$$"
|
68
|
-
],
|
69
|
-
"metadata": {},
|
70
|
-
"output_type": "pyout",
|
71
|
-
"prompt_number": 2,
|
72
|
-
"text": [
|
73
|
-
"Matrix[[1, 2], [3, 4]]"
|
74
|
-
]
|
75
|
-
},
|
76
|
-
{
|
77
|
-
"metadata": {},
|
78
|
-
"output_type": "pyout",
|
79
|
-
"prompt_number": 2,
|
80
|
-
"text": [
|
81
|
-
"Matrix[[1, 2], [3, 4]]"
|
82
|
-
]
|
83
|
-
},
|
84
|
-
{
|
85
|
-
"metadata": {},
|
86
|
-
"output_type": "pyout",
|
87
|
-
"prompt_number": 2,
|
88
|
-
"text": [
|
89
|
-
"Matrix[[1, 2], [3, 4]]"
|
90
|
-
]
|
91
|
-
},
|
92
|
-
{
|
93
|
-
"html": [
|
94
|
-
"<table><tr><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr></table>"
|
95
|
-
],
|
96
|
-
"metadata": {},
|
97
|
-
"output_type": "pyout",
|
98
|
-
"prompt_number": 2,
|
99
|
-
"text": [
|
100
|
-
"Matrix[[1, 2], [3, 4]]"
|
101
|
-
]
|
102
|
-
}
|
103
|
-
],
|
104
|
-
"prompt_number": 2
|
62
|
+
"output_type": "display_data"
|
105
63
|
},
|
106
64
|
{
|
107
|
-
"
|
108
|
-
|
109
|
-
|
110
|
-
|
65
|
+
"data": {
|
66
|
+
"text/plain": [
|
67
|
+
"Matrix[[1, 2], [3, 4]]"
|
68
|
+
]
|
69
|
+
},
|
111
70
|
"metadata": {},
|
112
|
-
"
|
113
|
-
|
71
|
+
"output_type": "display_data"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"data": {
|
75
|
+
"text/plain": [
|
76
|
+
"Matrix[[1, 2], [3, 4]]"
|
77
|
+
]
|
78
|
+
},
|
79
|
+
"metadata": {},
|
80
|
+
"output_type": "display_data"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"data": {
|
84
|
+
"text/html": [
|
85
|
+
"<table><tr><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr></table>"
|
86
|
+
],
|
87
|
+
"text/plain": [
|
88
|
+
"Matrix[[1, 2], [3, 4]]"
|
89
|
+
]
|
90
|
+
},
|
91
|
+
"metadata": {},
|
92
|
+
"output_type": "display_data"
|
114
93
|
}
|
115
94
|
],
|
116
|
-
"
|
95
|
+
"source": [
|
96
|
+
"require 'matrix'\n",
|
97
|
+
"IRuby.display(Matrix[[1,2],[3,4]])\n",
|
98
|
+
"IRuby.display(Matrix[[1,2],[3,4]],format:'latex')\n",
|
99
|
+
"IRuby.display(Matrix[[1,2],[3,4]],'text/plain')\n",
|
100
|
+
"IRuby.display(Matrix[[1,2],[3,4]],mime:'text/plain')\n",
|
101
|
+
"IRuby.display(Matrix[[1,2],[3,4]],'html')"
|
102
|
+
]
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"cell_type": "code",
|
106
|
+
"execution_count": null,
|
107
|
+
"metadata": {
|
108
|
+
"collapsed": false
|
109
|
+
},
|
110
|
+
"outputs": [],
|
111
|
+
"source": []
|
112
|
+
}
|
113
|
+
],
|
114
|
+
"metadata": {
|
115
|
+
"kernelspec": {
|
116
|
+
"display_name": "Ruby",
|
117
|
+
"language": "ruby",
|
118
|
+
"name": "ruby"
|
119
|
+
},
|
120
|
+
"language_info": {
|
121
|
+
"file_extension": "rb",
|
122
|
+
"mimetype": "text/ruby",
|
123
|
+
"name": "ruby",
|
124
|
+
"version": "2.1.2"
|
117
125
|
}
|
118
|
-
|
119
|
-
|
126
|
+
},
|
127
|
+
"nbformat": 4,
|
128
|
+
"nbformat_minor": 0
|
129
|
+
}
|
data/examples/stdout.ipynb
CHANGED
@@ -1,104 +1,102 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
|
4
|
-
|
5
|
-
},
|
6
|
-
|
7
|
-
"
|
8
|
-
|
2
|
+
"cells": [
|
3
|
+
{
|
4
|
+
"cell_type": "markdown",
|
5
|
+
"metadata": {},
|
6
|
+
"source": [
|
7
|
+
"# Standard input and output"
|
8
|
+
]
|
9
|
+
},
|
9
10
|
{
|
10
|
-
"
|
11
|
+
"cell_type": "code",
|
12
|
+
"execution_count": 1,
|
13
|
+
"metadata": {
|
14
|
+
"collapsed": false
|
15
|
+
},
|
16
|
+
"outputs": [
|
11
17
|
{
|
12
|
-
"
|
13
|
-
"
|
14
|
-
"
|
15
|
-
|
16
|
-
"Standard input and output"
|
18
|
+
"name": "stdout",
|
19
|
+
"output_type": "stream",
|
20
|
+
"text": [
|
21
|
+
"Hello, world!\n"
|
17
22
|
]
|
18
|
-
}
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
"text": [
|
32
|
-
"Hello, world!\n"
|
33
|
-
]
|
34
|
-
}
|
35
|
-
],
|
36
|
-
"prompt_number": 4
|
37
|
-
},
|
23
|
+
}
|
24
|
+
],
|
25
|
+
"source": [
|
26
|
+
"puts 'Hello, world!'"
|
27
|
+
]
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"cell_type": "code",
|
31
|
+
"execution_count": 2,
|
32
|
+
"metadata": {
|
33
|
+
"collapsed": false
|
34
|
+
},
|
35
|
+
"outputs": [
|
38
36
|
{
|
39
|
-
"
|
40
|
-
"
|
41
|
-
"
|
42
|
-
"
|
43
|
-
|
44
|
-
],
|
45
|
-
"language": "python",
|
46
|
-
"metadata": {},
|
47
|
-
"outputs": [
|
48
|
-
{
|
49
|
-
"output_type": "stream",
|
50
|
-
"stream": "stdout",
|
51
|
-
"text": [
|
52
|
-
"stdout\n"
|
53
|
-
]
|
54
|
-
},
|
55
|
-
{
|
56
|
-
"output_type": "stream",
|
57
|
-
"stream": "stderr",
|
58
|
-
"text": [
|
59
|
-
"stderr\n"
|
60
|
-
]
|
61
|
-
}
|
62
|
-
],
|
63
|
-
"prompt_number": 5
|
37
|
+
"name": "stdout",
|
38
|
+
"output_type": "stream",
|
39
|
+
"text": [
|
40
|
+
"stdout\n"
|
41
|
+
]
|
64
42
|
},
|
65
43
|
{
|
66
|
-
"
|
67
|
-
"
|
68
|
-
"
|
69
|
-
"
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
"text": [
|
86
|
-
"write\n"
|
87
|
-
]
|
88
|
-
}
|
89
|
-
],
|
90
|
-
"prompt_number": 10
|
91
|
-
},
|
44
|
+
"name": "stderr",
|
45
|
+
"output_type": "stream",
|
46
|
+
"text": [
|
47
|
+
"stderr\n"
|
48
|
+
]
|
49
|
+
}
|
50
|
+
],
|
51
|
+
"source": [
|
52
|
+
"$stdout.puts 'stdout'\n",
|
53
|
+
"$stderr.puts 'stderr'"
|
54
|
+
]
|
55
|
+
},
|
56
|
+
{
|
57
|
+
"cell_type": "code",
|
58
|
+
"execution_count": 3,
|
59
|
+
"metadata": {
|
60
|
+
"collapsed": false
|
61
|
+
},
|
62
|
+
"outputs": [
|
92
63
|
{
|
93
|
-
"
|
94
|
-
"
|
95
|
-
"
|
96
|
-
|
97
|
-
|
98
|
-
|
64
|
+
"name": "stdout",
|
65
|
+
"output_type": "stream",
|
66
|
+
"text": [
|
67
|
+
"print\n",
|
68
|
+
"write\n"
|
69
|
+
]
|
99
70
|
}
|
100
71
|
],
|
101
|
-
"
|
72
|
+
"source": [
|
73
|
+
"print \"print\\n\"\n",
|
74
|
+
"$stdout.write \"write\\n\""
|
75
|
+
]
|
76
|
+
},
|
77
|
+
{
|
78
|
+
"cell_type": "code",
|
79
|
+
"execution_count": null,
|
80
|
+
"metadata": {
|
81
|
+
"collapsed": false
|
82
|
+
},
|
83
|
+
"outputs": [],
|
84
|
+
"source": []
|
102
85
|
}
|
103
|
-
]
|
104
|
-
|
86
|
+
],
|
87
|
+
"metadata": {
|
88
|
+
"kernelspec": {
|
89
|
+
"display_name": "Ruby",
|
90
|
+
"language": "ruby",
|
91
|
+
"name": "ruby"
|
92
|
+
},
|
93
|
+
"language_info": {
|
94
|
+
"file_extension": "rb",
|
95
|
+
"mimetype": "text/ruby",
|
96
|
+
"name": "ruby",
|
97
|
+
"version": "2.1.2"
|
98
|
+
}
|
99
|
+
},
|
100
|
+
"nbformat": 4,
|
101
|
+
"nbformat_minor": 0
|
102
|
+
}
|