jupyter_on_rails 0.5.0 → 0.5.5

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: db480dd0b66703b18e2b2b381a2b7e8503dbbb7ad9a0d0602689059dc4b965b1
4
- data.tar.gz: 0b7dfd212a1d16ba74d816a20e3273e73ec54838d8359501efad1755118e51c3
3
+ metadata.gz: 769af5be4c72d1dce0739d209f0db7002fa8816f9bd471acd0bed6b3904d8669
4
+ data.tar.gz: ad10d114debe205827a83f766363ef4221b4b15c2556593f70ac3000a6dcac52
5
5
  SHA512:
6
- metadata.gz: 3378f5acca6859363fe341814b483f0a8e70c0c8577497aec33330a8866ea733e87c04947a16110706bf4a207105ff846a328147b7f149f98f22d5ca226cb525
7
- data.tar.gz: 5ecb5de5b600ba2d83cf045770c9ab0c1cd9d23181f15b57942bc0f23d7a566463c469926bdabf336cd2b76b91fb81227b0a44887aedf36f661f558faae676a1
6
+ metadata.gz: 1938f2c92fdd5f4c0465b06a16e71c2648e2fac680e6a0b6ccf6fed7cbd68d21b8f0d7731a177b577bb38b99e3fc7206f6794fd1fd1629c4532b25cecc9646b6
7
+ data.tar.gz: c4fec94fd82d5a61776f2b707872718de2baf45165d0c5785037300aa21295417dd5f8d9a88f8b4b16d369c940300124b1036ec650cc9ce3fd3b961d4efb33a1
@@ -0,0 +1,2 @@
1
+
2
+ issuehunt: yuki-inoue
@@ -0,0 +1,48 @@
1
+ # Change Log
2
+
3
+ ## [v0.5.2](https://github.com/Yuki-Inoue/jupyter_on_rails/tree/v0.5.2) (2019-03-09)
4
+ [Full Changelog](https://github.com/Yuki-Inoue/jupyter_on_rails/compare/v0.5.1...v0.5.2)
5
+
6
+ ## [v0.5.1](https://github.com/Yuki-Inoue/jupyter_on_rails/tree/v0.5.1) (2019-03-09)
7
+ [Full Changelog](https://github.com/Yuki-Inoue/jupyter_on_rails/compare/v0.5.0...v0.5.1)
8
+
9
+ ## [v0.5.0](https://github.com/Yuki-Inoue/jupyter_on_rails/tree/v0.5.0) (2019-03-04)
10
+ [Full Changelog](https://github.com/Yuki-Inoue/jupyter_on_rails/compare/v0.4.2...v0.5.0)
11
+
12
+ ## [v0.4.2](https://github.com/Yuki-Inoue/jupyter_on_rails/tree/v0.4.2) (2019-03-04)
13
+ [Full Changelog](https://github.com/Yuki-Inoue/jupyter_on_rails/compare/v0.4.1...v0.4.2)
14
+
15
+ ## [v0.4.1](https://github.com/Yuki-Inoue/jupyter_on_rails/tree/v0.4.1) (2019-03-04)
16
+ [Full Changelog](https://github.com/Yuki-Inoue/jupyter_on_rails/compare/v0.4.0...v0.4.1)
17
+
18
+ **Merged pull requests:**
19
+
20
+ - Daru::DataFrame\#write\_model method [\#4](https://github.com/Yuki-Inoue/jupyter_on_rails/pull/4) ([Yuki-Inoue](https://github.com/Yuki-Inoue))
21
+
22
+ ## [v0.4.0](https://github.com/Yuki-Inoue/jupyter_on_rails/tree/v0.4.0) (2019-02-25)
23
+ [Full Changelog](https://github.com/Yuki-Inoue/jupyter_on_rails/compare/v0.3.4...v0.4.0)
24
+
25
+ ## [v0.3.4](https://github.com/Yuki-Inoue/jupyter_on_rails/tree/v0.3.4) (2019-02-25)
26
+ [Full Changelog](https://github.com/Yuki-Inoue/jupyter_on_rails/compare/v0.3.3...v0.3.4)
27
+
28
+ ## [v0.3.3](https://github.com/Yuki-Inoue/jupyter_on_rails/tree/v0.3.3) (2019-02-25)
29
+ [Full Changelog](https://github.com/Yuki-Inoue/jupyter_on_rails/compare/v0.3.2...v0.3.3)
30
+
31
+ ## [v0.3.2](https://github.com/Yuki-Inoue/jupyter_on_rails/tree/v0.3.2) (2019-02-25)
32
+ [Full Changelog](https://github.com/Yuki-Inoue/jupyter_on_rails/compare/v0.3.1...v0.3.2)
33
+
34
+ **Merged pull requests:**
35
+
36
+ - ActiveRecord::Base\#to\_df [\#3](https://github.com/Yuki-Inoue/jupyter_on_rails/pull/3) ([Yuki-Inoue](https://github.com/Yuki-Inoue))
37
+
38
+ ## [v0.3.1](https://github.com/Yuki-Inoue/jupyter_on_rails/tree/v0.3.1) (2019-02-02)
39
+ [Full Changelog](https://github.com/Yuki-Inoue/jupyter_on_rails/compare/v0.2.0...v0.3.1)
40
+
41
+ ## [v0.2.0](https://github.com/Yuki-Inoue/jupyter_on_rails/tree/v0.2.0) (2019-01-23)
42
+ **Merged pull requests:**
43
+
44
+ - Readme [\#1](https://github.com/Yuki-Inoue/jupyter_on_rails/pull/1) ([Yuki-Inoue](https://github.com/Yuki-Inoue))
45
+
46
+
47
+
48
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # JupyterOnRails
2
2
 
3
- Rails is loaded on jupyter dead easy.
3
+ Integrate Rails and Jupyter
4
4
 
5
5
  ![Alt text](the_screenshot.png?raw=true "Title")
6
6
 
@@ -67,7 +67,8 @@ User.to_df # => Daru::DataFrame is returned
67
67
  ### Daru::DataFrame#write_model
68
68
 
69
69
  For each row, call `to_h` and pass it to `model.new`.
70
- And then, imports them using `model.import`.
70
+ And then, imports them using `model.insert_all` on Rails >= 6, or `model.import` (requires adding
71
+ `activerecord-import` to your `Gemfile`).
71
72
 
72
73
  ```ruby
73
74
  df.write_model(User)
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["inoueyuworks@gmail.com"]
11
11
 
12
12
  spec.summary = %q{Integrate jupyter into rails}
13
- spec.description = %q{`rails jupyter:notebook` to open jupyter with rails app kernel of your project.}
13
+ spec.description = %q{Utilities for integrating jupyter and rails.}
14
14
  spec.homepage = "https://github.com/Yuki-Inoue/jupyter_on_rails"
15
15
 
16
16
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
@@ -29,18 +29,20 @@ Gem::Specification.new do |spec|
29
29
  # Specify which files should be added to the gem when it is released.
30
30
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
31
31
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
32
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
32
+ `git ls-files -z`.split("\x0")
33
+ .reject { |f| f.match(%r{^(test|spec|features)/}) }
34
+ .reject { |f| f.match(/\.png$/) }
33
35
  end
34
36
  spec.bindir = "exe"
35
37
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
38
  spec.require_paths = ["lib"]
37
39
 
38
- spec.add_development_dependency "bundler", "~> 1.17"
39
- spec.add_development_dependency "rake", "~> 10.0"
40
+ spec.add_development_dependency "rake"
41
+ spec.add_development_dependency 'github_changelog_generator'
42
+ spec.add_development_dependency 'bump'
40
43
 
41
44
  spec.add_dependency 'iruby'
42
45
  spec.add_dependency 'railties'
43
46
 
44
- spec.add_dependency 'activerecord-import'
45
47
  spec.add_dependency 'daru'
46
48
  end
@@ -19,6 +19,7 @@ module JupyterOnRails
19
19
  assocs = record.send(assoc)
20
20
  next [attrs] unless assocs.present?
21
21
 
22
+ assocs = [assocs] unless assocs.is_a?(ActiveRecord::Associations::CollectionProxy)
22
23
  assocs.map(&:attributes).map do |assoc_attrs|
23
24
  new_attrs = assoc_attrs.transform_keys do |key|
24
25
  "#{assoc}.#{key}".to_sym
@@ -2,10 +2,28 @@ module JupyterOnRails
2
2
  module Daru
3
3
  module DataFrameExt
4
4
  def write_model(model)
5
- require 'activerecord-import'
5
+ if ActiveRecord.version >= Gem::Version.new('6.0.0.beta1')
6
+ write_model_rails(model)
7
+ else
8
+ write_model_activerecord_import(model)
9
+ end
10
+ end
11
+
12
+ private
13
+
14
+ def write_model_activerecord_import(model)
15
+ begin
16
+ require 'activerecord-import'
17
+ rescue LoadError
18
+ raise 'write_model requires either Rails >= 6 or the activerecord-import gem'
19
+ end
20
+
21
+ records = map_rows(&:to_h).map(&model.method(:new))
22
+ model.import(records)
23
+ end
6
24
 
7
- objs = map_rows(&:to_h).map(&model.method(:new))
8
- model.import(objs)
25
+ def write_model_rails(model)
26
+ model.insert_all(map_rows(&:to_h))
9
27
  end
10
28
  end
11
29
  end
@@ -5,10 +5,10 @@ namespace :jupyter do
5
5
  desc 'start jupyter notebook'
6
6
  task :notebook do
7
7
  root = Rails.root
8
- ipython_dir = ENV['IPYTHONDIR'] || root / '.ipython'
8
+ ipython_dir = ENV['JUPYTER_DATA_DIR'] || ENV['IPYTHONDIR'] || root / '.ipython'
9
9
  ipython_dir = File.absolute_path(ipython_dir.to_s)
10
10
 
11
- sh "bundle exec iruby register --force --ipython-dir=#{Shellwords.shellescape(ipython_dir.to_s)}"
11
+ sh "JUPYTER_DATA_DIR=#{Shellwords.shellescape(ipython_dir.to_s)} bundle exec iruby register --force"
12
12
 
13
13
  sh "rm -rf #{Shellwords.shellescape(ipython_dir.to_s)}/kernels/rails"
14
14
  sh "cp -r #{Shellwords.shellescape(ipython_dir.to_s)}/kernels/ruby #{Shellwords.shellescape(ipython_dir.to_s)}/kernels/rails"
@@ -22,7 +22,7 @@ namespace :jupyter do
22
22
 
23
23
  File.write(kernel_file, JSON.dump(kernel_h))
24
24
 
25
- env = { 'IPYTHONDIR' => ipython_dir.to_s }
25
+ env = { 'JUPYTER_DATA_DIR' => ipython_dir.to_s }
26
26
  commands = %w[jupyter notebook]
27
27
  commands = %w[pipenv run] + commands if (root / 'Pipfile').exist?
28
28
  Process.exec(env, *commands)
@@ -1,3 +1,3 @@
1
1
  module JupyterOnRails
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.5'
3
3
  end
metadata CHANGED
@@ -1,51 +1,51 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jupyter_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki INOUE
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-04 00:00:00.000000000 Z
11
+ date: 2019-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.17'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.17'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: github_changelog_generator
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: iruby
42
+ name: bump
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
- type: :runtime
48
+ type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: railties
56
+ name: iruby
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: activerecord-import
70
+ name: railties
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -94,15 +94,16 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- description: "`rails jupyter:notebook` to open jupyter with rails app kernel of your
98
- project."
97
+ description: Utilities for integrating jupyter and rails.
99
98
  email:
100
99
  - inoueyuworks@gmail.com
101
100
  executables: []
102
101
  extensions: []
103
102
  extra_rdoc_files: []
104
103
  files:
104
+ - ".github/FUNDING.yml"
105
105
  - ".gitignore"
106
+ - CHANGELOG.md
106
107
  - Gemfile
107
108
  - README.md
108
109
  - Rakefile
@@ -117,7 +118,6 @@ files:
117
118
  - lib/jupyter_on_rails/railtie.rb
118
119
  - lib/jupyter_on_rails/railtie/jupyter.rake
119
120
  - lib/jupyter_on_rails/version.rb
120
- - the_screenshot.png
121
121
  homepage: https://github.com/Yuki-Inoue/jupyter_on_rails
122
122
  licenses: []
123
123
  metadata:
@@ -139,8 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  requirements: []
142
- rubyforge_project:
143
- rubygems_version: 2.7.6
142
+ rubygems_version: 3.0.3
144
143
  signing_key:
145
144
  specification_version: 4
146
145
  summary: Integrate jupyter into rails
Binary file