build_exo.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import site
  2. import subprocess
  3. import sys
  4. import os
  5. def run():
  6. site_packages = site.getsitepackages()[0]
  7. command = [
  8. f"{sys.executable}", "-m", "nuitka", "exo/main.py",
  9. "--company-name=exolabs",
  10. "--product-name=exo",
  11. "--output-dir=dist",
  12. "--follow-imports",
  13. "--standalone",
  14. "--output-filename=exo",
  15. "--onefile",
  16. "--python-flag=no_site"
  17. ]
  18. if sys.platform == "darwin":
  19. command.extend([
  20. "--macos-app-name=exo",
  21. "--macos-app-mode=gui",
  22. "--macos-app-version=0.0.1",
  23. "--include-module=exo.inference.mlx.models.llama",
  24. "--include-module=exo.inference.mlx.models.deepseek_v2",
  25. "--include-module=exo.inference.mlx.models.base",
  26. "--include-module=exo.inference.mlx.models.llava",
  27. "--include-module=exo.inference.mlx.models.qwen2",
  28. "--include-distribution-meta=mlx",
  29. "--include-module=mlx._reprlib_fix",
  30. "--include-module=mlx._os_warning",
  31. f"--include-data-files={site_packages}/mlx/lib/mlx.metallib=mlx/lib/mlx.metallib",
  32. f"--include-data-files={site_packages}/mlx/lib/mlx.metallib=./mlx.metallib",
  33. "--include-distribution-meta=pygments",
  34. "--nofollow-import-to=tinygrad"
  35. ])
  36. elif sys.platform == "win32":
  37. command.extend([
  38. "--windows-icon-from-ico=docs/exo-logo-win.ico",
  39. "--file-version=0.0.1",
  40. "--product-version=0.0.1"
  41. ])
  42. elif sys.platform.startswith("linux"):
  43. command.extend([
  44. "--include-distribution-metadata=pygments",
  45. "--linux-icon=docs/exo-rounded.png"
  46. ])
  47. try:
  48. subprocess.run(command, check=True)
  49. print("Build completed!")
  50. except subprocess.CalledProcessError as e:
  51. print(f"An error occurred: {e}")
  52. if __name__ == "__main__":
  53. run()