Axiovora-X / scripts /import_check.py
ZAIDX11's picture
Add files using upload-large-folder tool
19faf57 verified
"""Script to check imports of heavy or optional packages and report status.
Run with the project's Python to see what packages are importable in the current environment.
"""
import importlib
import sys
import os
# Ensure repository root is first on sys.path so our local stubs are preferred over site-packages
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
packages = [
"torch",
"z3",
"networkx",
"matplotlib",
"scipy",
"h5py",
"jax",
"tensorflow",
]
def check_package(name: str):
try:
mod = importlib.import_module(name)
print(f"OK: {name} -> {mod.__file__ if hasattr(mod, '__file__') else repr(mod)}")
return True
except Exception as e:
print(f"FAIL: {name} -> {e}")
return False
def main():
results = {p: check_package(p) for p in packages}
ok = [p for p, r in results.items() if r]
fail = [p for p, r in results.items() if not r]
print("\nSummary:\n", f"OK ({len(ok)}): {ok}", f"FAIL ({len(fail)}): {fail}", sep='\n')
if fail:
sys.exit(2)
if __name__ == '__main__':
main()