flyshell 1.5.2__tar.gz → 1.5.3__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.
Files changed (76) hide show
  1. {flyshell-1.5.2/src/flyshell.egg-info → flyshell-1.5.3}/PKG-INFO +6 -5
  2. {flyshell-1.5.2 → flyshell-1.5.3}/README.md +5 -4
  3. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/abstract/base_plugin.py +10 -0
  4. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/constants.py +3 -3
  5. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/core/data.py +11 -0
  6. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/core/directory.py +6 -1
  7. {flyshell-1.5.2 → flyshell-1.5.3/src/flyshell.egg-info}/PKG-INFO +6 -5
  8. {flyshell-1.5.2 → flyshell-1.5.3}/LICENSE +0 -0
  9. {flyshell-1.5.2 → flyshell-1.5.3}/MANIFEST.in +0 -0
  10. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/diskops.c +0 -0
  11. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/posix/cat.c +0 -0
  12. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/posix/cp.c +0 -0
  13. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/posix/dir.c +0 -0
  14. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/posix/mkdir.c +0 -0
  15. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/posix/mv.c +0 -0
  16. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/posix/rename.c +0 -0
  17. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/posix/rm.c +0 -0
  18. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/posix/rmdir.c +0 -0
  19. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/posix/touch.c +0 -0
  20. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/shared/dir_types.c +0 -0
  21. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/shared/dir_types.h +0 -0
  22. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/shared/native_errors.h +0 -0
  23. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/shared/win32_utf.h +0 -0
  24. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/win32/cat.c +0 -0
  25. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/win32/cp.c +0 -0
  26. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/win32/dir.c +0 -0
  27. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/win32/mkdir.c +0 -0
  28. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/win32/mv.c +0 -0
  29. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/win32/rename.c +0 -0
  30. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/win32/rm.c +0 -0
  31. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/win32/rmdir.c +0 -0
  32. {flyshell-1.5.2 → flyshell-1.5.3}/c_src/diskops/win32/touch.c +0 -0
  33. {flyshell-1.5.2 → flyshell-1.5.3}/pyproject.toml +0 -0
  34. {flyshell-1.5.2 → flyshell-1.5.3}/setup.cfg +0 -0
  35. {flyshell-1.5.2 → flyshell-1.5.3}/setup.py +0 -0
  36. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/__init__.py +0 -0
  37. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/abstract/__init__.py +0 -0
  38. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/abstract/base_cmd.py +0 -0
  39. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/abstract/parent_cmd.py +0 -0
  40. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/accounts/__init__.py +0 -0
  41. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/accounts/auth.py +0 -0
  42. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/bin/__init__.py +0 -0
  43. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/builtin/__init__.py +0 -0
  44. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/builtin/fs.py +0 -0
  45. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/builtin/pkg.py +0 -0
  46. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/builtin/system.py +0 -0
  47. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/builtin/utils.py +0 -0
  48. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/core/__init__.py +0 -0
  49. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/core/console.py +0 -0
  50. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/main.py +0 -0
  51. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/native/__init__.py +0 -0
  52. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/native/diskops_bridge.py +0 -0
  53. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/native/diskops_handler.py +0 -0
  54. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/native/legacy/__init__.py +0 -0
  55. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/native/legacy/diskops.py +0 -0
  56. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/startup/__init__.py +0 -0
  57. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/startup/deps.py +0 -0
  58. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/startup/env.py +0 -0
  59. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell/startup/loader.py +0 -0
  60. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell.egg-info/SOURCES.txt +0 -0
  61. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell.egg-info/dependency_links.txt +0 -0
  62. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell.egg-info/entry_points.txt +0 -0
  63. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell.egg-info/requires.txt +0 -0
  64. {flyshell-1.5.2 → flyshell-1.5.3}/src/flyshell.egg-info/top_level.txt +0 -0
  65. {flyshell-1.5.2 → flyshell-1.5.3}/tests/test_auth.py +0 -0
  66. {flyshell-1.5.2 → flyshell-1.5.3}/tests/test_data.py +0 -0
  67. {flyshell-1.5.2 → flyshell-1.5.3}/tests/test_deps.py +0 -0
  68. {flyshell-1.5.2 → flyshell-1.5.3}/tests/test_directory.py +0 -0
  69. {flyshell-1.5.2 → flyshell-1.5.3}/tests/test_diskops_ext.py +0 -0
  70. {flyshell-1.5.2 → flyshell-1.5.3}/tests/test_diskops_lgc.py +0 -0
  71. {flyshell-1.5.2 → flyshell-1.5.3}/tests/test_env.py +0 -0
  72. {flyshell-1.5.2 → flyshell-1.5.3}/tests/test_fs.py +0 -0
  73. {flyshell-1.5.2 → flyshell-1.5.3}/tests/test_loader.py +0 -0
  74. {flyshell-1.5.2 → flyshell-1.5.3}/tests/test_pkg.py +0 -0
  75. {flyshell-1.5.2 → flyshell-1.5.3}/tests/test_security.py +0 -0
  76. {flyshell-1.5.2 → flyshell-1.5.3}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.5.2
3
+ Version: 1.5.3
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -23,7 +23,7 @@ Dynamic: license-file
23
23
  ![Dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg)
24
24
  ![Tests](https://github.com/kianodev/flyshell/actions/workflows/ci.yml/badge.svg)
25
25
 
26
- > Documentation last updated: v1.5.1
26
+ > Documentation last updated: v1.5.3
27
27
 
28
28
  A modular, zero-dependency command-line environment and extensible runtime interface built in Python with compiled C-extensions.
29
29
 
@@ -208,9 +208,10 @@ Additional functions are available for you to use:
208
208
 
209
209
  1. `get_data(key, default=None)`: Retrieves a value from local plugin memory.
210
210
  2. `set_data(key, value)`: Updates a key in local memory and automatically persists it to SQLite via `save_storage()`.
211
- 3. `load_storage()`: Reloads fresh key-value pairs directly from SQLite into `self.storage`.
212
- 4. `save_storage()`: Writes all in-memory key-value pairs in `self.storage` back to SQLite.
213
- 5. `get_api_key(key, default=None)`: Fetches the specified API key from `flyshell_keys.env`.
211
+ 3. `delete_data(key)`: Deletes the specified key and automatically persists it to SQLite, returning **True** if found and **False** if not found.
212
+ 4. `load_storage()`: Reloads fresh key-value pairs directly from SQLite into `self.storage`.
213
+ 5. `save_storage()`: Writes all in-memory key-value pairs in `self.storage` back to SQLite.
214
+ 6. `get_api_key(key, default=None)`: Fetches the specified API key from `flyshell_keys.env`.
214
215
 
215
216
  Plugins save automatically on shut-down.
216
217
 
@@ -6,7 +6,7 @@
6
6
  ![Dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg)
7
7
  ![Tests](https://github.com/kianodev/flyshell/actions/workflows/ci.yml/badge.svg)
8
8
 
9
- > Documentation last updated: v1.5.1
9
+ > Documentation last updated: v1.5.3
10
10
 
11
11
  A modular, zero-dependency command-line environment and extensible runtime interface built in Python with compiled C-extensions.
12
12
 
@@ -191,9 +191,10 @@ Additional functions are available for you to use:
191
191
 
192
192
  1. `get_data(key, default=None)`: Retrieves a value from local plugin memory.
193
193
  2. `set_data(key, value)`: Updates a key in local memory and automatically persists it to SQLite via `save_storage()`.
194
- 3. `load_storage()`: Reloads fresh key-value pairs directly from SQLite into `self.storage`.
195
- 4. `save_storage()`: Writes all in-memory key-value pairs in `self.storage` back to SQLite.
196
- 5. `get_api_key(key, default=None)`: Fetches the specified API key from `flyshell_keys.env`.
194
+ 3. `delete_data(key)`: Deletes the specified key and automatically persists it to SQLite, returning **True** if found and **False** if not found.
195
+ 4. `load_storage()`: Reloads fresh key-value pairs directly from SQLite into `self.storage`.
196
+ 5. `save_storage()`: Writes all in-memory key-value pairs in `self.storage` back to SQLite.
197
+ 6. `get_api_key(key, default=None)`: Fetches the specified API key from `flyshell_keys.env`.
197
198
 
198
199
  Plugins save automatically on shut-down.
199
200
 
@@ -83,6 +83,13 @@ class BasePlugin:
83
83
  self.storage[key] = value
84
84
  self.save_storage()
85
85
 
86
+ def delete_data(self, key: str) -> bool:
87
+ if key in self.storage:
88
+ del self.storage[key]
89
+ self.save_storage()
90
+ return True
91
+ return False
92
+
86
93
  def load_storage(self) -> dict:
87
94
  fresh_data = data.get_all_plugin_data(self.plugin_name)
88
95
  self.storage = fresh_data
@@ -90,6 +97,9 @@ class BasePlugin:
90
97
  return self.storage
91
98
 
92
99
  def save_storage(self):
100
+ existing_keys = set(data.get_all_plugin_data(self.plugin_name).keys())
101
+ for stale_key in existing_keys - set(self.storage.keys()):
102
+ data.delete_plugin_data(self.plugin_name, stale_key)
93
103
  for k, v in self.storage.items():
94
104
  data.set_plugin_data(self.plugin_name, k, v)
95
105
  self.context["storage"] = self.storage
@@ -5,9 +5,9 @@ import os
5
5
  import platform
6
6
  import time
7
7
 
8
- BUILD = 173
9
- VERFULL = "1.5.2d"
10
- VERSION = "1.5.2"
8
+ BUILD = 177
9
+ VERFULL = "1.5.3d"
10
+ VERSION = "1.5.3"
11
11
 
12
12
 
13
13
  def _resolve_app_dir() -> Path:
@@ -262,3 +262,14 @@ def purge_all_plugin_data(filename=c.FILE_PATH) -> bool:
262
262
  conn.execute("DELETE FROM plugin_kv")
263
263
  conn.execute("DELETE FROM plugins")
264
264
  return True
265
+
266
+
267
+ def delete_plugin_data(plugin_name: str, key: str, filename=c.FILE_PATH) -> bool:
268
+ initialise(filename)
269
+ with _get_connection(filename) as conn:
270
+ with conn:
271
+ cursor = conn.execute(
272
+ "DELETE FROM plugin_kv WHERE plugin_name = ? AND key = ?",
273
+ (plugin_name, key),
274
+ )
275
+ return cursor.rowcount > 0
@@ -10,6 +10,7 @@ from flyshell.native import diskops_handler as diskops
10
10
  from flyshell.startup import deps
11
11
 
12
12
  from datetime import datetime, timezone
13
+ import copy
13
14
  import shlex
14
15
  import sys
15
16
 
@@ -182,6 +183,7 @@ def _execute_single(raw_cmd: str) -> int:
182
183
  )
183
184
  print(f"Please run 'sys pip install {' '.join(missing_deps)}'\n")
184
185
  return 1
186
+ storage_before = copy.deepcopy(getattr(plugin, "storage", {}))
185
187
  try:
186
188
  result = plugin.execute(args)
187
189
  return result if isinstance(result, int) else 0
@@ -198,7 +200,10 @@ def _execute_single(raw_cmd: str) -> int:
198
200
  finally:
199
201
  if hasattr(plugin, "on_unload"):
200
202
  plugin.on_unload()
201
- if hasattr(plugin, "save_storage"):
203
+ if (
204
+ hasattr(plugin, "save_storage")
205
+ and getattr(plugin, "storage", {}) != storage_before
206
+ ):
202
207
  plugin.save_storage()
203
208
  else:
204
209
  print(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.5.2
3
+ Version: 1.5.3
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -23,7 +23,7 @@ Dynamic: license-file
23
23
  ![Dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg)
24
24
  ![Tests](https://github.com/kianodev/flyshell/actions/workflows/ci.yml/badge.svg)
25
25
 
26
- > Documentation last updated: v1.5.1
26
+ > Documentation last updated: v1.5.3
27
27
 
28
28
  A modular, zero-dependency command-line environment and extensible runtime interface built in Python with compiled C-extensions.
29
29
 
@@ -208,9 +208,10 @@ Additional functions are available for you to use:
208
208
 
209
209
  1. `get_data(key, default=None)`: Retrieves a value from local plugin memory.
210
210
  2. `set_data(key, value)`: Updates a key in local memory and automatically persists it to SQLite via `save_storage()`.
211
- 3. `load_storage()`: Reloads fresh key-value pairs directly from SQLite into `self.storage`.
212
- 4. `save_storage()`: Writes all in-memory key-value pairs in `self.storage` back to SQLite.
213
- 5. `get_api_key(key, default=None)`: Fetches the specified API key from `flyshell_keys.env`.
211
+ 3. `delete_data(key)`: Deletes the specified key and automatically persists it to SQLite, returning **True** if found and **False** if not found.
212
+ 4. `load_storage()`: Reloads fresh key-value pairs directly from SQLite into `self.storage`.
213
+ 5. `save_storage()`: Writes all in-memory key-value pairs in `self.storage` back to SQLite.
214
+ 6. `get_api_key(key, default=None)`: Fetches the specified API key from `flyshell_keys.env`.
214
215
 
215
216
  Plugins save automatically on shut-down.
216
217
 
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