flyshell 1.2.13__tar.gz → 1.3.0__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 (43) hide show
  1. {flyshell-1.2.13/src/flyshell.egg-info → flyshell-1.3.0}/PKG-INFO +33 -45
  2. {flyshell-1.2.13 → flyshell-1.3.0}/README.md +32 -44
  3. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/constants.py +3 -2
  4. flyshell-1.3.0/src/flyshell/core/deps.py +24 -0
  5. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/core/directory.py +8 -1
  6. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/core/loader.py +27 -1
  7. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/main.py +3 -2
  8. {flyshell-1.2.13 → flyshell-1.3.0/src/flyshell.egg-info}/PKG-INFO +33 -45
  9. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell.egg-info/SOURCES.txt +2 -0
  10. flyshell-1.3.0/tests/test_third_deps_check.py +101 -0
  11. {flyshell-1.2.13 → flyshell-1.3.0}/LICENSE +0 -0
  12. {flyshell-1.2.13 → flyshell-1.3.0}/pyproject.toml +0 -0
  13. {flyshell-1.2.13 → flyshell-1.3.0}/setup.cfg +0 -0
  14. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/__init__.py +0 -0
  15. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/abstract/__init__.py +0 -0
  16. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/abstract/base_cmd.py +0 -0
  17. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/abstract/base_plugin.py +0 -0
  18. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/abstract/parent_cmd.py +0 -0
  19. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/builtin/__init__.py +0 -0
  20. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/builtin/diskops.py +0 -0
  21. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/builtin/fs.py +0 -0
  22. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/builtin/pkg.py +0 -0
  23. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/builtin/system.py +0 -0
  24. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/builtin/utils.py +0 -0
  25. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/core/__init__.py +0 -0
  26. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/core/auth.py +0 -0
  27. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/core/console.py +0 -0
  28. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/core/data.py +0 -0
  29. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell/core/env.py +0 -0
  30. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell.egg-info/dependency_links.txt +0 -0
  31. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell.egg-info/entry_points.txt +0 -0
  32. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell.egg-info/requires.txt +0 -0
  33. {flyshell-1.2.13 → flyshell-1.3.0}/src/flyshell.egg-info/top_level.txt +0 -0
  34. {flyshell-1.2.13 → flyshell-1.3.0}/tests/test_auth.py +0 -0
  35. {flyshell-1.2.13 → flyshell-1.3.0}/tests/test_data.py +0 -0
  36. {flyshell-1.2.13 → flyshell-1.3.0}/tests/test_directory.py +0 -0
  37. {flyshell-1.2.13 → flyshell-1.3.0}/tests/test_diskops.py +0 -0
  38. {flyshell-1.2.13 → flyshell-1.3.0}/tests/test_env_keys.py +0 -0
  39. {flyshell-1.2.13 → flyshell-1.3.0}/tests/test_fs.py +0 -0
  40. {flyshell-1.2.13 → flyshell-1.3.0}/tests/test_loader.py +0 -0
  41. {flyshell-1.2.13 → flyshell-1.3.0}/tests/test_pkg.py +0 -0
  42. {flyshell-1.2.13 → flyshell-1.3.0}/tests/test_security.py +0 -0
  43. {flyshell-1.2.13 → flyshell-1.3.0}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.2.13
3
+ Version: 1.3.0
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License: 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/pytest.yml/badge.svg)
25
25
 
26
- > Documentation last updated: v1.2.0
26
+ > Documentation last updated: v1.3.0
27
27
 
28
28
  A modular, zero-dependency command-line environment and extensible runtime interface built in Python.
29
29
 
@@ -47,47 +47,32 @@ No extra packages required, just install and enjoy!
47
47
  ## System Architecture
48
48
 
49
49
  ```
50
- flyshell/
51
- ├── .github/
52
- │ └── workflows/
53
- │ └── pytest.yml
54
- ├── src/
55
- │ └── flyshell/
56
- │ ├── abstract/
57
- │ │ ├── __init__.py
58
- │ │ ├── base_cmd.py
59
- │ │ ├── base_plugin.py
60
- │ │ └── parent_cmd.py
61
- │ ├── builtin/
62
- │ │ ├── __init__.py
63
- │ │ ├── diskops.py
64
- │ │ ├── fs.py
65
- │ │ ├── system.py
66
- │ │ └── utils.py
67
- │ ├── core/
68
- │ │ ├── __init__.py
69
- │ │ ├── auth.py
70
- │ │ ├── console.py
71
- │ │ ├── data.py
72
- │ │ ├── directory.py
73
- │ │ └── loader.py
74
- │ ├── __init__.py
75
- │ ├── constants.py
76
- │ └── main.py
77
- ├── tests/
78
- │ ├── test_auth.py
79
- │ ├── test_data.py
80
- │ ├── test_directory.py
81
- │ ├── test_diskops.py
82
- │ ├── test_fs.py
83
- │ ├── test_loader.py
84
- │ ├── test_security.py
85
- │ └── test_utils.py
86
- ├── .flake8
87
- ├── .gitignore
88
- ├── LICENSE
89
- ├── pyproject.toml
90
- └── README.md
50
+ src/
51
+ └── flyshell/
52
+ ├── abstract/
53
+ │ ├── __init__.py
54
+ │ ├── base_cmd.py
55
+ │ ├── base_plugin.py
56
+ │ └── parent_cmd.py
57
+ ├── builtin/
58
+ │ ├── __init__.py
59
+ │ ├── diskops.py
60
+ │ ├── fs.py
61
+ │ ├── pkg.py
62
+ │ ├── system.py
63
+ │ └── utils.py
64
+ ├── core/
65
+ │ ├── __init__.py
66
+ │ ├── auth.py
67
+ │ ├── console.py
68
+ │ ├── data.py
69
+ │ ├── deps.py
70
+ │ ├── directory.py
71
+ │ ├── env.py
72
+ │ └── loader.py
73
+ ├── __init__.py
74
+ ├── constants.py
75
+ └── main.py
91
76
  ```
92
77
 
93
78
  ## Installing Flyshell
@@ -182,12 +167,14 @@ class MyPlugin(BasePlugin):
182
167
  author = "kianodev" # You can put your name, your GitHub handle, or leave blank to make it 'Unknown'
183
168
  usage = "" # (OPTIONAL) Explain how to use your plugin
184
169
  extended_help = "" # (OPTIONAL) A more detailed, multi-line guide containing specific assistance
170
+ api_keys = [] # (OPTIONAL) Define any required key names here. Use get_api_key(key_name) to call the key. Please add all keys in CAPITALS.
171
+ third_pty_libs = [] # (OPTIONAL) Define all required third party libraries / dependencies here. Use their Python import names as this is how Flyshell checks them.
185
172
 
186
173
  def on_load(self): # (OPTIONAL) Enables your program to handle specialist set-up tasks before execute()
187
174
  pass
188
175
 
189
176
  def on_unload(self): # (OPTIONAL) Enables your program to handle specialist shut-down tasks
190
- super().on_unload() # If you use a custom on_unload(), end it with this
177
+ pass
191
178
 
192
179
  def execute(self, args): # This is what Flyshell calls to execute
193
180
  print(f"Hello! Arguments: {args}")
@@ -202,8 +189,9 @@ Additional functions are available for you to use:
202
189
  2. `set_data(key, value)`: Updates a key in local memory and automatically persists it to SQLite via `save_storage()`.
203
190
  3. `load_storage()`: Reloads fresh key-value pairs directly from SQLite into `self.storage`.
204
191
  4. `save_storage()`: Writes all in-memory key-value pairs in `self.storage` back to SQLite.
192
+ 5. `get_api_key(key)`: Fetches the specified API key from `flyshell_keys.env`.
205
193
 
206
- Plugins save automatically on shut-down. If `on_unload()` is not used, it is automatic. If `on_unload()` is used, `super().on_unload()` saves your files.
194
+ Plugins save automatically on shut-down.
207
195
 
208
196
  ### Built-in Attributes
209
197
 
@@ -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/pytest.yml/badge.svg)
8
8
 
9
- > Documentation last updated: v1.2.0
9
+ > Documentation last updated: v1.3.0
10
10
 
11
11
  A modular, zero-dependency command-line environment and extensible runtime interface built in Python.
12
12
 
@@ -30,47 +30,32 @@ No extra packages required, just install and enjoy!
30
30
  ## System Architecture
31
31
 
32
32
  ```
33
- flyshell/
34
- ├── .github/
35
- │ └── workflows/
36
- │ └── pytest.yml
37
- ├── src/
38
- │ └── flyshell/
39
- │ ├── abstract/
40
- │ │ ├── __init__.py
41
- │ │ ├── base_cmd.py
42
- │ │ ├── base_plugin.py
43
- │ │ └── parent_cmd.py
44
- │ ├── builtin/
45
- │ │ ├── __init__.py
46
- │ │ ├── diskops.py
47
- │ │ ├── fs.py
48
- │ │ ├── system.py
49
- │ │ └── utils.py
50
- │ ├── core/
51
- │ │ ├── __init__.py
52
- │ │ ├── auth.py
53
- │ │ ├── console.py
54
- │ │ ├── data.py
55
- │ │ ├── directory.py
56
- │ │ └── loader.py
57
- │ ├── __init__.py
58
- │ ├── constants.py
59
- │ └── main.py
60
- ├── tests/
61
- │ ├── test_auth.py
62
- │ ├── test_data.py
63
- │ ├── test_directory.py
64
- │ ├── test_diskops.py
65
- │ ├── test_fs.py
66
- │ ├── test_loader.py
67
- │ ├── test_security.py
68
- │ └── test_utils.py
69
- ├── .flake8
70
- ├── .gitignore
71
- ├── LICENSE
72
- ├── pyproject.toml
73
- └── README.md
33
+ src/
34
+ └── flyshell/
35
+ ├── abstract/
36
+ │ ├── __init__.py
37
+ │ ├── base_cmd.py
38
+ │ ├── base_plugin.py
39
+ │ └── parent_cmd.py
40
+ ├── builtin/
41
+ │ ├── __init__.py
42
+ │ ├── diskops.py
43
+ │ ├── fs.py
44
+ │ ├── pkg.py
45
+ │ ├── system.py
46
+ │ └── utils.py
47
+ ├── core/
48
+ │ ├── __init__.py
49
+ │ ├── auth.py
50
+ │ ├── console.py
51
+ │ ├── data.py
52
+ │ ├── deps.py
53
+ │ ├── directory.py
54
+ │ ├── env.py
55
+ │ └── loader.py
56
+ ├── __init__.py
57
+ ├── constants.py
58
+ └── main.py
74
59
  ```
75
60
 
76
61
  ## Installing Flyshell
@@ -165,12 +150,14 @@ class MyPlugin(BasePlugin):
165
150
  author = "kianodev" # You can put your name, your GitHub handle, or leave blank to make it 'Unknown'
166
151
  usage = "" # (OPTIONAL) Explain how to use your plugin
167
152
  extended_help = "" # (OPTIONAL) A more detailed, multi-line guide containing specific assistance
153
+ api_keys = [] # (OPTIONAL) Define any required key names here. Use get_api_key(key_name) to call the key. Please add all keys in CAPITALS.
154
+ third_pty_libs = [] # (OPTIONAL) Define all required third party libraries / dependencies here. Use their Python import names as this is how Flyshell checks them.
168
155
 
169
156
  def on_load(self): # (OPTIONAL) Enables your program to handle specialist set-up tasks before execute()
170
157
  pass
171
158
 
172
159
  def on_unload(self): # (OPTIONAL) Enables your program to handle specialist shut-down tasks
173
- super().on_unload() # If you use a custom on_unload(), end it with this
160
+ pass
174
161
 
175
162
  def execute(self, args): # This is what Flyshell calls to execute
176
163
  print(f"Hello! Arguments: {args}")
@@ -185,8 +172,9 @@ Additional functions are available for you to use:
185
172
  2. `set_data(key, value)`: Updates a key in local memory and automatically persists it to SQLite via `save_storage()`.
186
173
  3. `load_storage()`: Reloads fresh key-value pairs directly from SQLite into `self.storage`.
187
174
  4. `save_storage()`: Writes all in-memory key-value pairs in `self.storage` back to SQLite.
175
+ 5. `get_api_key(key)`: Fetches the specified API key from `flyshell_keys.env`.
188
176
 
189
- Plugins save automatically on shut-down. If `on_unload()` is not used, it is automatic. If `on_unload()` is used, `super().on_unload()` saves your files.
177
+ Plugins save automatically on shut-down.
190
178
 
191
179
  ### Built-in Attributes
192
180
 
@@ -5,8 +5,8 @@ import os
5
5
  import platform
6
6
  import time
7
7
 
8
- BUILD = 138
9
- VERSION = "1.2.13"
8
+ BUILD = 140
9
+ VERSION = "1.3.0"
10
10
 
11
11
 
12
12
  def _resolve_app_dir() -> Path:
@@ -61,6 +61,7 @@ REQUIRED_COMPONENTS = [
61
61
  "core/auth.py",
62
62
  "core/console.py",
63
63
  "core/data.py",
64
+ "core/deps.py",
64
65
  "core/directory.py",
65
66
  "core/env.py",
66
67
  "core/loader.py",
@@ -0,0 +1,24 @@
1
+ # src\flyshell\core\deps.py
2
+
3
+ from typing import List, Tuple
4
+ import importlib.util
5
+
6
+
7
+ def check_module_installed(module_name: str) -> bool:
8
+ try:
9
+ spec = importlib.util.find_spec(module_name)
10
+ return spec is not None
11
+ except (ModuleNotFoundError, ValueError):
12
+ return False
13
+
14
+
15
+ def verify_plugin_dependencies(plugin) -> Tuple[List[str], List[str]]:
16
+ declared = getattr(plugin, "third_pty_libs", [])
17
+ installed = []
18
+ missing = []
19
+ for dep in declared:
20
+ if check_module_installed(dep):
21
+ installed.append(dep)
22
+ else:
23
+ missing.append(dep)
24
+ return installed, missing
@@ -4,7 +4,7 @@ from flyshell import constants as c
4
4
  from flyshell.abstract.base_cmd import BaseCmd
5
5
  from flyshell.abstract.parent_cmd import ParentCmd
6
6
  from flyshell.builtin import diskops, fs, pkg, system, utils
7
- from flyshell.core import auth, data
7
+ from flyshell.core import auth, data, deps
8
8
 
9
9
  from datetime import datetime, timezone
10
10
  import shlex
@@ -171,6 +171,13 @@ def _execute_single(raw_cmd: str) -> int:
171
171
  )
172
172
  print(f"Define them in {env_path} and retry.\n")
173
173
  return 1
174
+ _, missing_deps = deps.verify_plugin_dependencies(plugin)
175
+ if missing_deps:
176
+ print(
177
+ f"\nPlugin Error: Cannot execute '{cmd_name}'. Missing dependency/dependencies: {', '.join(missing_deps)}"
178
+ )
179
+ print(f"Please run 'sys pip install {' '.join(missing_deps)}'\n")
180
+ return 1
174
181
  try:
175
182
  result = plugin.execute(args)
176
183
  return result if isinstance(result, int) else 0
@@ -2,9 +2,10 @@
2
2
 
3
3
  from flyshell import constants as c
4
4
  from flyshell.abstract.base_plugin import BasePlugin
5
- from flyshell.core import data, env
5
+ from flyshell.core import data, deps, env
6
6
  from flyshell.core.directory import RESERVED_NAMES
7
7
 
8
+ from typing import Dict, List
8
9
  from pathlib import Path
9
10
  import importlib.util
10
11
  import inspect
@@ -148,3 +149,28 @@ def check_plugin_api_keys():
148
149
  print(f"✅ {orig_k} - Key found [Optional/Extra]")
149
150
  if not has_keys_to_report:
150
151
  print("✅ No API keys required for any loaded plugins.")
152
+
153
+
154
+ def check_all_plugin_dependencies() -> Dict[str, List[str]]:
155
+ if not c.PLUGINS:
156
+ return {}
157
+ print("\nFlyshell will now check plugin third-party dependencies.")
158
+ plugins_with_deps = False
159
+ all_missing: Dict[str, List[str]] = {}
160
+ for identifier, plugin in c.PLUGINS.items():
161
+ declared = getattr(plugin, "third_pty_libs", [])
162
+ if not declared:
163
+ continue
164
+ plugins_with_deps = True
165
+ installed, missing = deps.verify_plugin_dependencies(plugin)
166
+ print(f"\nPlugin: {plugin.name} ({identifier})")
167
+ for dep in installed:
168
+ print(f"✅ {dep} - Dependency found")
169
+ for dep in missing:
170
+ print(f"⚠️ {dep} - DEPENDENCY NOT FOUND")
171
+ print(f"Install using: 'sys pip install {dep}' once system has booted.")
172
+ if missing:
173
+ all_missing[identifier] = missing
174
+ if not plugins_with_deps:
175
+ print("✅ No third-party dependencies required for any loaded plugins.")
176
+ return all_missing
@@ -6,7 +6,7 @@ import os
6
6
  import sys
7
7
 
8
8
 
9
- def boot_check():
9
+ def boot_check() -> bool:
10
10
  print("\nFlyshell will now check that your modules exist.")
11
11
  present = []
12
12
  missing = []
@@ -17,7 +17,7 @@ def boot_check():
17
17
  sys.path.insert(0, str(c.SRC_DIR))
18
18
  except ImportError:
19
19
  print(
20
- "\nCRITICAL BOOT ERROR: Failed to initialise system due to corrupted or missing files.\n"
20
+ "\nCRITICAL BOOT ERROR: Failed to initialise system due to corrupted or missing files."
21
21
  )
22
22
  return False
23
23
  for obj in c.REQUIRED_COMPONENTS:
@@ -83,6 +83,7 @@ def main():
83
83
  print("Flyshell will now boot.")
84
84
  loader.scan_plugins()
85
85
  loader.check_plugin_api_keys()
86
+ loader.check_all_plugin_dependencies()
86
87
  if auth.login_flow():
87
88
  console.boot()
88
89
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.2.13
3
+ Version: 1.3.0
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License: 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/pytest.yml/badge.svg)
25
25
 
26
- > Documentation last updated: v1.2.0
26
+ > Documentation last updated: v1.3.0
27
27
 
28
28
  A modular, zero-dependency command-line environment and extensible runtime interface built in Python.
29
29
 
@@ -47,47 +47,32 @@ No extra packages required, just install and enjoy!
47
47
  ## System Architecture
48
48
 
49
49
  ```
50
- flyshell/
51
- ├── .github/
52
- │ └── workflows/
53
- │ └── pytest.yml
54
- ├── src/
55
- │ └── flyshell/
56
- │ ├── abstract/
57
- │ │ ├── __init__.py
58
- │ │ ├── base_cmd.py
59
- │ │ ├── base_plugin.py
60
- │ │ └── parent_cmd.py
61
- │ ├── builtin/
62
- │ │ ├── __init__.py
63
- │ │ ├── diskops.py
64
- │ │ ├── fs.py
65
- │ │ ├── system.py
66
- │ │ └── utils.py
67
- │ ├── core/
68
- │ │ ├── __init__.py
69
- │ │ ├── auth.py
70
- │ │ ├── console.py
71
- │ │ ├── data.py
72
- │ │ ├── directory.py
73
- │ │ └── loader.py
74
- │ ├── __init__.py
75
- │ ├── constants.py
76
- │ └── main.py
77
- ├── tests/
78
- │ ├── test_auth.py
79
- │ ├── test_data.py
80
- │ ├── test_directory.py
81
- │ ├── test_diskops.py
82
- │ ├── test_fs.py
83
- │ ├── test_loader.py
84
- │ ├── test_security.py
85
- │ └── test_utils.py
86
- ├── .flake8
87
- ├── .gitignore
88
- ├── LICENSE
89
- ├── pyproject.toml
90
- └── README.md
50
+ src/
51
+ └── flyshell/
52
+ ├── abstract/
53
+ │ ├── __init__.py
54
+ │ ├── base_cmd.py
55
+ │ ├── base_plugin.py
56
+ │ └── parent_cmd.py
57
+ ├── builtin/
58
+ │ ├── __init__.py
59
+ │ ├── diskops.py
60
+ │ ├── fs.py
61
+ │ ├── pkg.py
62
+ │ ├── system.py
63
+ │ └── utils.py
64
+ ├── core/
65
+ │ ├── __init__.py
66
+ │ ├── auth.py
67
+ │ ├── console.py
68
+ │ ├── data.py
69
+ │ ├── deps.py
70
+ │ ├── directory.py
71
+ │ ├── env.py
72
+ │ └── loader.py
73
+ ├── __init__.py
74
+ ├── constants.py
75
+ └── main.py
91
76
  ```
92
77
 
93
78
  ## Installing Flyshell
@@ -182,12 +167,14 @@ class MyPlugin(BasePlugin):
182
167
  author = "kianodev" # You can put your name, your GitHub handle, or leave blank to make it 'Unknown'
183
168
  usage = "" # (OPTIONAL) Explain how to use your plugin
184
169
  extended_help = "" # (OPTIONAL) A more detailed, multi-line guide containing specific assistance
170
+ api_keys = [] # (OPTIONAL) Define any required key names here. Use get_api_key(key_name) to call the key. Please add all keys in CAPITALS.
171
+ third_pty_libs = [] # (OPTIONAL) Define all required third party libraries / dependencies here. Use their Python import names as this is how Flyshell checks them.
185
172
 
186
173
  def on_load(self): # (OPTIONAL) Enables your program to handle specialist set-up tasks before execute()
187
174
  pass
188
175
 
189
176
  def on_unload(self): # (OPTIONAL) Enables your program to handle specialist shut-down tasks
190
- super().on_unload() # If you use a custom on_unload(), end it with this
177
+ pass
191
178
 
192
179
  def execute(self, args): # This is what Flyshell calls to execute
193
180
  print(f"Hello! Arguments: {args}")
@@ -202,8 +189,9 @@ Additional functions are available for you to use:
202
189
  2. `set_data(key, value)`: Updates a key in local memory and automatically persists it to SQLite via `save_storage()`.
203
190
  3. `load_storage()`: Reloads fresh key-value pairs directly from SQLite into `self.storage`.
204
191
  4. `save_storage()`: Writes all in-memory key-value pairs in `self.storage` back to SQLite.
192
+ 5. `get_api_key(key)`: Fetches the specified API key from `flyshell_keys.env`.
205
193
 
206
- Plugins save automatically on shut-down. If `on_unload()` is not used, it is automatic. If `on_unload()` is used, `super().on_unload()` saves your files.
194
+ Plugins save automatically on shut-down.
207
195
 
208
196
  ### Built-in Attributes
209
197
 
@@ -24,6 +24,7 @@ src/flyshell/core/__init__.py
24
24
  src/flyshell/core/auth.py
25
25
  src/flyshell/core/console.py
26
26
  src/flyshell/core/data.py
27
+ src/flyshell/core/deps.py
27
28
  src/flyshell/core/directory.py
28
29
  src/flyshell/core/env.py
29
30
  src/flyshell/core/loader.py
@@ -36,4 +37,5 @@ tests/test_fs.py
36
37
  tests/test_loader.py
37
38
  tests/test_pkg.py
38
39
  tests/test_security.py
40
+ tests/test_third_deps_check.py
39
41
  tests/test_utils.py
@@ -0,0 +1,101 @@
1
+ # tests\test_third_deps_check.py
2
+
3
+ from flyshell import constants as c
4
+ from flyshell.core import deps, loader
5
+
6
+ from unittest.mock import MagicMock, patch
7
+
8
+
9
+ class DummyPlugin:
10
+ def __init__(self, name="Dummy Plugin", libs=None):
11
+ self.name = name
12
+ self.third_pty_libs = libs if libs is not None else []
13
+
14
+
15
+ def test_check_module_installed_existing_builtin():
16
+ assert deps.check_module_installed("sys") is True
17
+ assert deps.check_module_installed("os") is True
18
+
19
+
20
+ def test_check_module_installed_nonexistent():
21
+ assert deps.check_module_installed("non_existent_fake_package_xyz123") is False
22
+
23
+
24
+ def test_check_module_installed_handles_exceptions():
25
+ with patch(
26
+ "importlib.util.find_spec", side_effect=ValueError("Invalid module name")
27
+ ):
28
+ assert deps.check_module_installed("bad.name...") is False
29
+ with patch(
30
+ "importlib.util.find_spec", side_effect=ModuleNotFoundError("Not found")
31
+ ):
32
+ assert deps.check_module_installed("missing_lib") is False
33
+
34
+
35
+ def test_verify_plugin_dependencies_empty():
36
+ plugin = DummyPlugin(libs=[])
37
+ installed, missing = deps.verify_plugin_dependencies(plugin)
38
+ assert installed == []
39
+ assert missing == []
40
+
41
+
42
+ def test_verify_plugin_dependencies_no_attribute():
43
+ dummy = object()
44
+ installed, missing = deps.verify_plugin_dependencies(dummy)
45
+ assert installed == []
46
+ assert missing == []
47
+
48
+
49
+ def test_verify_plugin_dependencies_mixed(monkeypatch):
50
+ def fake_find_spec(name):
51
+ return MagicMock() if name in ("sys", "math") else None
52
+
53
+ monkeypatch.setattr("importlib.util.find_spec", fake_find_spec)
54
+ plugin = DummyPlugin(libs=["sys", "math", "ghost_lib", "skibidi_rizz"])
55
+ installed, missing = deps.verify_plugin_dependencies(plugin)
56
+ assert installed == ["sys", "math"]
57
+ assert missing == ["ghost_lib", "skibidi_rizz"]
58
+
59
+
60
+ def test_check_all_plugin_dependencies_empty(capsys):
61
+ with patch.dict(c.PLUGINS, {}, clear=True):
62
+ result = loader.check_all_plugin_dependencies()
63
+ assert result == {}
64
+ captured = capsys.readouterr()
65
+ assert captured.out == ""
66
+
67
+
68
+ def test_check_all_plugin_dependencies_no_deps_declared(capsys):
69
+ plugin = DummyPlugin(name="CleanPlugin", libs=[])
70
+ with patch.dict(c.PLUGINS, {"clean": plugin}, clear=True):
71
+ result = loader.check_all_plugin_dependencies()
72
+ assert result == {}
73
+ captured = capsys.readouterr()
74
+ assert (
75
+ "✅ No third-party dependencies required for any loaded plugins."
76
+ in captured.out
77
+ )
78
+
79
+
80
+ def test_check_all_plugin_dependencies_with_missing(capsys, monkeypatch):
81
+ def fake_find_spec(name):
82
+ return MagicMock() if name == "numpy" else None
83
+
84
+ monkeypatch.setattr("importlib.util.find_spec", fake_find_spec)
85
+ plugin = DummyPlugin(name="DataPlugin", libs=["numpy", "aura", "yis"])
86
+ with patch.dict(c.PLUGINS, {"data_plug": plugin}, clear=True):
87
+ missing_dict = loader.check_all_plugin_dependencies()
88
+ assert missing_dict == {"data_plug": ["aura", "yis"]}
89
+ captured = capsys.readouterr()
90
+ assert "Plugin: DataPlugin (data_plug)" in captured.out
91
+ assert "✅ numpy - Dependency found" in captured.out
92
+ assert "⚠️ aura - DEPENDENCY NOT FOUND" in captured.out
93
+ assert "⚠️ yis - DEPENDENCY NOT FOUND" in captured.out
94
+ assert (
95
+ "Install using: 'sys pip install aura' once system has booted."
96
+ in captured.out
97
+ )
98
+ assert (
99
+ "Install using: 'sys pip install yis' once system has booted."
100
+ in captured.out
101
+ )
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