Skip to content

Commit

Permalink
Create verify_setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
duskfallcrew authored Nov 1, 2024
1 parent bf24ea4 commit e9ce1ab
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions scripts/verify_setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# scripts/verify_setup.py
import os
import importlib.util
import sys

def verify_extension_setup():
results = []

# Check directory structure
base_dir = os.path.dirname(os.path.dirname(__file__))
required_files = [
'install.py',
'requirements.txt',
'scripts/hf_backup.py',
'scripts/settings.py'
]

for file in required_files:
if os.path.exists(os.path.join(base_dir, file)):
results.append(f"✓ Found {file}")
else:
results.append(f"✗ Missing {file}")

# Check dependencies
dependencies = {
'huggingface_hub': '4.30.2',
'glob2': '0.7'
}

for package, version in dependencies.items():
try:
imported = importlib.import_module(package)
actual_version = getattr(imported, '__version__', 'unknown')
if actual_version == version:
results.append(f"✓ {package} version {version} installed correctly")
else:
results.append(f"! {package} version mismatch. Expected {version}, got {actual_version}")
except ImportError:
results.append(f"✗ {package} not installed")

# Check HF token (if set)
from modules import shared
if hasattr(shared.opts, 'data') and shared.opts.data.get("hf_write_key"):
results.append("✓ HF Write token is set")
else:
results.append("! HF Write token not set in settings")

return "\n".join(results)

# You can run this directly to test:
if __name__ == "__main__":
print(verify_extension_setup())

0 comments on commit e9ce1ab

Please sign in to comment.