ipynbdiff 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +6 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +2 -1
- data/README.md +6 -6
- data/ipynbdiff.gemspec +1 -1
- data/lib/ipynbdiff.rb +7 -7
- data/lib/transformer.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24615c877db39efeb4b4d0effe014db5a7734f6be88385aaf73bc00622075ca8
|
4
|
+
data.tar.gz: 2aca335aa15c5e413eaa23d197f3f9a0f73d6415adbafcb419cf7764eb983e89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 280688c5f5f722cea1868963dcf49eefdb3c35374fad96522d7f8b8a7c77b902d11db1b2b5dd1cde3370065159cee4f1c1f252b1a15f585c589abdc9ede02e1f
|
7
|
+
data.tar.gz: 50de3ac58248b4af0e67d2e68a476a3c8395753a47638c7ca2015d7c909d55031f605f5334be54d909fd40e5728912623909b7fc3f73f8544b0828dd1e9e6a1a
|
data/.gitlab-ci.yml
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -28,16 +28,16 @@ Options:
|
|
28
28
|
|
29
29
|
```ruby
|
30
30
|
@default_transform_options = {
|
31
|
-
preprocess_input:
|
31
|
+
preprocess_input: true, # Whether the input should be transformed
|
32
32
|
write_output_to: nil, # Pass a path to save the output to a file
|
33
33
|
format: :text, # These are the formats Diffy accepts https://github.com/samg/diffy
|
34
|
-
sources_are_files:
|
35
|
-
raise_if_invalid_notebook:
|
34
|
+
sources_are_files: false, # Weather to use the from/to as string or path to a file
|
35
|
+
raise_if_invalid_notebook: false, # Raises an error if the notebooks are invalid, otherwise returns nil
|
36
36
|
transform_options: @default_transform_options, # See below for transform options
|
37
37
|
diff_opts: {
|
38
|
-
include_diff_info:
|
38
|
+
include_diff_info: false # These are passed to Diffy https://github.com/samg/diffy
|
39
39
|
}
|
40
|
-
}
|
40
|
+
}
|
41
41
|
```
|
42
42
|
|
43
43
|
### Transforming the notebooks
|
@@ -52,7 +52,7 @@ Options:
|
|
52
52
|
|
53
53
|
```ruby
|
54
54
|
@default_transform_options = {
|
55
|
-
include_metadata:
|
55
|
+
include_metadata: false, # Whether to include or not the notebook metadata (kernel, language, etc)
|
56
56
|
cell_decorator: :html # :html is useful to add styling with css, :percent is better for text format
|
57
57
|
}
|
58
58
|
```
|
data/ipynbdiff.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'ipynbdiff'
|
5
|
-
s.version = '
|
5
|
+
s.version = ENV['LIB_VERSION']
|
6
6
|
s.summary = 'Human Readable diffs for Jupyter Notebooks'
|
7
7
|
s.description = 'Better diff for Jupyter Notebooks by first preprocessing them and removing clutter'
|
8
8
|
s.authors = ['Eduardo Bonet']
|
data/lib/ipynbdiff.rb
CHANGED
@@ -6,19 +6,19 @@ module IpynbDiff
|
|
6
6
|
require 'diffy'
|
7
7
|
|
8
8
|
@default_transform_options = {
|
9
|
-
include_metadata:
|
9
|
+
include_metadata: false,
|
10
10
|
cell_decorator: :html
|
11
11
|
}
|
12
12
|
|
13
13
|
@default_diff_options = {
|
14
|
-
preprocess_input:
|
14
|
+
preprocess_input: true,
|
15
15
|
write_output_to: nil,
|
16
16
|
format: :text,
|
17
|
-
sources_are_files:
|
18
|
-
raise_if_invalid_notebook:
|
17
|
+
sources_are_files: false,
|
18
|
+
raise_if_invalid_notebook: false,
|
19
19
|
transform_options: @default_transform_options,
|
20
20
|
diff_opts: {
|
21
|
-
include_diff_info:
|
21
|
+
include_diff_info: false
|
22
22
|
}
|
23
23
|
}.freeze
|
24
24
|
|
@@ -27,7 +27,7 @@ module IpynbDiff
|
|
27
27
|
|
28
28
|
prep = to_prepare
|
29
29
|
prep = File.read(prep) if options[:sources_are_files]
|
30
|
-
prep = transform(prep, raise_errors:
|
30
|
+
prep = transform(prep, raise_errors: true, options: options[:transform_options]) if options[:preprocess_input]
|
31
31
|
prep
|
32
32
|
end
|
33
33
|
|
@@ -48,7 +48,7 @@ module IpynbDiff
|
|
48
48
|
raise if options[:raise_if_invalid_notebook]
|
49
49
|
end
|
50
50
|
|
51
|
-
def self.transform(notebook, raise_errors:
|
51
|
+
def self.transform(notebook, raise_errors: false, options: @default_transform_options)
|
52
52
|
options = @default_transform_options.merge(options)
|
53
53
|
|
54
54
|
Transformer.new(**options).transform(notebook)
|
data/lib/transformer.rb
CHANGED
@@ -11,10 +11,10 @@ module IpynbDiff
|
|
11
11
|
require 'output_transformer'
|
12
12
|
|
13
13
|
@cell_decorator = :html
|
14
|
-
@include_metadata =
|
14
|
+
@include_metadata = true
|
15
15
|
|
16
16
|
|
17
|
-
def initialize(include_metadata:
|
17
|
+
def initialize(include_metadata: true, cell_decorator: :html)
|
18
18
|
@include_metadata = include_metadata
|
19
19
|
@cell_decorator = cell_decorator
|
20
20
|
@output_transformer = OutputTransformer.new
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ipynbdiff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Bonet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diffy
|
@@ -116,6 +116,7 @@ extensions: []
|
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
118
|
- ".gitignore"
|
119
|
+
- ".gitlab-ci.yml"
|
119
120
|
- Gemfile
|
120
121
|
- Gemfile.lock
|
121
122
|
- README.md
|