iruby 0.8.0 → 0.8.1
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/.github/workflows/ci.yml +27 -6
- data/CHANGES.md +10 -0
- data/Gemfile +5 -0
- data/lib/iruby/application.rb +1 -1
- data/lib/iruby/backend.rb +14 -2
- data/lib/iruby/comm.rb +6 -6
- data/lib/iruby/display.rb +2 -3
- data/lib/iruby/formatter.rb +1 -1
- data/lib/iruby/ostream.rb +1 -1
- data/lib/iruby/session/mixin.rb +2 -2
- data/lib/iruby/session.rb +2 -2
- data/lib/iruby/version.rb +1 -1
- data/test/iruby/application/kernel_test.rb +1 -1
- data/test/iruby/application/register_test.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d874a72b0b879122f83a0a31cd86d387bf9ead180e4f1954a42d2ec82b5de6be
|
4
|
+
data.tar.gz: 8cbe956be221da36f99cc8c550857fcc7dee567f4a4cbcf43a167ec8ce0b5a41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cc1fdaf13bf195ad4d18206c8663f693a77a1c0bcf29446c3d1c91a8e6e88fc80d8612868caa47794752dae9bcf6edc07165374fbb3637e4af1e49d8e8efa96
|
7
|
+
data.tar.gz: 9d092e97d5adc8b615f7d1f02a8fa5b52428e5c167e24e8997770a2d808e10d327a4df86fbaba8f986640110109785cd796cd5751a50ff45b298ca85037f8976
|
data/.github/workflows/ci.yml
CHANGED
@@ -3,10 +3,7 @@ name: CI
|
|
3
3
|
on:
|
4
4
|
push:
|
5
5
|
pull_request:
|
6
|
-
|
7
|
-
- opened
|
8
|
-
- synchronize
|
9
|
-
- reopened
|
6
|
+
workflow_dispatch:
|
10
7
|
|
11
8
|
jobs:
|
12
9
|
ubuntu:
|
@@ -19,11 +16,14 @@ jobs:
|
|
19
16
|
os:
|
20
17
|
- ubuntu-latest
|
21
18
|
ruby:
|
19
|
+
- "3.4"
|
22
20
|
- "3.3"
|
23
21
|
- "3.2"
|
24
22
|
- "3.1"
|
25
23
|
- "3.0"
|
26
24
|
- "2.7"
|
25
|
+
- "2.6"
|
26
|
+
- "2.5"
|
27
27
|
- debug
|
28
28
|
|
29
29
|
steps:
|
@@ -37,13 +37,34 @@ jobs:
|
|
37
37
|
|
38
38
|
- run: rake build
|
39
39
|
|
40
|
-
- name: Install ffi
|
40
|
+
- name: Install ffi (if Ruby 2.7)
|
41
41
|
if: |
|
42
42
|
matrix.ruby == '2.7'
|
43
43
|
run: |
|
44
44
|
cat <<GEMFILE > Gemfile.irb
|
45
45
|
source 'https://rubygems.org'
|
46
|
-
gem 'ffi'
|
46
|
+
gem 'ffi'
|
47
|
+
GEMFILE
|
48
|
+
BUNDLE_GEMFILE=Gemfile.irb bundle install --jobs 4 --retry 3
|
49
|
+
|
50
|
+
- name: Install ffi 1.6.x (if Ruby 2.6)
|
51
|
+
if: |
|
52
|
+
matrix.ruby == '2.6'
|
53
|
+
run: |
|
54
|
+
cat <<GEMFILE > Gemfile.irb
|
55
|
+
source 'https://rubygems.org'
|
56
|
+
gem 'ffi', '~> 1.6.0'
|
57
|
+
GEMFILE
|
58
|
+
BUNDLE_GEMFILE=Gemfile.irb bundle install --jobs 4 --retry 3
|
59
|
+
|
60
|
+
- name: Install ffi 1.6.x and irb < 1.4.3 (if Ruby 2.5)
|
61
|
+
if: |
|
62
|
+
matrix.ruby == '2.5'
|
63
|
+
run: |
|
64
|
+
cat <<GEMFILE > Gemfile.irb
|
65
|
+
source 'https://rubygems.org'
|
66
|
+
gem 'ffi', '~> 1.6.0'
|
67
|
+
gem 'irb', '< 1.4.3'
|
47
68
|
GEMFILE
|
48
69
|
BUNDLE_GEMFILE=Gemfile.irb bundle install --jobs 4 --retry 3
|
49
70
|
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# 0.8.1 (2025-02-16)
|
2
|
+
|
3
|
+
* Add support for jupyter widgets by @matt-do-it in https://github.com/SciRuby/iruby/pull/350
|
4
|
+
* Suppress "literal string will be frozen in the future" warning by @tikkss in https://github.com/SciRuby/iruby/pull/353
|
5
|
+
* Fix warnings in project by @simpl1g in https://github.com/SciRuby/iruby/pull/356
|
6
|
+
* restore support for IRB <= v1.13.0 by @sealocal in https://github.com/SciRuby/iruby/pull/358
|
7
|
+
* Restore ruby 2.6 and 2.5 in CI by @sealocal in https://github.com/SciRuby/iruby/pull/359
|
8
|
+
* Add Ruby 3.4 to CI by @kojix2 in https://github.com/SciRuby/iruby/pull/360
|
9
|
+
* Fix NoMethodError in backend by @edsinclair in https://github.com/SciRuby/iruby/pull/364
|
10
|
+
|
1
11
|
# 0.8.0 (2024-07-28)
|
2
12
|
|
3
13
|
* Hide output on assignment by @ankane in https://github.com/SciRuby/iruby/pull/312
|
data/Gemfile
CHANGED
@@ -15,3 +15,8 @@ end
|
|
15
15
|
group :test do
|
16
16
|
gem 'cztop'
|
17
17
|
end
|
18
|
+
|
19
|
+
# Tests are failing on Ruby 3.3 because warnings related to OpenStruct are being written to the standard error output.
|
20
|
+
# This is being captured by Open3.capture2e and then mistakenly parsed as JSON.
|
21
|
+
# This gem can be removed when json gem is updated
|
22
|
+
gem 'ostruct'
|
data/lib/iruby/application.rb
CHANGED
@@ -265,7 +265,7 @@ module IRuby
|
|
265
265
|
opts.on(
|
266
266
|
"--display-name=VALUE", String,
|
267
267
|
"Specify the display name for the kernelspec. This is helpful when you have multiple IRuby kernels."
|
268
|
-
) {|v|
|
268
|
+
) {|v| params.display_name = v }
|
269
269
|
|
270
270
|
# TODO: --profile
|
271
271
|
# TODO: --prefix
|
data/lib/iruby/backend.rb
CHANGED
@@ -50,6 +50,7 @@ module IRuby
|
|
50
50
|
@irb = IRB::Irb.new(@workspace)
|
51
51
|
@eval_path = @irb.context.irb_path
|
52
52
|
IRB.conf[:MAIN_CONTEXT] = @irb.context
|
53
|
+
@completor = IRB::RegexpCompletor.new if defined? IRB::RegexpCompletor # IRB::VERSION >= 1.8.2
|
53
54
|
end
|
54
55
|
|
55
56
|
def eval_binding
|
@@ -57,12 +58,23 @@ module IRuby
|
|
57
58
|
end
|
58
59
|
|
59
60
|
def eval(code, store_history)
|
60
|
-
@irb.context.evaluate(
|
61
|
+
@irb.context.evaluate(parse_code(code), 0)
|
61
62
|
@irb.context.last_value unless IRuby.silent_assignment && assignment_expression?(code)
|
62
63
|
end
|
63
64
|
|
65
|
+
def parse_code(code)
|
66
|
+
return code if Gem::Version.new(IRB::VERSION) < Gem::Version.new('1.13.0')
|
67
|
+
return @irb.parse_input(code) if @irb.respond_to?(:parse_input)
|
68
|
+
return @irb.build_statement(code) if @irb.respond_to?(:build_statement)
|
69
|
+
end
|
70
|
+
|
64
71
|
def complete(code)
|
65
|
-
|
72
|
+
if @completor
|
73
|
+
# preposing and postposing never used, so they are empty, pass only target as code
|
74
|
+
@completor.completion_candidates('', code, '', bind: @workspace.binding)
|
75
|
+
else
|
76
|
+
IRB::InputCompletor::CompletionProc.call(code)
|
77
|
+
end
|
66
78
|
end
|
67
79
|
|
68
80
|
private
|
data/lib/iruby/comm.rb
CHANGED
@@ -13,17 +13,17 @@ module IRuby
|
|
13
13
|
@target_name, @comm_id = target_name, comm_id
|
14
14
|
end
|
15
15
|
|
16
|
-
def open(**data)
|
17
|
-
Kernel.instance.session.send(:publish, :comm_open, comm_id: @comm_id, data: data, target_name: @target_name)
|
16
|
+
def open(metadata = nil, **data)
|
17
|
+
Kernel.instance.session.send(:publish, :comm_open, metadata, comm_id: @comm_id, data: data, target_name: @target_name)
|
18
18
|
Comm.comm[@comm_id] = self
|
19
19
|
end
|
20
20
|
|
21
|
-
def send(**data)
|
22
|
-
Kernel.instance.session.send(:publish, :comm_msg, comm_id: @comm_id, data: data)
|
21
|
+
def send(metadata = nil, **data)
|
22
|
+
Kernel.instance.session.send(:publish, :comm_msg, metadata, comm_id: @comm_id, data: data)
|
23
23
|
end
|
24
24
|
|
25
|
-
def close(**data)
|
26
|
-
Kernel.instance.session.send(:publish, :comm_close, comm_id: @comm_id, data: data)
|
25
|
+
def close(metadata = nil, **data)
|
26
|
+
Kernel.instance.session.send(:publish, :comm_close, metadata, comm_id: @comm_id, data: data)
|
27
27
|
Comm.comm.delete(@comm_id)
|
28
28
|
end
|
29
29
|
|
data/lib/iruby/display.rb
CHANGED
@@ -113,14 +113,14 @@ module IRuby
|
|
113
113
|
if FORCE_TEXT_TYPES.include?(mime)
|
114
114
|
true
|
115
115
|
else
|
116
|
-
MIME::Type.new(mime).ascii?
|
116
|
+
MIME::Type.new("content-type" => mime).ascii?
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
120
|
private def render_mimebundle(obj, exact_mime, fuzzy_mime)
|
121
121
|
data = {}
|
122
122
|
include_mime = [exact_mime].compact
|
123
|
-
formats,
|
123
|
+
formats, _metadata = obj.to_iruby_mimebundle(include: include_mime)
|
124
124
|
formats.each do |mime, value|
|
125
125
|
if fuzzy_mime.nil? || mime.include?(fuzzy_mime)
|
126
126
|
data[mime] = value
|
@@ -407,7 +407,6 @@ module IRuby
|
|
407
407
|
|
408
408
|
type { Gruff::Base }
|
409
409
|
format 'image' do |obj|
|
410
|
-
image = obj.to_image
|
411
410
|
format_magick_image.(obj.to_image)
|
412
411
|
end
|
413
412
|
|
data/lib/iruby/formatter.rb
CHANGED
data/lib/iruby/ostream.rb
CHANGED
data/lib/iruby/session/mixin.rb
CHANGED
@@ -4,10 +4,10 @@ module IRuby
|
|
4
4
|
|
5
5
|
private
|
6
6
|
|
7
|
-
def serialize(idents, header, content)
|
7
|
+
def serialize(idents, header, metadata = nil, content)
|
8
8
|
msg = [MultiJson.dump(header),
|
9
9
|
MultiJson.dump(@last_recvd_msg ? @last_recvd_msg[:header] : {}),
|
10
|
-
|
10
|
+
MultiJson.dump(metadata || {}),
|
11
11
|
MultiJson.dump(content || {})]
|
12
12
|
frames = ([*idents].compact.map(&:to_s) << DELIM << sign(msg)) + msg
|
13
13
|
IRuby.logger.debug "Sent #{frames.inspect}"
|
data/lib/iruby/session.rb
CHANGED
@@ -70,7 +70,7 @@ module IRuby
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
-
def send(socket_type, message_type, content)
|
73
|
+
def send(socket_type, message_type, metadata = nil, content)
|
74
74
|
sock = check_socket_type(socket_type)
|
75
75
|
idents = if socket_type == :reply && @last_recvd_msg
|
76
76
|
@last_recvd_msg[:idents]
|
@@ -85,7 +85,7 @@ module IRuby
|
|
85
85
|
session: @session_id,
|
86
86
|
version: '5.0'
|
87
87
|
}
|
88
|
-
@adapter.send(sock, serialize(idents, header, content))
|
88
|
+
@adapter.send(sock, serialize(idents, header, metadata, content))
|
89
89
|
end
|
90
90
|
|
91
91
|
def recv(socket_type)
|
data/lib/iruby/version.rb
CHANGED
@@ -83,7 +83,7 @@ module IRubyTest::ApplicationTests
|
|
83
83
|
|
84
84
|
add_kernel_options("--log=#{log_file}", boot_file)
|
85
85
|
|
86
|
-
|
86
|
+
_out, status = Open3.capture2e(*iruby_command("console"), in: :close)
|
87
87
|
assert status.success?
|
88
88
|
assert_path_exist log_file
|
89
89
|
assert_match(/\bINFO -- bootfile: !!! LOG MESSAGE FROM BOOT FILE !!!$/, File.read(log_file))
|
@@ -61,7 +61,7 @@ puts "Fake Jupyter"
|
|
61
61
|
test("a new IRuby kernel `#{DEFAULT_KERNEL_NAME}` will be installed in JUPYTER_DATA_DIR") do
|
62
62
|
assert_path_not_exist @kernel_json
|
63
63
|
|
64
|
-
|
64
|
+
_out, status = Open3.capture2e(*iruby_command("register"))
|
65
65
|
assert status.success?
|
66
66
|
assert_path_exist @kernel_json
|
67
67
|
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Mendler
|
8
8
|
- The SciRuby developers
|
9
|
-
autorequire:
|
10
9
|
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-02-16 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: data_uri
|
@@ -267,7 +266,6 @@ licenses:
|
|
267
266
|
- MIT
|
268
267
|
metadata:
|
269
268
|
msys2_mingw_dependencies: zeromq
|
270
|
-
post_install_message:
|
271
269
|
rdoc_options: []
|
272
270
|
require_paths:
|
273
271
|
- lib
|
@@ -282,8 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
280
|
- !ruby/object:Gem::Version
|
283
281
|
version: '0'
|
284
282
|
requirements: []
|
285
|
-
rubygems_version: 3.
|
286
|
-
signing_key:
|
283
|
+
rubygems_version: 3.6.2
|
287
284
|
specification_version: 4
|
288
285
|
summary: Ruby Kernel for Jupyter
|
289
286
|
test_files:
|