Add dependency scanning and optional dependency checks

This commit is contained in:
thePR0M3TH3AN
2025-08-05 21:04:50 -04:00
parent c2d80aa438
commit 68eaa34d76
5 changed files with 90 additions and 56 deletions

View File

@@ -18,6 +18,7 @@ from colorama import init as colorama_init
from termcolor import colored
from utils.color_scheme import color_text
import traceback
import importlib
from seedpass.core.manager import PasswordManager
from nostr.client import NostrClient
@@ -38,6 +39,25 @@ from local_bip85.bip85 import Bip85Error
colorama_init()
OPTIONAL_DEPENDENCIES = {
"pyperclip": "clipboard support for secret mode",
"qrcode": "QR code generation for TOTP setup",
"toga": "desktop GUI features",
}
def _warn_missing_optional_dependencies() -> None:
"""Log warnings for any optional packages that are not installed."""
for module, feature in OPTIONAL_DEPENDENCIES.items():
try:
importlib.import_module(module)
except ModuleNotFoundError:
logging.warning(
"Optional dependency '%s' is not installed; %s will be unavailable.",
module,
feature,
)
def load_global_config() -> dict:
"""Load configuration from ~/.seedpass/config.toml if present."""
@@ -1205,6 +1225,7 @@ def main(argv: list[str] | None = None, *, fingerprint: str | None = None) -> in
Optional seed profile fingerprint to select automatically.
"""
configure_logging()
_warn_missing_optional_dependencies()
initialize_app()
logger = logging.getLogger(__name__)
logger.info("Starting SeedPass Password Manager")