-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Packaging hy code with zipapp does not work #1774
Comments
As a workaround, you can translate Hy files to Python first with |
Ah, I was experimenting with using hyc to produce pyc files and put them inside the zip but that is not the right approach? |
I don't know. You can try it. Python has had ambivalent support for running bytecode without a corresponding source file. |
Using hy2py worked for my code, however, I really wanted to use the same trick to bring in hy.contrib.hy-repr to be able to print hy data structures nicely but did not work well for those modules. |
What do you mean, "did not work well"? |
Sorry, actually the problem was not in hy-repr but actually from it importing hy.core.language, so when trying to hy2py that file it ends up in some import loop:
|
zipapp doesn't package dependencies (which Hy is one of) along with the code being packaged. I believe in this use case you'd have to use something like shiv. This could be a good thing to add to the documentation. |
Here's a minimal example that follows
|
#2354 partly provides this: |
I'm writing this ticket in response to this How to load Hy package in zipapp? stackoverflow question.
I have tried reproducing this on the latest master a38cdb7 using the files in this gist
It works fine when not using zipapp:
But after zipping:
The text was updated successfully, but these errors were encountered: