Closed Czaki closed 1 year ago
So the stub file cannot be bundled and accessed?
If so, then an exception sounds right. Are you able to make a PR? I don't have a setup to test this.
So the stub file cannot be bundled and accessed?
It could be, but it needs to attach using datas
that may need to be manually curated and As I read in the readme attach_stub
is for IDE support which is not important in the frozen app.
If so, then an exception sounds right. Are you able to make a PR? I don't have a setup to test this.
I will do PR.
Well, not exactly. The stubs are used to define the imports, so they are not optional and cannot be removed when attach_stub
is used. We use __init__.pyi
files to define the imports, vs __init__.py
, so that Python doesn't immediately import modules; i.e., so we have a chance to load them lazily.
If you can ship the stub files inside your frozen archive, and if we can get access to them from the lazy loader, we can make it work.
If you can ship the stub files inside your frozen archive, and if we can get access to them from the lazy loader, we can make it work.
It looks like collect_data_files("skimage")
collect .pyi
for skimage
files so #39 and some update of readme may be enough, but need to investigate deeper.
@Czaki Can you confirm whether or not your issue has been solved, and whether there's anything we need to do here still?
I have set up a pre-release test for pyinstaller freeze of my application.
I just found that the import of scikit-image rc fail because lack of stub files
https://github.com/4DNucleome/PartSeg/actions/runs/4293660567/jobs/7481623224#step:10:183
Of course, I could try to workaround this by add more entries to
package_data
but I think that stub files in frozen applications are pointless.Python allows to check if the application is frozen by
getattr(sys, "frozen", False)
so it may be easy to add a proper check and not raise an exception in such a use case.