flyshell 1.2.13__tar.gz → 1.2.14__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.2.14}/PKG-INFO +1 -1
  2. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/constants.py +3 -2
  3. flyshell-1.2.14/src/flyshell/core/deps.py +24 -0
  4. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/core/directory.py +8 -1
  5. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/core/loader.py +27 -1
  6. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/main.py +3 -2
  7. {flyshell-1.2.13 → flyshell-1.2.14/src/flyshell.egg-info}/PKG-INFO +1 -1
  8. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell.egg-info/SOURCES.txt +2 -0
  9. flyshell-1.2.14/tests/test_third_deps_check.py +101 -0
  10. {flyshell-1.2.13 → flyshell-1.2.14}/LICENSE +0 -0
  11. {flyshell-1.2.13 → flyshell-1.2.14}/README.md +0 -0
  12. {flyshell-1.2.13 → flyshell-1.2.14}/pyproject.toml +0 -0
  13. {flyshell-1.2.13 → flyshell-1.2.14}/setup.cfg +0 -0
  14. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/__init__.py +0 -0
  15. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/abstract/__init__.py +0 -0
  16. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/abstract/base_cmd.py +0 -0
  17. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/abstract/base_plugin.py +0 -0
  18. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/abstract/parent_cmd.py +0 -0
  19. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/builtin/__init__.py +0 -0
  20. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/builtin/diskops.py +0 -0
  21. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/builtin/fs.py +0 -0
  22. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/builtin/pkg.py +0 -0
  23. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/builtin/system.py +0 -0
  24. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/builtin/utils.py +0 -0
  25. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/core/__init__.py +0 -0
  26. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/core/auth.py +0 -0
  27. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/core/console.py +0 -0
  28. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/core/data.py +0 -0
  29. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell/core/env.py +0 -0
  30. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell.egg-info/dependency_links.txt +0 -0
  31. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell.egg-info/entry_points.txt +0 -0
  32. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell.egg-info/requires.txt +0 -0
  33. {flyshell-1.2.13 → flyshell-1.2.14}/src/flyshell.egg-info/top_level.txt +0 -0
  34. {flyshell-1.2.13 → flyshell-1.2.14}/tests/test_auth.py +0 -0
  35. {flyshell-1.2.13 → flyshell-1.2.14}/tests/test_data.py +0 -0
  36. {flyshell-1.2.13 → flyshell-1.2.14}/tests/test_directory.py +0 -0
  37. {flyshell-1.2.13 → flyshell-1.2.14}/tests/test_diskops.py +0 -0
  38. {flyshell-1.2.13 → flyshell-1.2.14}/tests/test_env_keys.py +0 -0
  39. {flyshell-1.2.13 → flyshell-1.2.14}/tests/test_fs.py +0 -0
  40. {flyshell-1.2.13 → flyshell-1.2.14}/tests/test_loader.py +0 -0
  41. {flyshell-1.2.13 → flyshell-1.2.14}/tests/test_pkg.py +0 -0
  42. {flyshell-1.2.13 → flyshell-1.2.14}/tests/test_security.py +0 -0
  43. {flyshell-1.2.13 → flyshell-1.2.14}/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.2.14
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License: MIT
6
6
  Requires-Python: >=3.10
@@ -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 = 139
9
+ VERSION = "1.2.14"
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.2.14
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License: MIT
6
6
  Requires-Python: >=3.10
@@ -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