notebroker 0.1.0 → 0.1.1

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: 966658274251d2f4ada02bd952ea13089c823290073ba9920abf7450aaa6f84b
4
- data.tar.gz: 6efd22a408432c4d3becb0f06de6694366d86c93f633553730c3f19e03e89439
3
+ metadata.gz: 56b2b13742117077a4c4e7f2281eb59e9b4a4cdc6c3dda9a6454d2e058c5f7c6
4
+ data.tar.gz: d5c5fe760a5cf1e97d76c5d86ffea66f869ccb4c7402ce50c5a9127558c650c3
5
5
  SHA512:
6
- metadata.gz: 9322946fac86264abc9e05431633c8923c822a85fdad23c66796cd97550e93fb8c2d79453d77822be142765ac072ae08691c5b0ebd06531154c7c27087df58d6
7
- data.tar.gz: e13c1d6d050e531d1a355d624dc251f9165eb1bf212bcdd4659039ac1760e658fa21561d7ea7e0ffdacb055ff268a68da982e42e7348b426255471918056c43b
6
+ metadata.gz: 91bf3011d1a37a30c6f72ce6ff2e829274828e0af09155ee06a100e0ced214b18ab20f1d0db95c5afd4351a8d5f430a9019eabd1501f053862c68ee0af97a6fe
7
+ data.tar.gz: b50b06496b9af843f385851ff806c1fdf6905ea19226a17426cfaf3c4f0485fdefde8350a6a8d667d623ac9006437a92858690c4d83d0aba81e58a867fc308dc
data/Gemfile CHANGED
@@ -4,6 +4,8 @@ source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
+ gem "rake"
8
+
7
9
  group :development, :test do
8
10
  gem "byebug"
9
11
  gem "pry"
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- notebroker (0.1.0)
5
- dry-cli
6
- dry-initializer
4
+ notebroker (0.1.1)
5
+ dry-cli (~> 0.7.0)
6
+ dry-initializer (~> 3.1.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -33,6 +33,7 @@ GEM
33
33
  method_source (~> 1.0)
34
34
  racc (1.6.0)
35
35
  rainbow (3.1.1)
36
+ rake (13.0.6)
36
37
  regexp_parser (2.2.1)
37
38
  reverse_markdown (2.1.1)
38
39
  nokogiri
@@ -98,6 +99,7 @@ DEPENDENCIES
98
99
  byebug
99
100
  notebroker!
100
101
  pry
102
+ rake
101
103
  rspec
102
104
  rubocop
103
105
  rubocop-performance
data/README.md CHANGED
@@ -43,6 +43,152 @@ Converting notebooks/my-notebook.ipynb into markdown...
43
43
  Saved markdown file to ./
44
44
  ```
45
45
 
46
+ ## Formatting
47
+
48
+ This is an example of the input and converted markdown file generated:
49
+
50
+ ### Input
51
+
52
+ ```json
53
+ {
54
+ "cells": [
55
+ {
56
+ "cell_type": "markdown",
57
+ "id": "3715d426-5951-4b56-b202-2457e1f7742f",
58
+ "metadata": {},
59
+ "source": [
60
+ "# Test file 1\n",
61
+ "\n",
62
+ "This is the first line.\n",
63
+ "\n",
64
+ "This is the end of the first section"
65
+ ]
66
+ },
67
+ {
68
+ "cell_type": "code",
69
+ "execution_count": null,
70
+ "id": "206fb993-c482-49fa-aa50-95aa25dcff71",
71
+ "metadata": {},
72
+ "outputs": [],
73
+ "source": [
74
+ "import code\n",
75
+ "\n",
76
+ "def a_function(some_parameter):\n",
77
+ " return some_parameter\n",
78
+ "\n",
79
+ "def calculate_something(n):\n",
80
+ " '''\n",
81
+ " this is a comment\n",
82
+ " '''\n",
83
+ " \n",
84
+ " # This is another comment\n",
85
+ " return something"
86
+ ]
87
+ },
88
+ {
89
+ "cell_type": "markdown",
90
+ "id": "b09f90d3-97f1-4ed4-903e-4e62060e35e5",
91
+ "metadata": {},
92
+ "source": [
93
+ "## Subheader: The third cell\n",
94
+ "\n",
95
+ "A single line in the third cell\n"
96
+ ]
97
+ },
98
+ {
99
+ "cell_type": "code",
100
+ "execution_count": 7,
101
+ "id": "bea26222-75b8-4cf6-9367-52c94344dd8e",
102
+ "metadata": {},
103
+ "outputs": [
104
+ {
105
+ "name": "stdout",
106
+ "output_type": "stream",
107
+ "text": [
108
+ "This is the result of a cell\n",
109
+ "----------------------------------------\n",
110
+ "Total amount paid will be $251,717.22\n"
111
+ ]
112
+ }
113
+ ],
114
+ "source": [
115
+ "print(\"This is the result of a cell\")\n",
116
+ "print(\"Total amount paid will be ${:,.2f}\".format(total_amount))"
117
+ ]
118
+ },
119
+ {
120
+ "cell_type": "code",
121
+ "execution_count": null,
122
+ "id": "477b0f9b-5d79-4275-966b-4ef38a6dfc2d",
123
+ "metadata": {},
124
+ "outputs": [],
125
+ "source": []
126
+ }
127
+ ],
128
+ "metadata": {
129
+ "kernelspec": {
130
+ "display_name": "Python 3 (ipykernel)",
131
+ "language": "python",
132
+ "name": "python3"
133
+ },
134
+ "language_info": {
135
+ "codemirror_mode": {
136
+ "name": "ipython",
137
+ "version": 3
138
+ },
139
+ "file_extension": ".py",
140
+ "mimetype": "text/x-python",
141
+ "name": "python",
142
+ "nbconvert_exporter": "python",
143
+ "pygments_lexer": "ipython3",
144
+ "version": "3.9.10"
145
+ }
146
+ },
147
+ "nbformat": 4,
148
+ "nbformat_minor": 5
149
+ }
150
+ ```
151
+
152
+ ### Output
153
+
154
+ ````markdown
155
+ # Test file 1
156
+
157
+ This is the first line.
158
+
159
+ This is the end of the first section
160
+
161
+ ``python
162
+ import code
163
+
164
+ def a_function(some_parameter):
165
+ return some_parameter
166
+
167
+ def calculate_something(n):
168
+ '''
169
+ this is a comment
170
+ '''
171
+
172
+ # This is another comment
173
+ return something
174
+ ```
175
+
176
+ ## Subheader: The third cell
177
+
178
+ A single line in the third cell
179
+
180
+ ```python
181
+ print("This is the result of a cell")
182
+ print("Total amount paid will be ${:,.2f}".format(total_amount))
183
+ ```
184
+
185
+ ```shell
186
+ This is the result of a cell
187
+ ----------------------------------------
188
+ Total amount paid will be $251,717.22
189
+ ```
190
+ ````
191
+
46
192
  ## Development
47
193
 
48
194
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/exe/notebroker ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require "notebroker"
3
+
4
+ Dry::CLI.new(Notebroker::CLI::Commands).call
@@ -9,7 +9,6 @@ module Notebroker
9
9
 
10
10
  param :source
11
11
 
12
- # @param String
13
12
  def call
14
13
  parsed = JSON.parse(source, symbolize_names: true)
15
14
  result = Lexer.call(parsed[:cells])
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Notebroker
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/notebroker/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "notebroker"
7
+ spec.version = Notebroker::VERSION
8
+ spec.authors = ["Nolan J Tait"]
9
+ spec.email = ["nolanjtait@gmail.com"]
10
+
11
+ spec.summary = "A gem for turning notebooks into other formats"
12
+ spec.description = "A ruby based CLI to turn python notebook ipynb files into other formats"
13
+ spec.homepage = "https://github.com/nolantait/notebroker"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 3.1.0"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+ spec.metadata["changelog_uri"] = spec.homepage
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject do |f|
25
+ (f == __FILE__) ||
26
+ f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
27
+ end
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r(\Aexe/)) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ # Uncomment to register a new dependency of your gem
34
+ spec.add_dependency "dry-cli", "~> 0.7.0"
35
+ spec.add_dependency "dry-initializer", "~> 3.1.1"
36
+
37
+ # For more information and examples about making a new gem, check out our
38
+ # guide at: https://bundler.io/guides/creating_gem.html
39
+ spec.metadata["rubygems_mfa_required"] = "true"
40
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notebroker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nolan J Tait
@@ -41,7 +41,8 @@ dependencies:
41
41
  description: A ruby based CLI to turn python notebook ipynb files into other formats
42
42
  email:
43
43
  - nolanjtait@gmail.com
44
- executables: []
44
+ executables:
45
+ - notebroker
45
46
  extensions: []
46
47
  extra_rdoc_files: []
47
48
  files:
@@ -53,6 +54,7 @@ files:
53
54
  - LICENSE.txt
54
55
  - README.md
55
56
  - Rakefile
57
+ - exe/notebroker
56
58
  - lib/notebroker.rb
57
59
  - lib/notebroker/callable.rb
58
60
  - lib/notebroker/cells/code.rb
@@ -62,6 +64,7 @@ files:
62
64
  - lib/notebroker/lexer.rb
63
65
  - lib/notebroker/markdown.rb
64
66
  - lib/notebroker/version.rb
67
+ - notebroker.gemspec
65
68
  homepage: https://github.com/nolantait/notebroker
66
69
  licenses:
67
70
  - MIT