flyshell 1.6.2__tar.gz → 1.6.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 (90) hide show
  1. {flyshell-1.6.2/src/flyshell.egg-info → flyshell-1.6.3}/PKG-INFO +1 -1
  2. flyshell-1.6.3/src/flyshell/accounts/__init__.py +17 -0
  3. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/builtin/fs.py +3 -4
  4. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/builtin/pkg.py +5 -5
  5. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/constants.py +14 -6
  6. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/core/console.py +3 -4
  7. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/core/directory.py +4 -6
  8. flyshell-1.6.3/src/flyshell/main.py +47 -0
  9. flyshell-1.6.3/src/flyshell/misc/__init__.py +7 -0
  10. {flyshell-1.6.2/src/flyshell/startup → flyshell-1.6.3/src/flyshell/misc}/seasonal.py +1 -1
  11. flyshell-1.6.3/src/flyshell/pkgm/__init__.py +35 -0
  12. flyshell-1.6.3/src/flyshell/pkgm/inspection.py +51 -0
  13. flyshell-1.6.2/src/flyshell/startup/deps.py → flyshell-1.6.3/src/flyshell/pkgm/keys.py +33 -24
  14. {flyshell-1.6.2/src/flyshell/startup → flyshell-1.6.3/src/flyshell/pkgm}/loader.py +5 -63
  15. flyshell-1.6.3/src/flyshell/startup/__init__.py +18 -0
  16. flyshell-1.6.3/src/flyshell/startup/boot.py +21 -0
  17. flyshell-1.6.3/src/flyshell/startup/checks.py +90 -0
  18. {flyshell-1.6.2 → flyshell-1.6.3/src/flyshell.egg-info}/PKG-INFO +1 -1
  19. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell.egg-info/SOURCES.txt +8 -3
  20. flyshell-1.6.3/tests/test_auth.py +30 -0
  21. {flyshell-1.6.2 → flyshell-1.6.3}/tests/test_deps.py +12 -12
  22. {flyshell-1.6.2 → flyshell-1.6.3}/tests/test_env.py +15 -16
  23. {flyshell-1.6.2 → flyshell-1.6.3}/tests/test_loader.py +11 -11
  24. flyshell-1.6.2/src/flyshell/main.py +0 -145
  25. flyshell-1.6.2/src/flyshell/native/legacy/__init__.py +0 -0
  26. flyshell-1.6.2/src/flyshell/startup/__init__.py +0 -0
  27. flyshell-1.6.2/tests/test_auth.py +0 -30
  28. {flyshell-1.6.2 → flyshell-1.6.3}/LICENSE +0 -0
  29. {flyshell-1.6.2 → flyshell-1.6.3}/MANIFEST.in +0 -0
  30. {flyshell-1.6.2 → flyshell-1.6.3}/README.md +0 -0
  31. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/diskops.c +0 -0
  32. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/posix/cat.c +0 -0
  33. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/posix/cp.c +0 -0
  34. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/posix/dir.c +0 -0
  35. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/posix/mkdir.c +0 -0
  36. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/posix/mv.c +0 -0
  37. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/posix/rename.c +0 -0
  38. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/posix/rm.c +0 -0
  39. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/posix/rmdir.c +0 -0
  40. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/posix/touch.c +0 -0
  41. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/shared/dir_types.c +0 -0
  42. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/shared/dir_types.h +0 -0
  43. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/shared/native_errors.h +0 -0
  44. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/shared/win32_utf.h +0 -0
  45. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/win32/cat.c +0 -0
  46. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/win32/cp.c +0 -0
  47. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/win32/dir.c +0 -0
  48. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/win32/mkdir.c +0 -0
  49. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/win32/mv.c +0 -0
  50. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/win32/rename.c +0 -0
  51. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/win32/rm.c +0 -0
  52. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/win32/rmdir.c +0 -0
  53. {flyshell-1.6.2 → flyshell-1.6.3}/c_src/diskops/win32/touch.c +0 -0
  54. {flyshell-1.6.2 → flyshell-1.6.3}/pyproject.toml +0 -0
  55. {flyshell-1.6.2 → flyshell-1.6.3}/setup.cfg +0 -0
  56. {flyshell-1.6.2 → flyshell-1.6.3}/setup.py +0 -0
  57. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/__init__.py +0 -0
  58. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/abstract/__init__.py +0 -0
  59. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/abstract/base_cmd.py +0 -0
  60. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/abstract/base_plugin.py +0 -0
  61. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/abstract/parent_cmd.py +0 -0
  62. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/accounts/auth.py +0 -0
  63. {flyshell-1.6.2/src/flyshell/accounts → flyshell-1.6.3/src/flyshell/bin}/__init__.py +0 -0
  64. {flyshell-1.6.2/src/flyshell/bin → flyshell-1.6.3/src/flyshell/builtin}/__init__.py +0 -0
  65. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/builtin/system.py +0 -0
  66. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/builtin/utils.py +0 -0
  67. {flyshell-1.6.2/src/flyshell/builtin → flyshell-1.6.3/src/flyshell/core}/__init__.py +0 -0
  68. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/data/__init__.py +0 -0
  69. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/data/auth.py +0 -0
  70. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/data/config.py +0 -0
  71. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/data/db_manager.py +0 -0
  72. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/data/env.py +0 -0
  73. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/data/history.py +0 -0
  74. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/data/plugins.py +0 -0
  75. {flyshell-1.6.2/src/flyshell/core → flyshell-1.6.3/src/flyshell/native}/__init__.py +0 -0
  76. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/native/diskops_bridge.py +0 -0
  77. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/native/diskops_handler.py +0 -0
  78. {flyshell-1.6.2/src/flyshell/native → flyshell-1.6.3/src/flyshell/native/legacy}/__init__.py +0 -0
  79. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell/native/legacy/diskops.py +0 -0
  80. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell.egg-info/dependency_links.txt +0 -0
  81. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell.egg-info/entry_points.txt +0 -0
  82. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell.egg-info/requires.txt +0 -0
  83. {flyshell-1.6.2 → flyshell-1.6.3}/src/flyshell.egg-info/top_level.txt +0 -0
  84. {flyshell-1.6.2 → flyshell-1.6.3}/tests/test_data.py +0 -0
  85. {flyshell-1.6.2 → flyshell-1.6.3}/tests/test_directory.py +0 -0
  86. {flyshell-1.6.2 → flyshell-1.6.3}/tests/test_diskops_ext.py +0 -0
  87. {flyshell-1.6.2 → flyshell-1.6.3}/tests/test_diskops_lgc.py +0 -0
  88. {flyshell-1.6.2 → flyshell-1.6.3}/tests/test_fs.py +0 -0
  89. {flyshell-1.6.2 → flyshell-1.6.3}/tests/test_pkg.py +0 -0
  90. {flyshell-1.6.2 → flyshell-1.6.3}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.6.2
3
+ Version: 1.6.3
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -0,0 +1,17 @@
1
+ # src/flyshell/accounts/__init__.py
2
+
3
+ from flyshell.accounts.auth import (
4
+ Lock,
5
+ hash_password,
6
+ login_flow,
7
+ setup_acc,
8
+ verify_password,
9
+ )
10
+
11
+ __all__ = [
12
+ "Lock",
13
+ "hash_password",
14
+ "login_flow",
15
+ "setup_acc",
16
+ "verify_password",
17
+ ]
@@ -1,10 +1,9 @@
1
1
  # src/flyshell/builtin/fs.py
2
2
 
3
3
  from flyshell import constants as c
4
- from flyshell import data
4
+ from flyshell import data, misc
5
5
  from flyshell.abstract.base_cmd import BaseCmd
6
6
  from flyshell.abstract.parent_cmd import ParentCmd
7
- from flyshell.startup import seasonal
8
7
 
9
8
  import os
10
9
  import sys
@@ -148,10 +147,10 @@ class FsSeason(BaseCmd):
148
147
  aliases = []
149
148
 
150
149
  def execute(self, args: list[str]) -> tuple[int, str]:
151
- season = seasonal.get_season(return_icons=False)
150
+ season = misc.get_season(return_icons=False)
152
151
  if not season:
153
152
  return (0, "\nNo seasonal modes are active at present.\n")
154
- icon = seasonal.get_season(return_icons=True)
153
+ icon = misc.get_season(return_icons=True)
155
154
  return (0, f"\nCurrent seasonal mode: {season} {icon}\n")
156
155
 
157
156
 
@@ -1,9 +1,9 @@
1
1
  # src/flyshell/builtin/pkg.py
2
2
 
3
3
  from typing import List, Tuple
4
+ from flyshell import pkgm
4
5
  from flyshell.abstract.base_cmd import BaseCmd
5
6
  from flyshell.abstract.parent_cmd import ParentCmd
6
- from flyshell.startup import deps
7
7
 
8
8
 
9
9
  class PkgApi(BaseCmd):
@@ -26,7 +26,7 @@ class PkgApi(BaseCmd):
26
26
  plugin_name = remaining_args[0]
27
27
  key_name = remaining_args[1]
28
28
  val = " ".join(remaining_args[2:])
29
- code, output = deps.set_plugin_api_key(plugin_name, key_name, val)
29
+ code, output = pkgm.set_plugin_api_key(plugin_name, key_name, val)
30
30
  return (code, f"\n{output}\n")
31
31
  case "del" | "rm":
32
32
  if len(remaining_args) < 2:
@@ -36,14 +36,14 @@ class PkgApi(BaseCmd):
36
36
  )
37
37
  plugin_name = remaining_args[0]
38
38
  key_name = remaining_args[1]
39
- code, output = deps.remove_plugin_api_key(plugin_name, key_name)
39
+ code, output = pkgm.remove_plugin_api_key(plugin_name, key_name)
40
40
  return (code, f"\n{output}\n")
41
41
  case "view":
42
42
  if not remaining_args:
43
- code, output = deps.get_all_keys()
43
+ code, output = pkgm.get_all_keys()
44
44
  else:
45
45
  package_name = remaining_args[0]
46
- code, output = deps.get_plugin_keys_formatted(package_name)
46
+ code, output = pkgm.get_plugin_keys_formatted(package_name)
47
47
  return (code, f"\n{output}\n")
48
48
  case _:
49
49
  return (1, f"\nCommand Error: Unknown target '{arg}'\n")
@@ -5,9 +5,9 @@ import os
5
5
  import platform
6
6
  import time
7
7
 
8
- BUILD = 215
9
- VERFULL = "1.6.2d"
10
- VERSION = "1.6.2"
8
+ BUILD = 219
9
+ VERFULL = "1.6.3d"
10
+ VERSION = "1.6.3"
11
11
 
12
12
 
13
13
  def _resolve_app_dir() -> Path:
@@ -35,6 +35,7 @@ SESSION_START_TIME = time.time()
35
35
  SESSION_CMD_COUNT = 0
36
36
 
37
37
  PLUGINS = {}
38
+ RESERVED_NAMES: set[str] = set()
38
39
 
39
40
  SUPPORTED_OS = frozenset({"Windows", "Darwin", "Linux"})
40
41
  SUPPORTED_PYTHON = (3, 10)
@@ -75,17 +76,24 @@ REQUIRED_COMPONENTS = [
75
76
  "data/plugins.py",
76
77
  "__init__.py",
77
78
  "main.py",
79
+ "misc",
80
+ "misc/__init__.py",
81
+ "misc/seasonal.py",
78
82
  "native",
79
83
  "native/__init__.py",
80
84
  "native/legacy/__init__.py",
81
85
  "native/legacy/diskops.py",
82
86
  "native/diskops_bridge.py",
83
87
  "native/diskops_handler.py",
88
+ "pkgm",
89
+ "pkgm/__init__.py",
90
+ "pkgm/inspection.py",
91
+ "pkgm/keys.py",
92
+ "pkgm/loader.py",
84
93
  "startup",
85
94
  "startup/__init__.py",
86
- "startup/deps.py",
87
- "startup/loader.py",
88
- "startup/seasonal.py",
95
+ "startup/boot.py",
96
+ "startup/checks.py",
89
97
  ]
90
98
 
91
99
  GREETINGS = [
@@ -1,9 +1,8 @@
1
1
  # src/flyshell/core/console.py
2
2
 
3
3
  from flyshell import constants as c
4
- from flyshell import data
4
+ from flyshell import data, misc
5
5
  from flyshell.core.directory import execute_line
6
- from flyshell.startup import seasonal
7
6
 
8
7
  import os
9
8
  import random
@@ -41,7 +40,7 @@ def boot() -> None:
41
40
  load_history()
42
41
  data.create_env()
43
42
  print(c.CLEAR_SCREEN, end="")
44
- icon = seasonal.get_season(return_icons=True)
43
+ icon = misc.get_season(return_icons=True)
45
44
  badge = f" {icon}" if icon else ""
46
45
  print(f"\nBoot successful, welcome to Flyshell! (Version {c.VERSION}){badge}")
47
46
  user_info = data.get_auth() or {}
@@ -51,7 +50,7 @@ def boot() -> None:
51
50
  while True:
52
51
  try:
53
52
  folder = os.path.basename(os.getcwd())
54
- icon = seasonal.get_season(return_icons=True)
53
+ icon = misc.get_season(return_icons=True)
55
54
  badge = f" {icon}" if icon else ""
56
55
  print(f"Flyshell [v{c.VERSION}]{badge} ({folder})>>", end="", flush=True)
57
56
  raw_cmd = input()
@@ -1,13 +1,11 @@
1
1
  # src/flyshell/core/directory.py
2
2
 
3
3
  from flyshell import constants as c
4
- from flyshell import data
4
+ from flyshell import accounts, data, pkgm
5
5
  from flyshell.abstract.base_cmd import BaseCmd
6
6
  from flyshell.abstract.parent_cmd import ParentCmd
7
- from flyshell.accounts import auth
8
7
  from flyshell.builtin import fs, pkg, system, utils
9
8
  from flyshell.native import diskops_handler as diskops
10
- from flyshell.startup import deps
11
9
 
12
10
  from datetime import datetime, timezone
13
11
  import copy
@@ -64,7 +62,7 @@ INSTALLED_COMMANDS: list[BaseCmd] = [
64
62
  fs.Fs(),
65
63
  utils.History(),
66
64
  utils.Kill(),
67
- auth.Lock(),
65
+ accounts.Lock(),
68
66
  diskops.MkDir(),
69
67
  diskops.Move(),
70
68
  system.OpenFile(),
@@ -84,7 +82,7 @@ for cmd_obj in INSTALLED_COMMANDS:
84
82
  for alias_name in cmd_obj.aliases:
85
83
  COMMAND_REGISTRY[alias_name] = cmd_obj
86
84
 
87
- RESERVED_NAMES = set(COMMAND_REGISTRY.keys())
85
+ c.RESERVED_NAMES = set(COMMAND_REGISTRY.keys())
88
86
 
89
87
 
90
88
  def log(cmd: str) -> None:
@@ -176,7 +174,7 @@ def _execute_single(raw_cmd: str) -> int:
176
174
  )
177
175
  print(f"Define them in {env_path} and retry.\n")
178
176
  return 1
179
- _, missing_deps = deps.verify_plugin_dependencies(plugin)
177
+ _, missing_deps = pkgm.verify_plugin_dependencies(plugin)
180
178
  if missing_deps:
181
179
  print(
182
180
  f"\nPlugin Error: Cannot execute '{cmd_name}'. Missing dependency/dependencies: {', '.join(missing_deps)}"
@@ -0,0 +1,47 @@
1
+ # src/flyshell/main.py
2
+
3
+ import os
4
+ import sys
5
+
6
+
7
+ def main() -> None:
8
+ os.system("")
9
+ print("\033[H\033[2J", end="")
10
+ print("\nLaunch process initiated. Flyshell is checking it is able to launch...")
11
+ try:
12
+ from flyshell import startup
13
+
14
+ if startup.run_preflight():
15
+ startup.launch()
16
+ else:
17
+ sys.exit(1)
18
+ except KeyboardInterrupt:
19
+ print("\n\nFlyshell session terminated, shutting down...\n")
20
+ sys.exit(0)
21
+ except Exception as e:
22
+ print("\n❌❌❌ Oops! An unexpected error occurred.")
23
+ print(f"Error details: {e}")
24
+ print("We don't really know what happened there. Sorry about that.\n")
25
+ print("Print traceback message? Default is N.")
26
+ choice = input("[y/n]?: ")
27
+ if choice.lower() == "y":
28
+ import traceback
29
+
30
+ raw = traceback.extract_tb(e.__traceback__)
31
+ last_frame = raw[-1]
32
+ print("\nTraceback details:")
33
+ print(f"File: '{last_frame[0]}'")
34
+ print(f"Line: {last_frame[1]}")
35
+ print(f"Exception message: '{e}'")
36
+ sys.exit(1)
37
+ finally:
38
+ try:
39
+ from flyshell import startup
40
+
41
+ startup.shutdown()
42
+ except ImportError:
43
+ pass
44
+
45
+
46
+ if __name__ == "__main__":
47
+ main()
@@ -0,0 +1,7 @@
1
+ # src/flyshell/misc/__init__.py
2
+
3
+ from flyshell.misc.seasonal import get_season
4
+
5
+ __all__ = [
6
+ "get_season",
7
+ ]
@@ -1,4 +1,4 @@
1
- # src/flyshell/startup/seasonal.py
1
+ # src/flyshell/misc/seasonal.py
2
2
 
3
3
  from datetime import date, timedelta
4
4
  import random
@@ -0,0 +1,35 @@
1
+ # src/flyshell/pkgm/__init__.py
2
+
3
+ from flyshell.pkgm.inspection import (
4
+ check_all_plugin_dependencies,
5
+ check_module_installed,
6
+ verify_plugin_dependencies,
7
+ )
8
+ from flyshell.pkgm.keys import (
9
+ check_plugin_api_keys,
10
+ get_all_keys,
11
+ get_plugin_api_keys,
12
+ get_plugin_keys_formatted,
13
+ remove_plugin_api_key,
14
+ set_plugin_api_key,
15
+ )
16
+ from flyshell.pkgm.loader import (
17
+ build_context,
18
+ scan_plugins,
19
+ unload_plugins,
20
+ )
21
+
22
+ __all__ = [
23
+ "build_context",
24
+ "check_all_plugin_dependencies",
25
+ "check_module_installed",
26
+ "check_plugin_api_keys",
27
+ "get_all_keys",
28
+ "get_plugin_api_keys",
29
+ "get_plugin_keys_formatted",
30
+ "remove_plugin_api_key",
31
+ "scan_plugins",
32
+ "set_plugin_api_key",
33
+ "unload_plugins",
34
+ "verify_plugin_dependencies",
35
+ ]
@@ -0,0 +1,51 @@
1
+ # src/flyshell/pkgm/inspection.py
2
+
3
+ from flyshell import constants as c
4
+
5
+ from typing import Any, Dict, List, Tuple
6
+ import importlib.util
7
+
8
+
9
+ def check_module_installed(module_name: str) -> bool:
10
+ try:
11
+ spec = importlib.util.find_spec(module_name)
12
+ return spec is not None
13
+ except (ModuleNotFoundError, ValueError):
14
+ return False
15
+
16
+
17
+ def verify_plugin_dependencies(plugin: Any) -> Tuple[List[str], List[str]]:
18
+ declared = getattr(plugin, "third_pty_libs", None) or []
19
+ installed = []
20
+ missing = []
21
+ for dep in declared:
22
+ if check_module_installed(dep):
23
+ installed.append(dep)
24
+ else:
25
+ missing.append(dep)
26
+ return installed, missing
27
+
28
+
29
+ def check_all_plugin_dependencies() -> Dict[str, List[str]]:
30
+ if not c.PLUGINS:
31
+ return {}
32
+ print("\nFlyshell will now check plugin third-party dependencies.")
33
+ plugins_with_deps = False
34
+ all_missing: Dict[str, List[str]] = {}
35
+ for identifier, plugin in c.PLUGINS.items():
36
+ declared = getattr(plugin, "third_pty_libs", None) or []
37
+ if not declared:
38
+ continue
39
+ plugins_with_deps = True
40
+ installed, missing = verify_plugin_dependencies(plugin)
41
+ print(f"\nPlugin: {plugin.name} ({identifier})")
42
+ for dep in installed:
43
+ print(f"✅ {dep} - Dependency found")
44
+ for dep in missing:
45
+ print(f"⚠️ {dep} - DEPENDENCY NOT FOUND")
46
+ print(f"Install using: 'sys pip install {dep}' once system has booted.")
47
+ if missing:
48
+ all_missing[identifier] = missing
49
+ if not plugins_with_deps:
50
+ print("✅ No third-party dependencies required for any loaded plugins.")
51
+ return all_missing
@@ -1,31 +1,9 @@
1
- # src/flyshell/startup/deps.py
2
-
3
- from pathlib import Path
4
- from typing import Any, List, Tuple
5
- import importlib.util
1
+ # src/flyshell/pkgm/keys.py
6
2
 
7
3
  from flyshell import constants as c
8
4
  from flyshell import data
9
5
 
10
-
11
- def check_module_installed(module_name: str) -> bool:
12
- try:
13
- spec = importlib.util.find_spec(module_name)
14
- return spec is not None
15
- except (ModuleNotFoundError, ValueError):
16
- return False
17
-
18
-
19
- def verify_plugin_dependencies(plugin: Any) -> Tuple[List[str], List[str]]:
20
- declared = getattr(plugin, "third_pty_libs", None) or []
21
- installed = []
22
- missing = []
23
- for dep in declared:
24
- if check_module_installed(dep):
25
- installed.append(dep)
26
- else:
27
- missing.append(dep)
28
- return installed, missing
6
+ from pathlib import Path
29
7
 
30
8
 
31
9
  def _resolve_plugin_dir_name(target_name: str) -> tuple[str, object | None]:
@@ -149,3 +127,34 @@ def remove_plugin_api_key(plugin_name: str, key_name: str) -> tuple[int, str]:
149
127
  if not ok:
150
128
  return (1, info)
151
129
  return (0, f"SUCCESS! Removed key '{target_key}' from Flyshell environment.")
130
+
131
+
132
+ def check_plugin_api_keys() -> None:
133
+ if not c.PLUGINS:
134
+ return
135
+ print("\nFlyshell will now check plugin API keys.")
136
+ has_keys_to_report = False
137
+ for identifier, plugin in c.PLUGINS.items():
138
+ required_keys = getattr(plugin, "api_keys", None) or []
139
+ configured_keys = getattr(plugin, "api_keys_data", {})
140
+ dir_name = plugin.context.get("plugin_dir_name", identifier)
141
+ if not required_keys and not configured_keys:
142
+ continue
143
+ has_keys_to_report = True
144
+ configured_lookup = {k.lower(): (k, v) for k, v in configured_keys.items()}
145
+ seen_keys = set()
146
+ print(f"\nPlugin: {plugin.name} ({identifier})")
147
+ for req in required_keys:
148
+ req_lower = req.lower()
149
+ seen_keys.add(req_lower)
150
+ if req_lower in configured_lookup:
151
+ orig_k, _ = configured_lookup[req_lower]
152
+ print(f"✅ {orig_k} - Key found [Required]")
153
+ else:
154
+ print(f"⚠️ {req} - KEY NOT FOUND [Required]")
155
+ print(f"Please define in the .env file as: {dir_name}_{req}=<your_key>")
156
+ for k_lower, (orig_k, _) in sorted(configured_lookup.items()):
157
+ if k_lower not in seen_keys:
158
+ print(f"✅ {orig_k} - Key found [Optional/Extra]")
159
+ if not has_keys_to_report:
160
+ print("✅ No API keys required for any loaded plugins.")
@@ -1,12 +1,10 @@
1
- # src/flyshell/startup/loader.py
1
+ # src/flyshell/pkgm/loader.py
2
2
 
3
3
  from flyshell import constants as c
4
4
  from flyshell import data
5
5
  from flyshell.abstract.base_plugin import BasePlugin
6
- from flyshell.core.directory import RESERVED_NAMES
7
- from flyshell.startup import deps
6
+ from flyshell.pkgm import keys
8
7
 
9
- from typing import Dict, List
10
8
  from pathlib import Path
11
9
  import importlib.util
12
10
  import inspect
@@ -37,7 +35,7 @@ def scan_plugins(plugin_folder: str | Path | None = None) -> None:
37
35
  default_name = item.name
38
36
  if not file_path or not default_name:
39
37
  continue
40
- if default_name in RESERVED_NAMES:
38
+ if default_name in c.RESERVED_NAMES:
41
39
  print(
42
40
  f"\n⚠️ Collision Error - Plugin '{default_name}' conflicts with a built-in Flyshell command and will not be loaded."
43
41
  )
@@ -56,7 +54,7 @@ def scan_plugins(plugin_folder: str | Path | None = None) -> None:
56
54
  and obj.__module__ == module.__name__
57
55
  ):
58
56
  resolved_name = getattr(obj, "identifier", None) or default_name
59
- if resolved_name in RESERVED_NAMES:
57
+ if resolved_name in c.RESERVED_NAMES:
60
58
  print(
61
59
  f"\n⚠️ Collision Error - Plugin '{resolved_name}' conflicts with a built-in Flyshell command and will not be loaded."
62
60
  )
@@ -104,7 +102,7 @@ def build_context(
104
102
  plugin_name: str, default_name: str, file_path: str | Path | None = None
105
103
  ) -> dict:
106
104
  plugin_storage = data.get_all_plugin_data(plugin_name)
107
- api_keys = deps.get_plugin_api_keys(str(default_name))
105
+ api_keys = keys.get_plugin_api_keys(str(default_name))
108
106
  context = {
109
107
  "plugin_name": plugin_name,
110
108
  "plugin_dir_name": str(default_name),
@@ -117,62 +115,6 @@ def build_context(
117
115
  return context
118
116
 
119
117
 
120
- def check_plugin_api_keys() -> None:
121
- if not c.PLUGINS:
122
- return
123
- print("\nFlyshell will now check plugin API keys.")
124
- has_keys_to_report = False
125
- for identifier, plugin in c.PLUGINS.items():
126
- required_keys = getattr(plugin, "api_keys", None) or []
127
- configured_keys = getattr(plugin, "api_keys_data", {})
128
- dir_name = plugin.context.get("plugin_dir_name", identifier)
129
- if not required_keys and not configured_keys:
130
- continue
131
- has_keys_to_report = True
132
- configured_lookup = {k.lower(): (k, v) for k, v in configured_keys.items()}
133
- seen_keys = set()
134
- print(f"\nPlugin: {plugin.name} ({identifier})")
135
- for req in required_keys:
136
- req_lower = req.lower()
137
- seen_keys.add(req_lower)
138
- if req_lower in configured_lookup:
139
- orig_k, _ = configured_lookup[req_lower]
140
- print(f"✅ {orig_k} - Key found [Required]")
141
- else:
142
- print(f"⚠️ {req} - KEY NOT FOUND [Required]")
143
- print(f"Please define in the .env file as: {dir_name}_{req}=<your_key>")
144
- for k_lower, (orig_k, _) in sorted(configured_lookup.items()):
145
- if k_lower not in seen_keys:
146
- print(f"✅ {orig_k} - Key found [Optional/Extra]")
147
- if not has_keys_to_report:
148
- print("✅ No API keys required for any loaded plugins.")
149
-
150
-
151
- def check_all_plugin_dependencies() -> Dict[str, List[str]]:
152
- if not c.PLUGINS:
153
- return {}
154
- print("\nFlyshell will now check plugin third-party dependencies.")
155
- plugins_with_deps = False
156
- all_missing: Dict[str, List[str]] = {}
157
- for identifier, plugin in c.PLUGINS.items():
158
- declared = getattr(plugin, "third_pty_libs", None) or []
159
- if not declared:
160
- continue
161
- plugins_with_deps = True
162
- installed, missing = deps.verify_plugin_dependencies(plugin)
163
- print(f"\nPlugin: {plugin.name} ({identifier})")
164
- for dep in installed:
165
- print(f"✅ {dep} - Dependency found")
166
- for dep in missing:
167
- print(f"⚠️ {dep} - DEPENDENCY NOT FOUND")
168
- print(f"Install using: 'sys pip install {dep}' once system has booted.")
169
- if missing:
170
- all_missing[identifier] = missing
171
- if not plugins_with_deps:
172
- print("✅ No third-party dependencies required for any loaded plugins.")
173
- return all_missing
174
-
175
-
176
118
  def unload_plugins() -> None:
177
119
  for identifier, plugin in list(c.PLUGINS.items()):
178
120
  try:
@@ -0,0 +1,18 @@
1
+ # src/flyshell/startup/__init__.py
2
+
3
+ from flyshell.startup.boot import launch, shutdown
4
+ from flyshell.startup.checks import (
5
+ check_components,
6
+ check_environment,
7
+ check_optional_features,
8
+ run_preflight,
9
+ )
10
+
11
+ __all__ = [
12
+ "check_components",
13
+ "check_environment",
14
+ "check_optional_features",
15
+ "launch",
16
+ "run_preflight",
17
+ "shutdown",
18
+ ]
@@ -0,0 +1,21 @@
1
+ # src/flyshell/startup/boot.py
2
+
3
+ from flyshell import constants as c
4
+ from flyshell import accounts, pkgm
5
+ from flyshell.core import console
6
+
7
+
8
+ def launch() -> None:
9
+ print("Flyshell will now boot.")
10
+ c.APP_DIR.mkdir(parents=True, exist_ok=True)
11
+ pkgm.scan_plugins()
12
+ pkgm.check_plugin_api_keys()
13
+ pkgm.check_all_plugin_dependencies()
14
+ if accounts.login_flow():
15
+ console.boot()
16
+ else:
17
+ print("\nShutting down...\n")
18
+
19
+
20
+ def shutdown() -> None:
21
+ pkgm.unload_plugins()
@@ -0,0 +1,90 @@
1
+ # src/flyshell/startup/checks.py
2
+
3
+ from flyshell import constants as c
4
+ from flyshell.core import console
5
+ from flyshell.native import diskops_bridge
6
+
7
+ from pathlib import Path
8
+ import importlib.util
9
+ import sys
10
+
11
+
12
+ def check_components() -> bool:
13
+ print("\nFlyshell will now check that your modules exist.")
14
+ if str(c.SRC_DIR) not in sys.path:
15
+ sys.path.insert(0, str(c.SRC_DIR))
16
+ present = []
17
+ missing = []
18
+ for obj in c.REQUIRED_COMPONENTS:
19
+ path = Path(c.PACKAGE_ROOT / obj)
20
+ if path.exists():
21
+ present.append(str(path))
22
+ else:
23
+ missing.append(str(path))
24
+ if missing:
25
+ print("\nCRITICAL BOOT ERROR: Critical system module(s) could not be found.")
26
+ for item in present:
27
+ print(f"✅ {item} - File found")
28
+ for item in missing:
29
+ print(f"❌ {item} - FILE NOT FOUND")
30
+ return len(missing) == 0
31
+
32
+
33
+ def check_environment() -> bool:
34
+ if c.HOST_OS not in c.SUPPORTED_OS:
35
+ print(
36
+ f"\nCRITICAL ERROR: Host operating system '{c.HOST_OS}' is not supported."
37
+ )
38
+ print("Flyshell cannot launch because your operating system is not supported.")
39
+ return False
40
+ if sys.version_info < c.SUPPORTED_PYTHON:
41
+ print(
42
+ "\nCRITICAL ERROR: Your Python version is too old to be supported by Flyshell."
43
+ )
44
+ print("Flyshell cannot launch because it requires Python 3.10 or newer.")
45
+ return False
46
+ print(f"\nYour OS '{c.HOST_OS}' is compatible with Flyshell.")
47
+ return True
48
+
49
+
50
+ def check_optional_features() -> None:
51
+ tests_dir = c.PROJECT_ROOT / "tests"
52
+ if tests_dir.exists():
53
+ print(
54
+ "\nFlyshell will now check internal additional packages and features. These are not required."
55
+ )
56
+ for path in tests_dir.glob("test_*.py"):
57
+ print(f"✅ {path.name} - Test found")
58
+ if importlib.util.find_spec("pytest") is not None:
59
+ print("✅ Your tests can be run using Pytest.")
60
+ else:
61
+ print("⚠️ Your tests cannot be run as Pytest is not installed.")
62
+ print(
63
+ "\nFlyshell will now check external additional packages and features. These are not required."
64
+ )
65
+ if console.check_readline():
66
+ print(
67
+ "✅ Terminal Readline - Available (Use arrow keys to navigate input history)"
68
+ )
69
+ else:
70
+ print(
71
+ "⚠️ Terminal Readline - Unavailable (This does not affect your performance)"
72
+ )
73
+ if diskops_bridge.has_native_support():
74
+ print(
75
+ "\n✅ C Extensions Available - Native C binaries are present and will be used where applicable.\n"
76
+ )
77
+ else:
78
+ print(
79
+ "\n⚠️ C Extensions Unavailable - Flyshell will revert to legacy Python objects where applicable.\n"
80
+ )
81
+
82
+
83
+ def run_preflight() -> bool:
84
+ if not check_components():
85
+ print("\nFlyshell cannot launch until the above file paths are restored.")
86
+ return False
87
+ if not check_environment():
88
+ return False
89
+ check_optional_features()
90
+ return True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.6.2
3
+ Version: 1.6.3
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10