Given an entry file main.py like so:
#-*- coding: utf-8 -*-
# -*- mode: python -*-
import hy
import os.path
import hymodule
datas=[(os.path.dirname(hy.__file__), 'hy')]
hymodule.hello_world()
Given a Hy file hymodule.hy:
(defn hello-world []
(print "hello world!"))
If I use pyinstaller to create a standalone file:
pyinstaller main.py --onefile
And execute main.exe I get this error:
$ ./dist/main.exe
Traceback (most recent call last):
File "main.py", line 6, in <module>
import hymodule
ModuleNotFoundError: No module named 'hymodule'
[10852] Failed to execute script main
What is the proper way to create a standalone executable using Hy modules?
PyInstaller support is not implemented for Hy. I don't know whether changes would be needed to PyInstaller, Hy, or both. You can always try hy2py
ing all your code first, but this may not work if (a) your code still depends on Hy and (b) PyInstaller chokes on Hy even when used as an ordinary Python library.