jupyter_on_rails 0.9.0 → 0.12.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: 2268bbfe0e3ad39f35573c40385e05fcf526b24dc942ffa1c99942bdf2efffb9
4
- data.tar.gz: 127d4f8764f90c27ad74cb9ea8b2ea3ed9148ea156ecbc8189409aba9bf22de8
3
+ metadata.gz: 27f2fd3fc91d19c53934a71316291e7cf5611e5a7f111f9c3aaa8b473a907e0d
4
+ data.tar.gz: ad3df102931dda73da46bd5feabf66a00fee9d8bf545dca737b6c4fbb45e4317
5
5
  SHA512:
6
- metadata.gz: 631d2aa1fd6a8131a8b508355f5520a3375670feac73e5f0abe14a3067617c54392cbdd9ab554153a5bc0d87fc5c3ba71c3fb52c4219752fce4d4374d6370666
7
- data.tar.gz: 034fe771d3ca2f45db395ce3d259eb76186523423e7fc9a21f9f64f2c473b24ed28bab73b856d06961bb519412c004286144cad4bb31c712567ff2e084a7178d
6
+ metadata.gz: 5bc320a0c1b2b6b580d3ff90834aee380d117605e8df4325de238014ba51176670bc2e32422a0b64e0c5bff098b46ef2c1558413acd76226d939d76b94ab1693
7
+ data.tar.gz: db968e93f18f3a806f329e9aa5503001d415cb83f95bd34bae48d7066ba59bc1e0f97221d0cdef9b6c17d081db8d04bf3d760c24ae070e3960ad251eee6b142a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jupyter_on_rails (0.9.0)
4
+ jupyter_on_rails (0.12.0)
5
5
  daru
6
6
  iruby
7
7
  railties
@@ -9,26 +9,25 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
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)
12
+ actionpack (7.0.2.4)
13
+ actionview (= 7.0.2.4)
14
+ activesupport (= 7.0.2.4)
15
+ rack (~> 2.0, >= 2.2.0)
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.1.3.2)
20
- activesupport (= 6.1.3.2)
19
+ actionview (7.0.2.4)
20
+ activesupport (= 7.0.2.4)
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.1.3.2)
25
+ activesupport (7.0.2.4)
26
26
  concurrent-ruby (~> 1.0, >= 1.0.2)
27
27
  i18n (>= 1.6, < 2)
28
28
  minitest (>= 5.1)
29
29
  tzinfo (~> 2.0)
30
- zeitwerk (~> 2.3)
31
- addressable (2.7.0)
30
+ addressable (2.8.0)
32
31
  public_suffix (>= 2.0.2, < 5.0)
33
32
  ast (2.4.2)
34
33
  async (1.29.0)
@@ -49,10 +48,10 @@ GEM
49
48
  async (~> 1.14)
50
49
  async-pool (0.3.6)
51
50
  async (~> 1.25)
52
- backports (3.21.0)
51
+ backports (3.23.0)
53
52
  builder (3.2.4)
54
53
  bump (0.10.0)
55
- concurrent-ruby (1.1.8)
54
+ concurrent-ruby (1.1.10)
56
55
  console (1.12.0)
57
56
  fiber-local
58
57
  crass (1.0.6)
@@ -75,7 +74,7 @@ GEM
75
74
  faraday (>= 0.8)
76
75
  faraday-net_http (1.0.1)
77
76
  faraday-net_http_persistent (1.1.0)
78
- ffi (1.15.1)
77
+ ffi (1.15.5)
79
78
  ffi-rzmq (2.0.7)
80
79
  ffi-rzmq-core (>= 1.0.7)
81
80
  ffi-rzmq-core (1.0.7)
@@ -91,36 +90,38 @@ GEM
91
90
  rainbow (>= 2.2.1)
92
91
  rake (>= 10.0)
93
92
  retriable (~> 3.0)
94
- i18n (1.8.10)
93
+ i18n (1.10.0)
95
94
  concurrent-ruby (~> 1.0)
96
- io-console (0.5.9)
97
- irb (1.3.5)
98
- reline (>= 0.1.5)
99
- iruby (0.7.0)
95
+ io-console (0.5.11)
96
+ irb (1.4.1)
97
+ reline (>= 0.3.0)
98
+ iruby (0.7.4)
100
99
  data_uri (~> 0.1)
101
100
  ffi-rzmq
102
101
  irb
103
102
  mime-types (>= 3.3.1)
104
103
  multi_json (~> 1.11)
105
- loofah (2.9.1)
104
+ native-package-installer
105
+ loofah (2.18.0)
106
106
  crass (~> 1.0.2)
107
107
  nokogiri (>= 1.5.9)
108
108
  method_source (1.0.0)
109
- mime-types (3.3.1)
109
+ mime-types (3.4.1)
110
110
  mime-types-data (~> 3.2015)
111
- mime-types-data (3.2021.0225)
112
- mini_portile2 (2.5.1)
113
- minitest (5.14.4)
111
+ mime-types-data (3.2022.0105)
112
+ mini_portile2 (2.8.0)
113
+ minitest (5.15.0)
114
114
  multi_json (1.15.0)
115
115
  multipart-post (2.1.1)
116
+ native-package-installer (1.1.4)
116
117
  nio4r (2.5.7)
117
- nokogiri (1.11.6)
118
- mini_portile2 (~> 2.5.0)
118
+ nokogiri (1.13.6)
119
+ mini_portile2 (~> 2.8.0)
119
120
  racc (~> 1.4)
120
121
  octokit (4.21.0)
121
122
  faraday (>= 0.9)
122
123
  sawyer (~> 0.8.0, >= 0.5.3)
123
- packable (1.3.14)
124
+ packable (1.3.15)
124
125
  backports
125
126
  parallel (1.20.1)
126
127
  parser (3.0.1.1)
@@ -133,25 +134,26 @@ GEM
133
134
  protocol-hpack (~> 1.4)
134
135
  protocol-http (~> 0.18)
135
136
  public_suffix (4.0.6)
136
- racc (1.5.2)
137
+ racc (1.6.0)
137
138
  rack (2.2.3)
138
139
  rack-test (1.1.0)
139
140
  rack (>= 1.0, < 3)
140
141
  rails-dom-testing (2.0.3)
141
142
  activesupport (>= 4.2.0)
142
143
  nokogiri (>= 1.6)
143
- rails-html-sanitizer (1.3.0)
144
+ rails-html-sanitizer (1.4.2)
144
145
  loofah (~> 2.3)
145
- railties (6.1.3.2)
146
- actionpack (= 6.1.3.2)
147
- activesupport (= 6.1.3.2)
146
+ railties (7.0.2.4)
147
+ actionpack (= 7.0.2.4)
148
+ activesupport (= 7.0.2.4)
148
149
  method_source
149
- rake (>= 0.8.7)
150
+ rake (>= 12.2)
150
151
  thor (~> 1.0)
152
+ zeitwerk (~> 2.5)
151
153
  rainbow (3.0.0)
152
154
  rake (13.0.3)
153
155
  regexp_parser (2.1.1)
154
- reline (0.2.5)
156
+ reline (0.3.1)
155
157
  io-console (~> 0.5)
156
158
  retriable (3.1.2)
157
159
  rexml (3.2.5)
@@ -171,12 +173,12 @@ GEM
171
173
  sawyer (0.8.2)
172
174
  addressable (>= 2.3.5)
173
175
  faraday (> 0.8, < 2.0)
174
- thor (1.1.0)
176
+ thor (1.2.1)
175
177
  timers (4.3.3)
176
178
  tzinfo (2.0.4)
177
179
  concurrent-ruby (~> 1.0)
178
180
  unicode-display_width (2.0.0)
179
- zeitwerk (2.4.2)
181
+ zeitwerk (2.5.4)
180
182
 
181
183
  PLATFORMS
182
184
  ruby
@@ -189,4 +191,4 @@ DEPENDENCIES
189
191
  rubocop
190
192
 
191
193
  BUNDLED WITH
192
- 2.2.3
194
+ 2.2.22
@@ -3,21 +3,35 @@
3
3
  module JupyterOnRails
4
4
  module Initializer
5
5
  def self.run(root:, sandbox:)
6
- # Load Daru extensions
7
- begin
6
+ require 'active_support/lazy_load_hooks'
7
+
8
+ ActiveSupport.on_load(:active_record) do
9
+ # Load Daru extensions
10
+
8
11
  require 'daru'
9
- require 'active_record'
10
12
  rescue LoadError
11
13
  else
12
14
  require 'jupyter_on_rails/daru/active_record_ext'
13
15
  require 'jupyter_on_rails/daru/data_frame_ext'
14
16
 
15
- ::ActiveRecord::Base.instance_eval do
16
- include ::JupyterOnRails::Daru::ActiveRecordExt
17
- end
17
+ include ::JupyterOnRails::Daru::ActiveRecordExt
18
+
18
19
  ::Daru::DataFrame.instance_eval do
19
20
  include ::JupyterOnRails::Daru::DataFrameExt
20
21
  end
22
+
23
+ IRuby::Display::Registry.instance_eval do
24
+ match do |obj|
25
+ obj.is_a?(ActiveRecord::Relation) ||
26
+ obj.is_a?(::Class) && obj < ActiveRecord::Base && !obj.abstract_class
27
+ end
28
+ priority 100
29
+ format 'text/html' do |obj|
30
+ n = 10
31
+ puts "finding top #{n}"
32
+ obj.limit(n).to_df.to_html
33
+ end
34
+ end
21
35
  end
22
36
 
23
37
  original = Dir.pwd
@@ -26,19 +26,6 @@ module JupyterOnRails
26
26
  IRuby::Kernel.events.register(:initialized) do |_kernel|
27
27
  JupyterOnRails::Initializer.run(root: @root, sandbox: @sandbox)
28
28
  end
29
-
30
- IRuby::Display::Registry.instance_eval do
31
- match do |obj|
32
- obj.is_a?(ActiveRecord::Relation) ||
33
- obj.is_a?(::Class) && obj < ActiveRecord::Base && !obj.abstract_class
34
- end
35
- priority 100
36
- format 'text/html' do |obj|
37
- n = 10
38
- puts "finding top #{n}"
39
- obj.limit(n).to_df.to_html
40
- end
41
- end
42
29
  end
43
30
  end
44
31
  end
@@ -6,16 +6,31 @@ require 'ostruct'
6
6
 
7
7
  # rubocop:disable Metrics/BlockLength
8
8
  namespace :jupyter do
9
- desc 'start jupyter notebook'
10
- task notebook: :install_kernels do
9
+ exec_jupyter_command = lambda do |subcomand|
11
10
  ipython_dir = ENV['IPYTHONDIR'] || Rails.root / '.ipython'
12
11
 
13
12
  env = { 'JUPYTER_DATA_DIR' => ipython_dir.to_s }
14
- commands = %w[jupyter notebook]
15
- commands = %w[pipenv run] + commands if (Rails.root / 'Pipfile').exist?
13
+ commands = ['jupyter', subcomand]
14
+
15
+ if (Rails.root / 'pyproject.toml').exist?
16
+ commands = %w[poetry run] + commands
17
+ elsif (Rails.root / 'Pipfile').exist?
18
+ commands = %w[pipenv run] + commands
19
+ end
20
+
16
21
  Process.exec(env, *commands)
17
22
  end
18
23
 
24
+ desc 'start jupyter notebook'
25
+ task notebook: :install_kernels do
26
+ instance_exec('notebook', &exec_jupyter_command)
27
+ end
28
+
29
+ desc 'start jupyter lab'
30
+ task lab: :install_kernels do
31
+ instance_exec('lab', &exec_jupyter_command)
32
+ end
33
+
19
34
  desc 'Install the kernel'
20
35
  task :install_kernels do
21
36
  root = Rails.root
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JupyterOnRails
4
- VERSION = '0.9.0'
4
+ VERSION = '0.12.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.9.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki INOUE
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-28 00:00:00.000000000 Z
11
+ date: 2022-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bump
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
- rubygems_version: 3.2.3
159
+ rubygems_version: 3.1.6
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: Integrate jupyter into rails