SessionSmith 0.1.2__tar.gz → 0.1.4__tar.gz
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.
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/PKG-INFO +51 -1
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith/__init__.py +1 -1
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith/core.py +16 -5
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith/manager.py +14 -5
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith.egg-info/PKG-INFO +51 -1
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/LICENSE +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith/compare.py +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith/formats.py +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith/info.py +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith/jupyter_utils.py +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith/serializers.py +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith/tracer.py +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith/utils.py +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith/version_control.py +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith/visualizer.py +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith/visualizer_arrays.py +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith/visualizer_generic.py +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith.egg-info/SOURCES.txt +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith.egg-info/dependency_links.txt +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith.egg-info/requires.txt +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/SessionSmith.egg-info/top_level.txt +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/setup.cfg +0 -0
- {sessionsmith-0.1.2 → sessionsmith-0.1.4}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: SessionSmith
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: Simple session save/load utility for Jupyter notebooks using pickle
|
|
5
5
|
Home-page: https://github.com/yut0takagi/SessionSmith
|
|
6
6
|
Author: YutoTAKAGI
|
|
@@ -59,6 +59,7 @@ Dynamic: summary
|
|
|
59
59
|
- 🏷️ **バージョン管理**: Git風のコミット・チェックアウト機能
|
|
60
60
|
- 📈 **アルゴリズムトレーサー**: 1行ごとの変数状態記録・可視化
|
|
61
61
|
- 🎨 **可視化**: アルゴリズムの実行をアニメーションで表示
|
|
62
|
+
- 🚀 **拡張機能対応**: Cursor/VSCode拡張機能でコードを書かずに実行可能
|
|
62
63
|
|
|
63
64
|
## インストール
|
|
64
65
|
|
|
@@ -219,6 +220,55 @@ visualize_algorithm_trace(
|
|
|
219
220
|
)
|
|
220
221
|
```
|
|
221
222
|
|
|
223
|
+
## Cursor/VSCode拡張機能
|
|
224
|
+
|
|
225
|
+
SessionSmithには、Cursor/VSCode用の拡張機能が用意されています。コードを書かずに、GUIからセッションの保存・復元が可能です。
|
|
226
|
+
|
|
227
|
+
### インストール
|
|
228
|
+
|
|
229
|
+
**Open VSX Registryから:**
|
|
230
|
+
1. Cursor/VSCodeでコマンドパレット(Cmd+Shift+P / Ctrl+Shift+P)を開く
|
|
231
|
+
2. `Extensions: Install Extension` を選択
|
|
232
|
+
3. `SessionSmith` を検索してインストール
|
|
233
|
+
|
|
234
|
+
または、以下のURLから直接インストール:
|
|
235
|
+
- https://open-vsx.org/extension/yut0takagi/sessionsmith
|
|
236
|
+
|
|
237
|
+
### 使い方
|
|
238
|
+
|
|
239
|
+
#### Notebookでの使用
|
|
240
|
+
|
|
241
|
+
1. Jupyter Notebookを開く
|
|
242
|
+
2. 変数を定義:
|
|
243
|
+
```python
|
|
244
|
+
x = 42
|
|
245
|
+
y = "Hello"
|
|
246
|
+
z = [1, 2, 3]
|
|
247
|
+
```
|
|
248
|
+
3. コマンドパレットから `SessionSmith: Save Session` を選択
|
|
249
|
+
4. ファイル名を入力して保存
|
|
250
|
+
|
|
251
|
+
#### セッションの読み込み
|
|
252
|
+
|
|
253
|
+
1. コマンドパレットから `SessionSmith: Load Session` を選択
|
|
254
|
+
2. セッションファイル(.pkl, .json, .msgpack, .h5)を選択
|
|
255
|
+
3. 変数が自動的に復元されます
|
|
256
|
+
|
|
257
|
+
#### セッション情報の表示
|
|
258
|
+
|
|
259
|
+
- エクスプローラーでセッションファイルを右クリック
|
|
260
|
+
- 「Show Session Info」を選択
|
|
261
|
+
|
|
262
|
+
### 機能
|
|
263
|
+
|
|
264
|
+
- ✅ **Save Session**: 現在のPythonセッション(変数)を保存
|
|
265
|
+
- ✅ **Load Session**: セッションファイルを選択して変数を復元
|
|
266
|
+
- ✅ **Show Session Info**: セッションファイルの情報を表示
|
|
267
|
+
- ✅ **Notebook対応**: Jupyter Notebookでセルを追加せずに実行
|
|
268
|
+
- ✅ **自動検出**: Pythonインタープリターを自動検出(仮想環境対応)
|
|
269
|
+
|
|
270
|
+
詳細は [extension/README.md](extension/README.md) を参照してください。
|
|
271
|
+
|
|
222
272
|
## ライセンス
|
|
223
273
|
|
|
224
274
|
MIT
|
|
@@ -101,12 +101,14 @@ def _validate_on_error_option(on_error: str) -> str:
|
|
|
101
101
|
return on_error
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
def _get_globals_dict(globals_dict: Optional[Dict[str, Any]]) -> Dict[str, Any]:
|
|
104
|
+
def _get_globals_dict(globals_dict: Optional[Dict[str, Any]], depth: int = 2, copy: bool = True) -> Dict[str, Any]:
|
|
105
105
|
"""
|
|
106
106
|
グローバル変数辞書を取得します
|
|
107
107
|
|
|
108
108
|
Args:
|
|
109
109
|
globals_dict: グローバル変数辞書(Noneの場合は自動取得)
|
|
110
|
+
depth: 呼び出し元からのフレーム深度(デフォルトは2:_get_globals_dict -> save/load_session -> ユーザーコード)
|
|
111
|
+
copy: Trueの場合はコピーを返す(save_session用)、Falseの場合は参照を返す(load_session用)
|
|
110
112
|
|
|
111
113
|
Returns:
|
|
112
114
|
dict: グローバル変数辞書
|
|
@@ -118,10 +120,18 @@ def _get_globals_dict(globals_dict: Optional[Dict[str, Any]]) -> Dict[str, Any]:
|
|
|
118
120
|
|
|
119
121
|
try:
|
|
120
122
|
frame = inspect.currentframe()
|
|
121
|
-
if frame is None
|
|
123
|
+
if frame is None:
|
|
122
124
|
raise RuntimeError("Cannot access calling frame")
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
|
|
126
|
+
# 指定された深度までフレームを遡る
|
|
127
|
+
caller_frame = frame
|
|
128
|
+
for _ in range(depth):
|
|
129
|
+
if caller_frame.f_back is None:
|
|
130
|
+
raise RuntimeError("Cannot access calling frame at specified depth")
|
|
131
|
+
caller_frame = caller_frame.f_back
|
|
132
|
+
|
|
133
|
+
# save_sessionはコピー(安全な読み取り)、load_sessionは参照(変更を反映)
|
|
134
|
+
result = caller_frame.f_globals.copy() if copy else caller_frame.f_globals
|
|
125
135
|
del frame
|
|
126
136
|
return result
|
|
127
137
|
except Exception as e:
|
|
@@ -326,7 +336,8 @@ def load_session(
|
|
|
326
336
|
if not file_path.is_file():
|
|
327
337
|
raise ValueError(f"'{file_path}' is not a file.")
|
|
328
338
|
|
|
329
|
-
|
|
339
|
+
# load_sessionでは元のグローバル変数を変更する必要があるため、copy=False
|
|
340
|
+
globals_dict = _get_globals_dict(globals_dict, copy=False)
|
|
330
341
|
|
|
331
342
|
if include is not None and not isinstance(include, list):
|
|
332
343
|
raise TypeError(f"include must be a list, got {type(include).__name__}")
|
|
@@ -50,15 +50,16 @@ class SessionManager:
|
|
|
50
50
|
if enable_version_control and vc_base_path:
|
|
51
51
|
self._init_version_control()
|
|
52
52
|
|
|
53
|
-
def _get_globals_dict(self, globals_dict: Optional[Dict[str, Any]]) -> Dict[str, Any]:
|
|
53
|
+
def _get_globals_dict(self, globals_dict: Optional[Dict[str, Any]], depth: int = 2) -> Dict[str, Any]:
|
|
54
54
|
"""
|
|
55
55
|
グローバル変数辞書を取得します
|
|
56
56
|
|
|
57
57
|
Args:
|
|
58
58
|
globals_dict: グローバル変数辞書(Noneの場合は自動取得)
|
|
59
|
+
depth: 呼び出し元からのフレーム深度(デフォルトは2:_get_globals_dict -> __init__ -> ユーザーコード)
|
|
59
60
|
|
|
60
61
|
Returns:
|
|
61
|
-
dict:
|
|
62
|
+
dict: グローバル変数辞書(参照、コピーではない)
|
|
62
63
|
"""
|
|
63
64
|
if globals_dict is not None:
|
|
64
65
|
if not isinstance(globals_dict, dict):
|
|
@@ -67,10 +68,18 @@ class SessionManager:
|
|
|
67
68
|
|
|
68
69
|
try:
|
|
69
70
|
frame = inspect.currentframe()
|
|
70
|
-
if frame is None
|
|
71
|
+
if frame is None:
|
|
71
72
|
raise RuntimeError("Cannot access calling frame")
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
|
|
74
|
+
# 指定された深度までフレームを遡る
|
|
75
|
+
caller_frame = frame
|
|
76
|
+
for _ in range(depth):
|
|
77
|
+
if caller_frame.f_back is None:
|
|
78
|
+
raise RuntimeError("Cannot access calling frame at specified depth")
|
|
79
|
+
caller_frame = caller_frame.f_back
|
|
80
|
+
|
|
81
|
+
# SessionManagerは変数を変更する必要があるため、参照を返す(コピーではない)
|
|
82
|
+
result = caller_frame.f_globals
|
|
74
83
|
del frame
|
|
75
84
|
return result
|
|
76
85
|
except Exception as e:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: SessionSmith
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: Simple session save/load utility for Jupyter notebooks using pickle
|
|
5
5
|
Home-page: https://github.com/yut0takagi/SessionSmith
|
|
6
6
|
Author: YutoTAKAGI
|
|
@@ -59,6 +59,7 @@ Dynamic: summary
|
|
|
59
59
|
- 🏷️ **バージョン管理**: Git風のコミット・チェックアウト機能
|
|
60
60
|
- 📈 **アルゴリズムトレーサー**: 1行ごとの変数状態記録・可視化
|
|
61
61
|
- 🎨 **可視化**: アルゴリズムの実行をアニメーションで表示
|
|
62
|
+
- 🚀 **拡張機能対応**: Cursor/VSCode拡張機能でコードを書かずに実行可能
|
|
62
63
|
|
|
63
64
|
## インストール
|
|
64
65
|
|
|
@@ -219,6 +220,55 @@ visualize_algorithm_trace(
|
|
|
219
220
|
)
|
|
220
221
|
```
|
|
221
222
|
|
|
223
|
+
## Cursor/VSCode拡張機能
|
|
224
|
+
|
|
225
|
+
SessionSmithには、Cursor/VSCode用の拡張機能が用意されています。コードを書かずに、GUIからセッションの保存・復元が可能です。
|
|
226
|
+
|
|
227
|
+
### インストール
|
|
228
|
+
|
|
229
|
+
**Open VSX Registryから:**
|
|
230
|
+
1. Cursor/VSCodeでコマンドパレット(Cmd+Shift+P / Ctrl+Shift+P)を開く
|
|
231
|
+
2. `Extensions: Install Extension` を選択
|
|
232
|
+
3. `SessionSmith` を検索してインストール
|
|
233
|
+
|
|
234
|
+
または、以下のURLから直接インストール:
|
|
235
|
+
- https://open-vsx.org/extension/yut0takagi/sessionsmith
|
|
236
|
+
|
|
237
|
+
### 使い方
|
|
238
|
+
|
|
239
|
+
#### Notebookでの使用
|
|
240
|
+
|
|
241
|
+
1. Jupyter Notebookを開く
|
|
242
|
+
2. 変数を定義:
|
|
243
|
+
```python
|
|
244
|
+
x = 42
|
|
245
|
+
y = "Hello"
|
|
246
|
+
z = [1, 2, 3]
|
|
247
|
+
```
|
|
248
|
+
3. コマンドパレットから `SessionSmith: Save Session` を選択
|
|
249
|
+
4. ファイル名を入力して保存
|
|
250
|
+
|
|
251
|
+
#### セッションの読み込み
|
|
252
|
+
|
|
253
|
+
1. コマンドパレットから `SessionSmith: Load Session` を選択
|
|
254
|
+
2. セッションファイル(.pkl, .json, .msgpack, .h5)を選択
|
|
255
|
+
3. 変数が自動的に復元されます
|
|
256
|
+
|
|
257
|
+
#### セッション情報の表示
|
|
258
|
+
|
|
259
|
+
- エクスプローラーでセッションファイルを右クリック
|
|
260
|
+
- 「Show Session Info」を選択
|
|
261
|
+
|
|
262
|
+
### 機能
|
|
263
|
+
|
|
264
|
+
- ✅ **Save Session**: 現在のPythonセッション(変数)を保存
|
|
265
|
+
- ✅ **Load Session**: セッションファイルを選択して変数を復元
|
|
266
|
+
- ✅ **Show Session Info**: セッションファイルの情報を表示
|
|
267
|
+
- ✅ **Notebook対応**: Jupyter Notebookでセルを追加せずに実行
|
|
268
|
+
- ✅ **自動検出**: Pythonインタープリターを自動検出(仮想環境対応)
|
|
269
|
+
|
|
270
|
+
詳細は [extension/README.md](extension/README.md) を参照してください。
|
|
271
|
+
|
|
222
272
|
## ライセンス
|
|
223
273
|
|
|
224
274
|
MIT
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|