elastic-kernel 0.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. elastic_kernel/__init__.py +0 -0
  2. elastic_kernel/command.py +43 -0
  3. elastic_kernel/kernel.json +5 -0
  4. elastic_kernel/kernel.py +258 -0
  5. elastic_kernel-0.0.2.dist-info/METADATA +291 -0
  6. elastic_kernel-0.0.2.dist-info/RECORD +42 -0
  7. elastic_kernel-0.0.2.dist-info/WHEEL +5 -0
  8. elastic_kernel-0.0.2.dist-info/entry_points.txt +2 -0
  9. elastic_kernel-0.0.2.dist-info/licenses/LICENSE +201 -0
  10. elastic_kernel-0.0.2.dist-info/top_level.txt +2 -0
  11. elastic_notebook/__init__.py +0 -0
  12. elastic_notebook/algorithm/__init__.py +0 -0
  13. elastic_notebook/algorithm/baseline.py +31 -0
  14. elastic_notebook/algorithm/optimizer_exact.py +121 -0
  15. elastic_notebook/algorithm/selector.py +41 -0
  16. elastic_notebook/core/__init__.py +0 -0
  17. elastic_notebook/core/common/__init__.py +0 -0
  18. elastic_notebook/core/common/checkpoint_file.py +129 -0
  19. elastic_notebook/core/common/profile_graph_size.py +39 -0
  20. elastic_notebook/core/common/profile_migration_speed.py +69 -0
  21. elastic_notebook/core/common/profile_variable_size.py +66 -0
  22. elastic_notebook/core/graph/__init__.py +0 -0
  23. elastic_notebook/core/graph/cell_execution.py +39 -0
  24. elastic_notebook/core/graph/graph.py +75 -0
  25. elastic_notebook/core/graph/variable_snapshot.py +31 -0
  26. elastic_notebook/core/io/__init__.py +0 -0
  27. elastic_notebook/core/io/adapter.py +18 -0
  28. elastic_notebook/core/io/filesystem_adapter.py +30 -0
  29. elastic_notebook/core/io/migrate.py +98 -0
  30. elastic_notebook/core/io/pickle.py +71 -0
  31. elastic_notebook/core/io/recover.py +51 -0
  32. elastic_notebook/core/mutation/__init__.py +0 -0
  33. elastic_notebook/core/mutation/fingerprint.py +184 -0
  34. elastic_notebook/core/mutation/id_graph.py +147 -0
  35. elastic_notebook/core/mutation/object_hash.py +204 -0
  36. elastic_notebook/core/notebook/__init__.py +0 -0
  37. elastic_notebook/core/notebook/checkpoint.py +222 -0
  38. elastic_notebook/core/notebook/find_input_vars.py +117 -0
  39. elastic_notebook/core/notebook/find_output_vars.py +18 -0
  40. elastic_notebook/core/notebook/restore_notebook.py +91 -0
  41. elastic_notebook/core/notebook/update_graph.py +46 -0
  42. elastic_notebook/elastic_notebook.py +336 -0
File without changes
@@ -0,0 +1,43 @@
1
+ import sys
2
+ from pathlib import Path
3
+
4
+ from setuptools.command.install import install
5
+
6
+
7
+ def install_kernel():
8
+ try:
9
+ import os
10
+
11
+ from jupyter_client.kernelspec import install_kernel_spec
12
+
13
+ import elastic_kernel
14
+ except ImportError:
15
+ print("jupyter_clientまたはelastic_kernelがインストールされていません。")
16
+ return False
17
+
18
+ # elastic_kernelパッケージの実際のパスを取得
19
+ kernel_dir = Path(os.path.dirname(elastic_kernel.__file__))
20
+ install_kernel_spec(
21
+ str(kernel_dir), kernel_name="elastic_kernel", user=True, replace=True
22
+ )
23
+ print(f"Elastic Kernel installed from: {kernel_dir}")
24
+ return True
25
+
26
+
27
+ class PostInstallCommand(install):
28
+ def run(self):
29
+ install.run(self)
30
+ print("=== Elastic Kernel: Installing Jupyter kernel ===")
31
+ install_kernel()
32
+
33
+
34
+ def main():
35
+ if len(sys.argv) > 1 and sys.argv[1] == "install":
36
+ install_kernel()
37
+ else:
38
+ print("Usage: elastic-kernel install", file=sys.stderr)
39
+ sys.exit(1)
40
+
41
+
42
+ if __name__ == "__main__":
43
+ main()
@@ -0,0 +1,5 @@
1
+ {
2
+ "display_name": "Python 3 (Elastic)",
3
+ "language": "python",
4
+ "argv": ["python", "-m", "elastic_kernel.kernel", "-f", "{connection_file}"]
5
+ }
@@ -0,0 +1,258 @@
1
+ import logging
2
+ import os
3
+ import traceback
4
+ from datetime import datetime, timedelta, timezone
5
+ from logging.handlers import RotatingFileHandler
6
+
7
+ from ipykernel.ipkernel import IPythonKernel
8
+
9
+ from elastic_notebook.elastic_notebook import ElasticNotebook
10
+
11
+
12
+ class JSTFormatter(logging.Formatter):
13
+ """日本時間(JST)用のログフォーマッター"""
14
+
15
+ def converter(self, timestamp):
16
+ dt = datetime.fromtimestamp(timestamp)
17
+ return dt.astimezone(timezone(timedelta(hours=9))) # UTC+9
18
+
19
+ def formatTime(self, record, datefmt=None):
20
+ dt = self.converter(record.created)
21
+ if datefmt:
22
+ return dt.strftime(datefmt)
23
+ return dt.strftime("%Y-%m-%d %H:%M:%S.%f")[:-3] # マイクロ秒を3桁まで表示
24
+
25
+
26
+ class ElasticKernel(IPythonKernel):
27
+ implementation = "ElasticKernel"
28
+ implementation_version = "1.0"
29
+ language = "python"
30
+ language_version = "3.x"
31
+ language_info = {
32
+ "name": "python",
33
+ "mimetype": "text/x-python",
34
+ "file_extension": ".py",
35
+ }
36
+ banner = "ElasticKernel"
37
+
38
+ def __init__(self, **kwargs):
39
+ super().__init__(**kwargs)
40
+
41
+ self.logger: logging.Logger
42
+ self.log_file_path: str
43
+ self.checkpoint_file_path: str
44
+
45
+ self.__setup_file_path()
46
+ self.__setup_logger()
47
+
48
+ # connection_fileからカーネルIDを取得
49
+ connection_file = self.session.config["IPKernelApp"]["connection_file"]
50
+ kernel_id = os.path.splitext(os.path.basename(connection_file))[0].replace(
51
+ "kernel-", ""
52
+ )
53
+
54
+ self.logger.info("===============================================")
55
+ self.logger.info(f"Initializing ElasticKernel ({kernel_id})")
56
+ self.logger.debug("Session attributes:")
57
+ for key, value in vars(self.session).items():
58
+ self.logger.debug(f" - {key}: {value}")
59
+ self.logger.info("===============================================")
60
+
61
+ # コマンドライン引数を取得
62
+ # ===========================================
63
+ # !!!!!開発時のみ!!!!!本番環境ではコメントアウトすること!!!!!
64
+ # env = os.environ
65
+ # self.logger.debug(f"Environment: {env}")
66
+ # self.logger.debug(f"Kernel Args: {sys.argv}")
67
+ # self.logger.debug(f"kwargs: {kwargs}")
68
+ # self.logger.debug(f"self.shell: {self.shell}")
69
+ # ===========================================
70
+
71
+ # ElasticNotebookをロードする
72
+ try:
73
+ self.elastic_notebook = ElasticNotebook(self.shell)
74
+ self.logger.info("ElasticNotebook successfully loaded.")
75
+ except Exception as e:
76
+ self.logger.error(f"Error loading ElasticNotebook: {e}")
77
+
78
+ # チェックポイントファイルをロードする
79
+ if os.path.exists(self.checkpoint_file_path):
80
+ self.logger.info("Checkpoint file exists. Loading checkpoint.")
81
+ try:
82
+ start_time = datetime.now(timezone(timedelta(hours=9)))
83
+ self.logger.info(f"Loading checkpoint started at: {start_time}")
84
+
85
+ self.elastic_notebook.load_checkpoint(self.checkpoint_file_path)
86
+
87
+ end_time = datetime.now(timezone(timedelta(hours=9)))
88
+ loading_time = end_time - start_time
89
+ self.logger.info(f"Loading checkpoint finished at: {end_time}")
90
+ self.logger.info(f"Total loading time: {loading_time}")
91
+
92
+ self.logger.debug(
93
+ f"{self.elastic_notebook.dependency_graph.variable_snapshots=}"
94
+ )
95
+ self.logger.debug(f"{self.shell.user_ns=}")
96
+ self.logger.info("Checkpoint successfully loaded.")
97
+
98
+ except Exception as e:
99
+ self.logger.error(f"Error loading checkpoint: {e}")
100
+ self.logger.error(f"Error details:\n{traceback.format_exc()}")
101
+ else:
102
+ self.logger.info(
103
+ "Checkpoint file does not exist. Skipping loading checkpoint."
104
+ )
105
+
106
+ def __setup_file_path(self):
107
+ # ファイルのパスを設定
108
+ # JPY_SESSION_NAME=/home/vscode/Untitled1.ipynbのような感じ
109
+ jupyter_notebook_path = os.environ.get("JPY_SESSION_NAME")
110
+ if jupyter_notebook_path is None:
111
+ root_dir = os.environ.get("HOME")
112
+ if root_dir is None:
113
+ raise ValueError(
114
+ "JPY_SESSION_NAME or HOME environment variable is not set."
115
+ )
116
+ jupyter_notebook_name = "Untitled"
117
+ else:
118
+ root_dir = os.path.dirname(jupyter_notebook_path)
119
+ # ファイル名から拡張子を取り除く
120
+ jupyter_notebook_name = os.path.splitext(
121
+ os.path.basename(jupyter_notebook_path)
122
+ )[0]
123
+
124
+ # フォルダの作成
125
+ elastic_kernel_dir = os.path.join(root_dir, ".elastic_kernel")
126
+ os.makedirs(elastic_kernel_dir, exist_ok=True)
127
+
128
+ self.log_file_path = os.path.join(
129
+ elastic_kernel_dir, jupyter_notebook_name + ".log"
130
+ )
131
+ self.checkpoint_file_path = os.path.join(
132
+ elastic_kernel_dir, jupyter_notebook_name + ".pickle"
133
+ )
134
+
135
+ def __setup_logger(self):
136
+ # ロガーの設定
137
+ self.logger = logging.getLogger("ElasticKernelLogger")
138
+
139
+ # 環境変数からログレベルを取得
140
+ log_level_str = os.environ.get("ELASTIC_KERNEL_LOG_LEVEL", "INFO").upper()
141
+ log_level = getattr(logging, log_level_str, logging.INFO)
142
+ self.logger.setLevel(log_level)
143
+
144
+ formatter = JSTFormatter(
145
+ "[%(asctime)s ElasticKernelLogger %(levelname)s] %(message)s",
146
+ "%Y-%m-%d %H:%M:%S.%f",
147
+ )
148
+
149
+ # コンソールハンドラー
150
+ console_handler = logging.StreamHandler()
151
+ console_handler.setLevel(log_level)
152
+ console_handler.setFormatter(formatter)
153
+ self.logger.addHandler(console_handler)
154
+
155
+ # ローテーティングファイルハンドラー
156
+ rotating_file_handler = RotatingFileHandler(
157
+ self.log_file_path,
158
+ maxBytes=5 * 1024 * 1024,
159
+ backupCount=5, # 5MBのログサイズでローテーション、5世代保存
160
+ )
161
+ rotating_file_handler.setLevel(log_level)
162
+ rotating_file_handler.setFormatter(formatter)
163
+ self.logger.addHandler(rotating_file_handler)
164
+
165
+ def __del_from_user_ns_hidden(self):
166
+ # %whoで表示されるようにするために復元した変数をself.shell.user_ns_hiddenから削除する
167
+ self.logger.debug(f"Initial {self.shell.user_ns_hidden=}")
168
+ JPY_SESSION_NAME = os.environ.get("JPY_SESSION_NAME")
169
+ self.logger.debug(f"JPY_SESSION_NAME: {JPY_SESSION_NAME}")
170
+ self.logger.debug(
171
+ f"user_ns.__session__: {self.shell.user_ns.get('__session__')}"
172
+ )
173
+
174
+ variable_snapshots = set(
175
+ self.elastic_notebook.dependency_graph.variable_snapshots
176
+ )
177
+ user_ns_hidden_keys = set(self.shell.user_ns_hidden.keys())
178
+
179
+ # 削除対象の変数名を一括で取得
180
+ variables_to_delete = variable_snapshots & user_ns_hidden_keys
181
+
182
+ # 一括で削除
183
+ for variable_name in variables_to_delete:
184
+ self.logger.debug(
185
+ f"Deleting {variable_name} from self.shell.user_ns_hidden"
186
+ )
187
+ del self.shell.user_ns_hidden[variable_name]
188
+
189
+ self.logger.debug(f"Final {self.shell.user_ns_hidden=}")
190
+
191
+ def __skip_record(self, code):
192
+ skip_magic_commands = ["!", "%", "%%"]
193
+ is_magic_command = any(
194
+ code.strip().startswith(magic) for magic in skip_magic_commands
195
+ )
196
+ if is_magic_command:
197
+ return True
198
+
199
+ # TODO: bashなどpythonコードではない場合はスキップする
200
+
201
+ return False
202
+
203
+ def do_execute(
204
+ self, code, silent, store_history=True, user_expressions=None, allow_stdin=False
205
+ ):
206
+ self.logger.debug(f"Executing Code:\n{code}")
207
+ result = super().do_execute(
208
+ code, silent, store_history, user_expressions, allow_stdin
209
+ )
210
+
211
+ if not self.__skip_record(code):
212
+ self.elastic_notebook.record_event(code)
213
+ self.logger.debug("Recording event")
214
+ else:
215
+ self.logger.debug("Skipping record event")
216
+
217
+ # TODO: ここで毎回呼ぶのは効率悪いのでは?
218
+ self.__del_from_user_ns_hidden()
219
+
220
+ return result
221
+
222
+ def do_shutdown(self, restart):
223
+ self.logger.debug("Shutting Down Kernel")
224
+ try:
225
+ start_time = datetime.now(timezone(timedelta(hours=9)))
226
+ self.logger.info(f"Saving checkpoint started at: {start_time}")
227
+
228
+ self.elastic_notebook.checkpoint(self.checkpoint_file_path)
229
+
230
+ end_time = datetime.now(timezone(timedelta(hours=9)))
231
+ saving_time = end_time - start_time
232
+ self.logger.info(f"Saving checkpoint finished at: {end_time}")
233
+ self.logger.info(f"Total saving time: {saving_time}")
234
+
235
+ self.logger.info("Checkpoint successfully saved.")
236
+ self.logger.info(
237
+ f"マイグレートする変数の数:{len(self.elastic_notebook.vss_to_migrate)}"
238
+ )
239
+ self.logger.debug(
240
+ f"マイグレートする変数:{self.elastic_notebook.vss_to_migrate}"
241
+ )
242
+ self.logger.info(
243
+ f"再計算する変数の数:{len(self.elastic_notebook.vss_to_recompute)}"
244
+ )
245
+ self.logger.debug(
246
+ f"再計算する変数:{self.elastic_notebook.vss_to_recompute}"
247
+ )
248
+
249
+ except Exception as e:
250
+ self.logger.error(f"Error saving checkpoint: {e}")
251
+ self.logger.error(f"Error details:\n{traceback.format_exc()}")
252
+ return super().do_shutdown(restart)
253
+
254
+
255
+ if __name__ == "__main__":
256
+ from ipykernel import kernelapp as app
257
+
258
+ app.launch_new_instance(kernel_class=ElasticKernel)
@@ -0,0 +1,291 @@
1
+ Metadata-Version: 2.4
2
+ Name: elastic-kernel
3
+ Version: 0.0.2
4
+ Summary: Elastic kernel for Jupyter with automatic checkpoint and dependency tracking
5
+ Author-email: ryutarom <m2002r1028@icloud.com>
6
+ License: Apache License
7
+ Version 2.0, January 2004
8
+ http://www.apache.org/licenses/
9
+
10
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ 1. Definitions.
13
+
14
+ "License" shall mean the terms and conditions for use, reproduction,
15
+ and distribution as defined by Sections 1 through 9 of this document.
16
+
17
+ "Licensor" shall mean the copyright owner or entity authorized by
18
+ the copyright owner that is granting the License.
19
+
20
+ "Legal Entity" shall mean the union of the acting entity and all
21
+ other entities that control, are controlled by, or are under common
22
+ control with that entity. For the purposes of this definition,
23
+ "control" means (i) the power, direct or indirect, to cause the
24
+ direction or management of such entity, whether by contract or
25
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
26
+ outstanding shares, or (iii) beneficial ownership of such entity.
27
+
28
+ "You" (or "Your") shall mean an individual or Legal Entity
29
+ exercising permissions granted by this License.
30
+
31
+ "Source" form shall mean the preferred form for making modifications,
32
+ including but not limited to software source code, documentation
33
+ source, and configuration files.
34
+
35
+ "Object" form shall mean any form resulting from mechanical
36
+ transformation or translation of a Source form, including but
37
+ not limited to compiled object code, generated documentation,
38
+ and conversions to other media types.
39
+
40
+ "Work" shall mean the work of authorship, whether in Source or
41
+ Object form, made available under the License, as indicated by a
42
+ copyright notice that is included in or attached to the work
43
+ (an example is provided in the Appendix below).
44
+
45
+ "Derivative Works" shall mean any work, whether in Source or Object
46
+ form, that is based on (or derived from) the Work and for which the
47
+ editorial revisions, annotations, elaborations, or other modifications
48
+ represent, as a whole, an original work of authorship. For the purposes
49
+ of this License, Derivative Works shall not include works that remain
50
+ separable from, or merely link (or bind by name) to the interfaces of,
51
+ the Work and Derivative Works thereof.
52
+
53
+ "Contribution" shall mean any work of authorship, including
54
+ the original version of the Work and any modifications or additions
55
+ to that Work or Derivative Works thereof, that is intentionally
56
+ submitted to Licensor for inclusion in the Work by the copyright owner
57
+ or by an individual or Legal Entity authorized to submit on behalf of
58
+ the copyright owner. For the purposes of this definition, "submitted"
59
+ means any form of electronic, verbal, or written communication sent
60
+ to the Licensor or its representatives, including but not limited to
61
+ communication on electronic mailing lists, source code control systems,
62
+ and issue tracking systems that are managed by, or on behalf of, the
63
+ Licensor for the purpose of discussing and improving the Work, but
64
+ excluding communication that is conspicuously marked or otherwise
65
+ designated in writing by the copyright owner as "Not a Contribution."
66
+
67
+ "Contributor" shall mean Licensor and any individual or Legal Entity
68
+ on behalf of whom a Contribution has been received by Licensor and
69
+ subsequently incorporated within the Work.
70
+
71
+ 2. Grant of Copyright License. Subject to the terms and conditions of
72
+ this License, each Contributor hereby grants to You a perpetual,
73
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
+ copyright license to reproduce, prepare Derivative Works of,
75
+ publicly display, publicly perform, sublicense, and distribute the
76
+ Work and such Derivative Works in Source or Object form.
77
+
78
+ 3. Grant of Patent License. Subject to the terms and conditions of
79
+ this License, each Contributor hereby grants to You a perpetual,
80
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
81
+ (except as stated in this section) patent license to make, have made,
82
+ use, offer to sell, sell, import, and otherwise transfer the Work,
83
+ where such license applies only to those patent claims licensable
84
+ by such Contributor that are necessarily infringed by their
85
+ Contribution(s) alone or by combination of their Contribution(s)
86
+ with the Work to which such Contribution(s) was submitted. If You
87
+ institute patent litigation against any entity (including a
88
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
89
+ or a Contribution incorporated within the Work constitutes direct
90
+ or contributory patent infringement, then any patent licenses
91
+ granted to You under this License for that Work shall terminate
92
+ as of the date such litigation is filed.
93
+
94
+ 4. Redistribution. You may reproduce and distribute copies of the
95
+ Work or Derivative Works thereof in any medium, with or without
96
+ modifications, and in Source or Object form, provided that You
97
+ meet the following conditions:
98
+
99
+ (a) You must give any other recipients of the Work or
100
+ Derivative Works a copy of this License; and
101
+
102
+ (b) You must cause any modified files to carry prominent notices
103
+ stating that You changed the files; and
104
+
105
+ (c) You must retain, in the Source form of any Derivative Works
106
+ that You distribute, all copyright, patent, trademark, and
107
+ attribution notices from the Source form of the Work,
108
+ excluding those notices that do not pertain to any part of
109
+ the Derivative Works; and
110
+
111
+ (d) If the Work includes a "NOTICE" text file as part of its
112
+ distribution, then any Derivative Works that You distribute must
113
+ include a readable copy of the attribution notices contained
114
+ within such NOTICE file, excluding those notices that do not
115
+ pertain to any part of the Derivative Works, in at least one
116
+ of the following places: within a NOTICE text file distributed
117
+ as part of the Derivative Works; within the Source form or
118
+ documentation, if provided along with the Derivative Works; or,
119
+ within a display generated by the Derivative Works, if and
120
+ wherever such third-party notices normally appear. The contents
121
+ of the NOTICE file are for informational purposes only and
122
+ do not modify the License. You may add Your own attribution
123
+ notices within Derivative Works that You distribute, alongside
124
+ or as an addendum to the NOTICE text from the Work, provided
125
+ that such additional attribution notices cannot be construed
126
+ as modifying the License.
127
+
128
+ You may add Your own copyright statement to Your modifications and
129
+ may provide additional or different license terms and conditions
130
+ for use, reproduction, or distribution of Your modifications, or
131
+ for any such Derivative Works as a whole, provided Your use,
132
+ reproduction, and distribution of the Work otherwise complies with
133
+ the conditions stated in this License.
134
+
135
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
136
+ any Contribution intentionally submitted for inclusion in the Work
137
+ by You to the Licensor shall be under the terms and conditions of
138
+ this License, without any additional terms or conditions.
139
+ Notwithstanding the above, nothing herein shall supersede or modify
140
+ the terms of any separate license agreement you may have executed
141
+ with Licensor regarding such Contributions.
142
+
143
+ 6. Trademarks. This License does not grant permission to use the trade
144
+ names, trademarks, service marks, or product names of the Licensor,
145
+ except as required for reasonable and customary use in describing the
146
+ origin of the Work and reproducing the content of the NOTICE file.
147
+
148
+ 7. Disclaimer of Warranty. Unless required by applicable law or
149
+ agreed to in writing, Licensor provides the Work (and each
150
+ Contributor provides its Contributions) on an "AS IS" BASIS,
151
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
152
+ implied, including, without limitation, any warranties or conditions
153
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
154
+ PARTICULAR PURPOSE. You are solely responsible for determining the
155
+ appropriateness of using or redistributing the Work and assume any
156
+ risks associated with Your exercise of permissions under this License.
157
+
158
+ 8. Limitation of Liability. In no event and under no legal theory,
159
+ whether in tort (including negligence), contract, or otherwise,
160
+ unless required by applicable law (such as deliberate and grossly
161
+ negligent acts) or agreed to in writing, shall any Contributor be
162
+ liable to You for damages, including any direct, indirect, special,
163
+ incidental, or consequential damages of any character arising as a
164
+ result of this License or out of the use or inability to use the
165
+ Work (including but not limited to damages for loss of goodwill,
166
+ work stoppage, computer failure or malfunction, or any and all
167
+ other commercial damages or losses), even if such Contributor
168
+ has been advised of the possibility of such damages.
169
+
170
+ 9. Accepting Warranty or Additional Liability. While redistributing
171
+ the Work or Derivative Works thereof, You may choose to offer,
172
+ and charge a fee for, acceptance of support, warranty, indemnity,
173
+ or other liability obligations and/or rights consistent with this
174
+ License. However, in accepting such obligations, You may act only
175
+ on Your own behalf and on Your sole responsibility, not on behalf
176
+ of any other Contributor, and only if You agree to indemnify,
177
+ defend, and hold each Contributor harmless for any liability
178
+ incurred by, or claims asserted against, such Contributor by reason
179
+ of your accepting any such warranty or additional liability.
180
+
181
+ END OF TERMS AND CONDITIONS
182
+
183
+ APPENDIX: How to apply the Apache License to your work.
184
+
185
+ To apply the Apache License to your work, attach the following
186
+ boilerplate notice, with the fields enclosed by brackets "[]"
187
+ replaced with your own identifying information. (Don't include
188
+ the brackets!) The text should be enclosed in the appropriate
189
+ comment syntax for the file format. We also recommend that a
190
+ file or class name and description of purpose be included on the
191
+ same "printed page" as the copyright notice for easier
192
+ identification within third-party archives.
193
+
194
+ Copyright [yyyy] [name of copyright owner]
195
+
196
+ Licensed under the Apache License, Version 2.0 (the "License");
197
+ you may not use this file except in compliance with the License.
198
+ You may obtain a copy of the License at
199
+
200
+ http://www.apache.org/licenses/LICENSE-2.0
201
+
202
+ Unless required by applicable law or agreed to in writing, software
203
+ distributed under the License is distributed on an "AS IS" BASIS,
204
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
205
+ See the License for the specific language governing permissions and
206
+ limitations under the License.
207
+
208
+ Project-URL: Homepage, https://github.com/MRyutaro/ElasticKernel
209
+ Project-URL: Repository, https://github.com/MRyutaro/ElasticKernel
210
+ Project-URL: Documentation, https://github.com/MRyutaro/ElasticKernel
211
+ Project-URL: Bug Tracker, https://github.com/MRyutaro/ElasticKernel/issues
212
+ Keywords: jupyter,kernel,elastic,checkpoint,dependency-tracking
213
+ Classifier: Development Status :: 4 - Beta
214
+ Classifier: Intended Audience :: Developers
215
+ Classifier: Intended Audience :: Science/Research
216
+ Classifier: License :: OSI Approved :: Apache Software License
217
+ Classifier: Operating System :: OS Independent
218
+ Classifier: Programming Language :: Python :: 3
219
+ Classifier: Programming Language :: Python :: 3.6
220
+ Classifier: Programming Language :: Python :: 3.7
221
+ Classifier: Programming Language :: Python :: 3.8
222
+ Classifier: Programming Language :: Python :: 3.9
223
+ Classifier: Programming Language :: Python :: 3.10
224
+ Classifier: Programming Language :: Python :: 3.11
225
+ Classifier: Topic :: Scientific/Engineering
226
+ Classifier: Topic :: Software Development
227
+ Classifier: Framework :: Jupyter
228
+ Requires-Python: >=3.6
229
+ Description-Content-Type: text/markdown
230
+ License-File: LICENSE
231
+ Requires-Dist: dill
232
+ Requires-Dist: ipykernel
233
+ Requires-Dist: ipython
234
+ Requires-Dist: lightgbm
235
+ Requires-Dist: matplotlib
236
+ Requires-Dist: networkx
237
+ Requires-Dist: numpy
238
+ Requires-Dist: pandas
239
+ Requires-Dist: Pympler
240
+ Requires-Dist: scipy
241
+ Requires-Dist: seaborn
242
+ Requires-Dist: torch
243
+ Requires-Dist: xxhash
244
+ Requires-Dist: jupyter_client
245
+ Requires-Dist: jupyter
246
+ Provides-Extra: dev
247
+ Requires-Dist: black; extra == "dev"
248
+ Requires-Dist: flake8; extra == "dev"
249
+ Requires-Dist: isort; extra == "dev"
250
+ Requires-Dist: mypy; extra == "dev"
251
+ Requires-Dist: bump2version; extra == "dev"
252
+ Dynamic: license-file
253
+
254
+ # ElasticKernel
255
+
256
+ ## 使い方
257
+
258
+ 1. ライブラリをインストールする
259
+ ```
260
+ pip install elastic-notebook-slim
261
+ ```
262
+
263
+ 2. カーネルをインストールする
264
+ ```
265
+ jupyter kernelspec install --user elastic_kernel
266
+ ```
267
+
268
+
269
+ ## PyPi へのアップロード方法
270
+
271
+ ### 自動でアップロードする方法
272
+
273
+ ```
274
+ pip install bump-my-version # 初回のみ実行する
275
+ bump-my-version bump {hogehoge} # コマンドは以下のいずれかから選択する
276
+ git push --follow-tags # コミットとタグの両方をプッシュする
277
+ ```
278
+
279
+ | コマンド | 説明 | バージョン変更例 |
280
+ | -------------------- | -------------------------- | ---------------- |
281
+ | `bump-my-version bump patch` | パッチバージョンを上げる | 0.0.1 → 0.0.2 |
282
+ | `bump-my-version bump minor` | マイナーバージョンを上げる | 0.1.0 → 0.2.0 |
283
+ | `bump-my-version bump major` | メジャーバージョンを上げる | 1.0.0 → 2.0.0 |
284
+
285
+ ### 手動でアップロードする方法
286
+
287
+ ```
288
+ uv pip install twine build
289
+ python -m build
290
+ python -m twine upload dist/*
291
+ ```
@@ -0,0 +1,42 @@
1
+ elastic_kernel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ elastic_kernel/command.py,sha256=w5aj8BHmWPRi5ZCjVXRLvkFMSmUU7dh6WSlMnPAZRnY,1092
3
+ elastic_kernel/kernel.json,sha256=U-CuoCvvBnwdAL_OQyW0Ob5m7s3pWYjtC1ZCZ7SrHRk,147
4
+ elastic_kernel/kernel.py,sha256=l3rc4EmvOzot_Ub9dPoKHtMsXDdrBATiNxZY2hkxgZs,10042
5
+ elastic_kernel-0.0.2.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
6
+ elastic_notebook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ elastic_notebook/elastic_notebook.py,sha256=zTSJFlhpsLkhXdlbRu6hCh1xRvL1QxqJs3-S3lbrX3w,12710
8
+ elastic_notebook/algorithm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ elastic_notebook/algorithm/baseline.py,sha256=H37jSR00xSqOUfHtXkA3DlBHPw62e1ocxOPiT6tqTzI,723
10
+ elastic_notebook/algorithm/optimizer_exact.py,sha256=sH1yvJv7CaJ9sobE7VkyaZRT3KRib4yeBZ_zHp1qWPs,4873
11
+ elastic_notebook/algorithm/selector.py,sha256=cxykjTVpkNdw9AYKJX5AlgJRA7k3bSPJP_uHnckXkJg,1260
12
+ elastic_notebook/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ elastic_notebook/core/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ elastic_notebook/core/common/checkpoint_file.py,sha256=M6vdE_AroFy8WS5X3NQkdEfl3wyVE_07nt1-E3dXHrc,4053
15
+ elastic_notebook/core/common/profile_graph_size.py,sha256=ys_vfYr7hTA1SXyFCvTFlo-i_qvbjacVBH46p1Yxw8g,1439
16
+ elastic_notebook/core/common/profile_migration_speed.py,sha256=FtiNBBYQN2AEY9Mv2d1cs1MMk-K1ZLTfmqoRwELOAzc,2427
17
+ elastic_notebook/core/common/profile_variable_size.py,sha256=2GOJWu1pfMiNr_URoEqSlNqikkbKDYzkq73K2otKsFs,2467
18
+ elastic_notebook/core/graph/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
+ elastic_notebook/core/graph/cell_execution.py,sha256=RCmfkCfyFbYXmQJu1ACSdll7l7XQnUL_0I6szr0pXF0,1290
20
+ elastic_notebook/core/graph/graph.py,sha256=upX9R5Mj7v_nscsxlwh9MsazMvnap3AlW0EEymyZ2DY,2897
21
+ elastic_notebook/core/graph/variable_snapshot.py,sha256=HPUz7Tli858rm2m3JBsbBFLYiC8i5L4H37sghbWXk7E,1290
22
+ elastic_notebook/core/io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
+ elastic_notebook/core/io/adapter.py,sha256=exo6NRzPROtw0Dcq3Ra42bLTkJ-3etW_RWVvD7yW_4w,391
24
+ elastic_notebook/core/io/filesystem_adapter.py,sha256=8Lo5Sh3q90NxKYFoWEmmGJYoS_d5Hezd3KM5UlcHGKo,758
25
+ elastic_notebook/core/io/migrate.py,sha256=vmQX6YabCaoA3qtJRlplpAX468qqGv75YDWN8TT98X8,3318
26
+ elastic_notebook/core/io/pickle.py,sha256=amOyNoyGdGqgt1J9KRbUfJhzcn-3TqZHwftN8EbcvlI,1815
27
+ elastic_notebook/core/io/recover.py,sha256=xRPuqdFtITtePRkUkjOVjy0yVbT6oe4IX3xdVAzVJJg,1878
28
+ elastic_notebook/core/mutation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
+ elastic_notebook/core/mutation/fingerprint.py,sha256=vx5yv7uudSh6FBYPy0P2DMAAsTFnYcA9eJjcCiNLL_4,5830
30
+ elastic_notebook/core/mutation/id_graph.py,sha256=nyNRLAuKIfJbFzePrX13GxH6nnfCZaQfBRUJSN0k8IY,4613
31
+ elastic_notebook/core/mutation/object_hash.py,sha256=P0ow_mbHHuAXK6U9JvJAjASe_ONr1zWa2qlR-pM5u8o,5103
32
+ elastic_notebook/core/notebook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
+ elastic_notebook/core/notebook/checkpoint.py,sha256=jH-hb6VXG-iWeRu5FXCt8imrVsSpvBwFEoOJBiLex54,7875
34
+ elastic_notebook/core/notebook/find_input_vars.py,sha256=RjVs45BdPI7uOIXWnOOI84qEqV_1YnCt8Q1r7dGy0mI,4165
35
+ elastic_notebook/core/notebook/find_output_vars.py,sha256=nAR4R73MPKdN3zgsgOOykD8swp7Lj7J42BU43V_A-Uc,655
36
+ elastic_notebook/core/notebook/restore_notebook.py,sha256=2IjHR58VF50AEQ664E-mzIZORHVkCFUQfyQWfPtXCZg,3242
37
+ elastic_notebook/core/notebook/update_graph.py,sha256=O0QgCFIKxvz9CIfb8nmTxH760LOF4scu0zaOTLNJUXI,1578
38
+ elastic_kernel-0.0.2.dist-info/METADATA,sha256=UboIRrKLDGleDZ8YWZQzmjzwrl-KZOYxNpdmZuoHj2w,16005
39
+ elastic_kernel-0.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
+ elastic_kernel-0.0.2.dist-info/entry_points.txt,sha256=FKLcUx5zdRvFVgrvd_Efl3mg5Q9DEe4AEsRhAFSJmxU,63
41
+ elastic_kernel-0.0.2.dist-info/top_level.txt,sha256=8HRztRxwCCwc-DNqfW6oUOmGcWopm7LI8cYmoRMFZXE,32
42
+ elastic_kernel-0.0.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ elastic-kernel = elastic_kernel.command:main