jupyter_on_rails 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2e9d74610e71debbdc6c91f031fa391a2b8e0f3172674cfa73e9cba0cc2742c
4
- data.tar.gz: '08ecc7606a5c011eca37e649838dfc98d3d66c76592aea490ec451e44947d382'
3
+ metadata.gz: 2268bbfe0e3ad39f35573c40385e05fcf526b24dc942ffa1c99942bdf2efffb9
4
+ data.tar.gz: 127d4f8764f90c27ad74cb9ea8b2ea3ed9148ea156ecbc8189409aba9bf22de8
5
5
  SHA512:
6
- metadata.gz: 4d2fc76e92884c5b85dd4feff960665385b460cc8a1f6d9d9fada4b8edd2362eb8f90e702d68c43fb5f3c42168eef37d1705d2e65d1c116986eca61d3515f2a8
7
- data.tar.gz: 04d22ff64f23ac0c95045949489d5dce4bec3f6fc278ccebcc824b8ebf96e3163bc4bbc1201e497f7d6ce6a3b444d34b1d33c660aef0e4e2c29afe7be889fccb
6
+ metadata.gz: 631d2aa1fd6a8131a8b508355f5520a3375670feac73e5f0abe14a3067617c54392cbdd9ab554153a5bc0d87fc5c3ba71c3fb52c4219752fce4d4374d6370666
7
+ data.tar.gz: 034fe771d3ca2f45db395ce3d259eb76186523423e7fc9a21f9f64f2c473b24ed28bab73b856d06961bb519412c004286144cad4bb31c712567ff2e084a7178d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jupyter_on_rails (0.8.0)
4
+ jupyter_on_rails (0.9.0)
5
5
  daru
6
6
  iruby
7
7
  railties
@@ -9,78 +9,130 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (6.0.3.3)
13
- actionview (= 6.0.3.3)
14
- activesupport (= 6.0.3.3)
15
- rack (~> 2.0, >= 2.0.8)
12
+ actionpack (6.1.3.2)
13
+ actionview (= 6.1.3.2)
14
+ activesupport (= 6.1.3.2)
15
+ rack (~> 2.0, >= 2.0.9)
16
16
  rack-test (>= 0.6.3)
17
17
  rails-dom-testing (~> 2.0)
18
18
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
19
- actionview (6.0.3.3)
20
- activesupport (= 6.0.3.3)
19
+ actionview (6.1.3.2)
20
+ activesupport (= 6.1.3.2)
21
21
  builder (~> 3.1)
22
22
  erubi (~> 1.4)
23
23
  rails-dom-testing (~> 2.0)
24
24
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
25
- activesupport (6.0.3.3)
25
+ activesupport (6.1.3.2)
26
26
  concurrent-ruby (~> 1.0, >= 1.0.2)
27
- i18n (>= 0.7, < 2)
28
- minitest (~> 5.1)
29
- tzinfo (~> 1.1)
30
- zeitwerk (~> 2.2, >= 2.2.2)
27
+ i18n (>= 1.6, < 2)
28
+ minitest (>= 5.1)
29
+ tzinfo (~> 2.0)
30
+ zeitwerk (~> 2.3)
31
31
  addressable (2.7.0)
32
32
  public_suffix (>= 2.0.2, < 5.0)
33
- ast (2.4.1)
34
- backports (3.20.1)
35
- bond (0.5.1)
33
+ ast (2.4.2)
34
+ async (1.29.0)
35
+ console (~> 1.10)
36
+ nio4r (~> 2.3)
37
+ timers (~> 4.1)
38
+ async-http (0.56.2)
39
+ async (~> 1.25)
40
+ async-io (~> 1.28)
41
+ async-pool (~> 0.2)
42
+ protocol-http (~> 0.22.0)
43
+ protocol-http1 (~> 0.14.0)
44
+ protocol-http2 (~> 0.14.0)
45
+ async-http-faraday (0.9.0)
46
+ async-http (~> 0.42)
47
+ faraday
48
+ async-io (1.31.0)
49
+ async (~> 1.14)
50
+ async-pool (0.3.6)
51
+ async (~> 1.25)
52
+ backports (3.21.0)
36
53
  builder (3.2.4)
37
- bump (0.9.0)
38
- concurrent-ruby (1.1.7)
54
+ bump (0.10.0)
55
+ concurrent-ruby (1.1.8)
56
+ console (1.12.0)
57
+ fiber-local
39
58
  crass (1.0.6)
40
59
  daru (0.3)
41
60
  packable (~> 1.3.13)
42
61
  data_uri (0.1.0)
43
62
  erubi (1.10.0)
44
- faraday (1.0.1)
63
+ faraday (1.4.2)
64
+ faraday-em_http (~> 1.0)
65
+ faraday-em_synchrony (~> 1.0)
66
+ faraday-excon (~> 1.1)
67
+ faraday-net_http (~> 1.0)
68
+ faraday-net_http_persistent (~> 1.1)
45
69
  multipart-post (>= 1.2, < 3)
70
+ ruby2_keywords (>= 0.0.4)
71
+ faraday-em_http (1.0.0)
72
+ faraday-em_synchrony (1.0.0)
73
+ faraday-excon (1.1.0)
46
74
  faraday-http-cache (2.2.0)
47
75
  faraday (>= 0.8)
48
- github_changelog_generator (1.15.2)
76
+ faraday-net_http (1.0.1)
77
+ faraday-net_http_persistent (1.1.0)
78
+ ffi (1.15.1)
79
+ ffi-rzmq (2.0.7)
80
+ ffi-rzmq-core (>= 1.0.7)
81
+ ffi-rzmq-core (1.0.7)
82
+ ffi
83
+ fiber-local (1.0.0)
84
+ github_changelog_generator (1.16.3)
49
85
  activesupport
86
+ async (>= 1.25.0)
87
+ async-http-faraday
50
88
  faraday-http-cache
51
89
  multi_json
52
90
  octokit (~> 4.6)
53
91
  rainbow (>= 2.2.1)
54
92
  rake (>= 10.0)
55
93
  retriable (~> 3.0)
56
- i18n (1.8.5)
94
+ i18n (1.8.10)
57
95
  concurrent-ruby (~> 1.0)
58
- iruby (0.4.0)
59
- bond (~> 0.5)
96
+ io-console (0.5.9)
97
+ irb (1.3.5)
98
+ reline (>= 0.1.5)
99
+ iruby (0.7.0)
60
100
  data_uri (~> 0.1)
61
- mimemagic (~> 0.3)
101
+ ffi-rzmq
102
+ irb
103
+ mime-types (>= 3.3.1)
62
104
  multi_json (~> 1.11)
63
- loofah (2.8.0)
105
+ loofah (2.9.1)
64
106
  crass (~> 1.0.2)
65
107
  nokogiri (>= 1.5.9)
66
108
  method_source (1.0.0)
67
- mimemagic (0.3.5)
68
- mini_portile2 (2.5.0)
69
- minitest (5.14.2)
70
- multi_json (1.14.1)
109
+ mime-types (3.3.1)
110
+ mime-types-data (~> 3.2015)
111
+ mime-types-data (3.2021.0225)
112
+ mini_portile2 (2.5.1)
113
+ minitest (5.14.4)
114
+ multi_json (1.15.0)
71
115
  multipart-post (2.1.1)
72
- nokogiri (1.11.1)
116
+ nio4r (2.5.7)
117
+ nokogiri (1.11.6)
73
118
  mini_portile2 (~> 2.5.0)
74
119
  racc (~> 1.4)
75
- octokit (4.18.0)
120
+ octokit (4.21.0)
76
121
  faraday (>= 0.9)
77
122
  sawyer (~> 0.8.0, >= 0.5.3)
78
123
  packable (1.3.14)
79
124
  backports
80
125
  parallel (1.20.1)
81
- parser (3.0.0.0)
126
+ parser (3.0.1.1)
82
127
  ast (~> 2.4.1)
83
- public_suffix (4.0.5)
128
+ protocol-hpack (1.4.2)
129
+ protocol-http (0.22.0)
130
+ protocol-http1 (0.14.1)
131
+ protocol-http (~> 0.22)
132
+ protocol-http2 (0.14.2)
133
+ protocol-hpack (~> 1.4)
134
+ protocol-http (~> 0.18)
135
+ public_suffix (4.0.6)
84
136
  racc (1.5.2)
85
137
  rack (2.2.3)
86
138
  rack-test (1.1.0)
@@ -90,38 +142,41 @@ GEM
90
142
  nokogiri (>= 1.6)
91
143
  rails-html-sanitizer (1.3.0)
92
144
  loofah (~> 2.3)
93
- railties (6.0.3.3)
94
- actionpack (= 6.0.3.3)
95
- activesupport (= 6.0.3.3)
145
+ railties (6.1.3.2)
146
+ actionpack (= 6.1.3.2)
147
+ activesupport (= 6.1.3.2)
96
148
  method_source
97
149
  rake (>= 0.8.7)
98
- thor (>= 0.20.3, < 2.0)
150
+ thor (~> 1.0)
99
151
  rainbow (3.0.0)
100
- rake (13.0.1)
101
- regexp_parser (2.0.3)
152
+ rake (13.0.3)
153
+ regexp_parser (2.1.1)
154
+ reline (0.2.5)
155
+ io-console (~> 0.5)
102
156
  retriable (3.1.2)
103
- rexml (3.2.4)
104
- rubocop (1.8.0)
157
+ rexml (3.2.5)
158
+ rubocop (1.15.0)
105
159
  parallel (~> 1.10)
106
160
  parser (>= 3.0.0.0)
107
161
  rainbow (>= 2.2.2, < 4.0)
108
162
  regexp_parser (>= 1.8, < 3.0)
109
163
  rexml
110
- rubocop-ast (>= 1.2.0, < 2.0)
164
+ rubocop-ast (>= 1.5.0, < 2.0)
111
165
  ruby-progressbar (~> 1.7)
112
166
  unicode-display_width (>= 1.4.0, < 3.0)
113
- rubocop-ast (1.4.0)
114
- parser (>= 2.7.1.5)
167
+ rubocop-ast (1.6.0)
168
+ parser (>= 3.0.1.1)
115
169
  ruby-progressbar (1.11.0)
170
+ ruby2_keywords (0.0.4)
116
171
  sawyer (0.8.2)
117
172
  addressable (>= 2.3.5)
118
173
  faraday (> 0.8, < 2.0)
119
- thor (1.0.1)
120
- thread_safe (0.3.6)
121
- tzinfo (1.2.7)
122
- thread_safe (~> 0.1)
174
+ thor (1.1.0)
175
+ timers (4.3.3)
176
+ tzinfo (2.0.4)
177
+ concurrent-ruby (~> 1.0)
123
178
  unicode-display_width (2.0.0)
124
- zeitwerk (2.4.0)
179
+ zeitwerk (2.4.2)
125
180
 
126
181
  PLATFORMS
127
182
  ruby
@@ -134,4 +189,4 @@ DEPENDENCIES
134
189
  rubocop
135
190
 
136
191
  BUNDLED WITH
137
- 2.1.4
192
+ 2.2.3
@@ -31,8 +31,8 @@ Gem::Specification.new do |spec|
31
31
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
32
32
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
33
33
  `git ls-files -z`.split("\x0")
34
- .reject { |f| f.match(%r{^(test|spec|features)/}) }
35
- .reject { |f| f.match(/\.png$/) }
34
+ .reject { |f| f.match(%r{^(test|spec|features|\.github)/}) }
35
+ .reject { |f| f.match(/(\.gitignore|\.png)$/) }
36
36
  end
37
37
  spec.bindir = 'exe'
38
38
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -1,12 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JupyterOnRails
4
- module IRubyKernelExtention
5
- class << self
6
- attr_accessor :root, :sandbox
7
- end
8
-
9
- def run
4
+ module Initializer
5
+ def self.run(root:, sandbox:)
10
6
  # Load Daru extensions
11
7
  begin
12
8
  require 'daru'
@@ -25,22 +21,18 @@ module JupyterOnRails
25
21
  end
26
22
 
27
23
  original = Dir.pwd
28
- root = IRubyKernelExtention.root
29
24
  Dir.chdir root
30
25
  app_file = File.expand_path('config/environment.rb', root)
31
26
  require app_file
32
27
  Rails.application.require_environment!
33
28
  Dir.chdir original
34
29
 
35
- if IRubyKernelExtention.sandbox
36
- ActiveRecord::Base.connection.begin_transaction(joinable: false)
30
+ return unless sandbox
37
31
 
38
- at_exit do
39
- ActiveRecord::Base.connection.rollback_transaction
40
- end
32
+ ActiveRecord::Base.connection.begin_transaction(joinable: false)
33
+ at_exit do
34
+ ActiveRecord::Base.connection.rollback_transaction
41
35
  end
42
-
43
- super
44
36
  end
45
37
  end
46
38
  end
@@ -20,12 +20,13 @@ module JupyterOnRails
20
20
  end
21
21
 
22
22
  def load_extensions
23
- require_relative 'iruby_kernel_extention'
24
- JupyterOnRails::IRubyKernelExtention.root = @root
25
- JupyterOnRails::IRubyKernelExtention.sandbox = @sandbox
23
+ require_relative 'initializer'
26
24
 
27
25
  require 'iruby'
28
- IRuby::Kernel.instance_eval { prepend JupyterOnRails::IRubyKernelExtention }
26
+ IRuby::Kernel.events.register(:initialized) do |_kernel|
27
+ JupyterOnRails::Initializer.run(root: @root, sandbox: @sandbox)
28
+ end
29
+
29
30
  IRuby::Display::Registry.instance_eval do
30
31
  match do |obj|
31
32
  obj.is_a?(ActiveRecord::Relation) ||
@@ -21,6 +21,12 @@ namespace :jupyter do
21
21
  root = Rails.root
22
22
  ipython_dir = ENV['JUPYTER_DATA_DIR'] || ENV['IPYTHONDIR'] || root / '.ipython'
23
23
  ipython_dir = File.absolute_path(ipython_dir.to_s)
24
+ application_module =
25
+ if Rails::VERSION::MAJOR >= 6
26
+ Rails.application.class.module_parent
27
+ else
28
+ Rails.application.class.parent
29
+ end
24
30
 
25
31
  sh "JUPYTER_DATA_DIR=#{Shellwords.shellescape(ipython_dir.to_s)} bundle exec iruby register --force"
26
32
 
@@ -35,7 +41,7 @@ namespace :jupyter do
35
41
  kernel_file = File.expand_path("kernels/#{cfg.kernel_name}/kernel.json", ipython_dir.to_s)
36
42
  kernel_h = JSON.parse(File.read(kernel_file))
37
43
  kernel_h['argv'] << File.expand_path(cfg.boot_file, __dir__)
38
- kernel_h['display_name'] = "#{Rails.application.class.parent} (rails #{Rails.version}#{cfg.name_ext})"
44
+ kernel_h['display_name'] = "#{application_module} (rails #{Rails.version}#{cfg.name_ext})"
39
45
  kernel_h['env'] ||= {}
40
46
  kernel_h['env']['RAILS_ROOT'] = root.to_s
41
47
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JupyterOnRails
4
- VERSION = '0.8.0'
4
+ VERSION = '0.9.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jupyter_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki INOUE
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-10 00:00:00.000000000 Z
11
+ date: 2021-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bump
@@ -115,9 +115,6 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
- - ".github/FUNDING.yml"
119
- - ".github/workflows/ruby.yml"
120
- - ".gitignore"
121
118
  - ".rubocop.yml"
122
119
  - CHANGELOG.md
123
120
  - Gemfile
@@ -133,7 +130,7 @@ files:
133
130
  - lib/jupyter_on_rails/boot_sandbox.rb
134
131
  - lib/jupyter_on_rails/daru/active_record_ext.rb
135
132
  - lib/jupyter_on_rails/daru/data_frame_ext.rb
136
- - lib/jupyter_on_rails/iruby_kernel_extention.rb
133
+ - lib/jupyter_on_rails/initializer.rb
137
134
  - lib/jupyter_on_rails/kernel.rb
138
135
  - lib/jupyter_on_rails/railtie.rb
139
136
  - lib/jupyter_on_rails/railtie/jupyter.rake
@@ -144,7 +141,7 @@ metadata:
144
141
  allowed_push_host: https://rubygems.org
145
142
  homepage_uri: https://github.com/Yuki-Inoue/jupyter_on_rails
146
143
  source_code_uri: https://github.com/Yuki-Inoue/jupyter_on_rails
147
- post_install_message:
144
+ post_install_message:
148
145
  rdoc_options: []
149
146
  require_paths:
150
147
  - lib
@@ -159,8 +156,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
156
  - !ruby/object:Gem::Version
160
157
  version: '0'
161
158
  requirements: []
162
- rubygems_version: 3.0.3
163
- signing_key:
159
+ rubygems_version: 3.2.3
160
+ signing_key:
164
161
  specification_version: 4
165
162
  summary: Integrate jupyter into rails
166
163
  test_files: []
data/.github/FUNDING.yml DELETED
@@ -1,2 +0,0 @@
1
-
2
- issuehunt: yuki-inoue
@@ -1,29 +0,0 @@
1
- name: Ruby
2
-
3
- on:
4
- push:
5
- branches: [ master ]
6
- pull_request:
7
- branches: [ master ]
8
-
9
- jobs:
10
- build:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/checkout@v2
14
- - name: Set up Ruby
15
- uses: actions/setup-ruby@v1
16
- with:
17
- ruby-version: 2.7.2
18
- # https://github.com/actions/cache/blob/master/examples.md#ruby---bundler
19
- - uses: actions/cache@v1
20
- with:
21
- path: vendor/bundle
22
- key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
23
- restore-keys: |
24
- ${{ runner.os }}-gems-
25
- - name: Build and test with Rake
26
- run: |
27
- gem install bundler
28
- bundle install --jobs 4 --retry 3 --path vendor/bundle
29
- bundle exec rubocop
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- /vendor