jupyter_on_rails 0.5.1 → 0.5.6

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: 826e285aa4040f231574001abfba2506642c04645fa227fe9e2b9c49d2b0a467
4
- data.tar.gz: 679a0d74778a877d9082d0d7ed76d6da999c99699dee7f58e3e1e88057565fa1
3
+ metadata.gz: 0e9bb122b865f0be411380b179256dcaec81418fb45b208a973b75cc95138c62
4
+ data.tar.gz: 060bb8671e299289e377c4119d3560265262356d859bb77de55e4c2714b201d6
5
5
  SHA512:
6
- metadata.gz: 0e09e893b88442dfc564bf15f250e0b1f816114205ab238907d39eb2f0b534bf8a86577111964e9095f72d9f5f59031191224daf6a8238d1085714c070f7f22b
7
- data.tar.gz: 5006e1adbf148be61a8e5ea8eb6542f6d1cb7ea9e74835710d6a7720ac1e026f1247d3dfe489cdd249585a87a19f28fdccdef8e2fc05d003c682343bfe5a7642
6
+ metadata.gz: bac938faecc1a941d74e3aaf2217784767af6c7245c6d4612a2c679c1455b9927246ea4db6c1cda6b23895badbc8533e1c9359870f919e8a69c218d6ed4a67af
7
+ data.tar.gz: da7b122b1abc9b90aa7f4f0c58ee803498fb61d426eec47b804eec2aef6f140c577f3ad67bcd59adf1051b8dedd8ea8766349f55f50d7d18e1c1f6445bf66ec7
@@ -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
@@ -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
@@ -5,6 +5,16 @@ module JupyterOnRails
5
5
  module ActiveRecordExt
6
6
  extend ::ActiveSupport::Concern
7
7
 
8
+ unless respond_to?(:class_methods)
9
+ def self.class_methods(&class_methods_module_definition)
10
+ mod = const_defined?(:ClassMethods, false) ?
11
+ const_get(:ClassMethods) :
12
+ const_set(:ClassMethods, Module.new)
13
+
14
+ mod.module_eval(&class_methods_module_definition)
15
+ end
16
+ end
17
+
8
18
  class_methods do
9
19
  def to_df
10
20
  relation = all
@@ -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
@@ -8,7 +8,7 @@ module JupyterOnRails
8
8
  original = Dir.pwd
9
9
  root = IRubyKernelExtention.root
10
10
  Dir.chdir root
11
- app_file = File.expand_path('config/application.rb', root)
11
+ app_file = File.expand_path('config/environment.rb', root)
12
12
  require app_file
13
13
  Rails.application.require_environment!
14
14
  Dir.chdir original
@@ -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.1'
2
+ VERSION = '0.5.6'
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.1
4
+ version: 0.5.6
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-09 00:00:00.000000000 Z
11
+ date: 2020-03-15 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,22 +94,21 @@ 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
109
110
  - bin/console
110
111
  - bin/setup
111
- - doc/screenshot-1.png
112
- - doc/screenshot-2.png
113
112
  - jupyter_on_rails.gemspec
114
113
  - lib/jupyter_on_rails.rb
115
114
  - lib/jupyter_on_rails/boot.rb
@@ -119,7 +118,6 @@ files:
119
118
  - lib/jupyter_on_rails/railtie.rb
120
119
  - lib/jupyter_on_rails/railtie/jupyter.rake
121
120
  - lib/jupyter_on_rails/version.rb
122
- - the_screenshot.png
123
121
  homepage: https://github.com/Yuki-Inoue/jupyter_on_rails
124
122
  licenses: []
125
123
  metadata:
@@ -141,8 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
139
  - !ruby/object:Gem::Version
142
140
  version: '0'
143
141
  requirements: []
144
- rubyforge_project:
145
- rubygems_version: 2.7.6
142
+ rubygems_version: 3.1.2
146
143
  signing_key:
147
144
  specification_version: 4
148
145
  summary: Integrate jupyter into rails
Binary file