imgui_bundle icon indicating copy to clipboard operation
imgui_bundle copied to clipboard

Do not import imgui_bundle.immapp.immapp_notebook by default

Open remss opened this issue 8 months ago • 3 comments

Hello Team!

When importing imgui_bundle, it imports by default immapp which imports immapp_notebook. Inside immapp_notebook there is _run_app_function_and_display_image_in_notebook() that will import cv2, PIL, IPython

When using pyinstaller to freeze the my python entry point to a .exe it will detect imports of cv2/Pil/IPython and will embed them in final build.

Would it be possible to remove from immapp_init_.py the from imgui_bundle.immapp.immapp_notebook import run_nb as run_nb ?

So users currenlty doing like this

from imgui_bundle import immapp
immapp.run_nb()

would have to do do like this

from imgui_bundle.immapp.immapp_notebook 
immapp_notebook .run_nb()

This will solve issue with pyinstaller embedding things that should not be here.

Thank you!

remss avatar Jun 24 '25 13:06 remss

Bonjour !

Removing this import would change the API for end-users, so I am wary to do it without a full analysis of the impact.

In the meantime, you could also use

pyinstaller … --exclude-module cv2 --exclude-module PIL --exclude-module IPython

pthom avatar Jun 24 '25 14:06 pthom

Thanks, this is what I'm doing for now. But I'd like to not hardcode hacks like this in my app. Let's say cv2 is required by a new feature, it may be not obvious to detect why frozen release is broken. And if you change the immapp to import an other package, I may not detect that it should be ignored too.

remss avatar Jun 25 '25 15:06 remss

I pushed https://github.com/pthom/imgui_bundle/commit/6bd55c995f759d06f988fac47abdb16c1fc24c98

Can you tell me if it is enough to solve the issue on your side?

pthom avatar Nov 09 '25 17:11 pthom