Skip to content
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

Support for frozen apps #32

Closed
almarklein opened this issue Nov 7, 2014 · 7 comments
Closed

Support for frozen apps #32

almarklein opened this issue Nov 7, 2014 · 7 comments

Comments

@almarklein
Copy link
Member

We would like imageio to work well in frozen apps.

For now, frozen apps with imageio should just work, but required binaries are still downloaded at runtime. This requires an internet connection, so it may be good to provide a way to ship the binary dependencies.

For this we need to provide a way for the developer to copy all required binaries to the app directory (so they can be shipped along) and we need to look in that directory too.

@paulmueller
Copy link
Contributor

paulmueller commented Jun 20, 2017

I propose the following workflow:

  1. Implement an entry point named e.g. imageio_download_binary imageio_download_bin for downloading the required binary.
  2. Add the option --package-dir to the entry point which will download the binary to the plugins recources directory of the installed package. This directory can be determined with pkg_resources.recource_filename (which also works with eggs), e.g. pkg_resources.resource_filename("imageio.plugins", imageio.plugins.ffmpeg.FNAME_PER_PLATFORM[imageio.plugins.ffmpeg.get_platform()]).
  3. Give the binary file in the plugins directory highest priority when calling the get_exe method.
  4. For Pyinstaller, only a simple hooks script is required:
    # hook-imageio.py
    from PyInstaller.utils.hooks import collect_data_files
    datas = collect_data_files('imageio')
    (needs pull request for PyInstaller)

This workflow as these advantages:

  1. It does not break the current behaviour
  2. Not many changes to the sources of imageio are required
  3. It allows to download binaries with a command line script
  4. On CIs such as appveyor or travisCI, it allows to easily build PyInstaller distributables with only the required binaries

@almarklein
Copy link
Member Author

Sounds like a plan. How do we deal with the fact that there are multiple binaries? Would you do e.g.
imageio_download_binary ffmpeg ?

@paulmueller
Copy link
Contributor

Yes, that would be the usage of the entry point script. Did I oversee anything? I could start with a PR.

@almarklein
Copy link
Member Author

As far as I can see, this should work. Looking forward to a PR!

@paulmueller
Copy link
Contributor

I have a question regarding the _set_platform_resources method in setup.py (used in build_with_fi). What is the use-case of this method? Also, there are two lines dealing with ffmpeg commented out in _set_platform_resources?

@almarklein
Copy link
Member Author

The purpose was to make it possible to build dists with the libraries packaged in. It's not used anymore though (at least not by me). The FFMPEG lines were added at some point, but then commented because it would make the dist package very large.

htgoebel pushed a commit to pyinstaller/pyinstaller that referenced this issue Jul 26, 2017
Imageio is a Python library that provides an easy interface to read and write a wide range of image data, including animated images, video, volumetric data, and scientific formats.
http://imageio.github.io/

This hook script will make it possible to include binaries for ffmpeg, avbin, and freeimage.
References:
- imageio/imageio#270
- imageio/imageio#32

[skip ci] no test case for this
@paulmueller
Copy link
Contributor

paulmueller commented Sep 12, 2017

This one can be closed now (#270).

cowo78 pushed a commit to cowo78/pyinstaller that referenced this issue Dec 7, 2018
Imageio is a Python library that provides an easy interface to read and write a wide range of image data, including animated images, video, volumetric data, and scientific formats.
http://imageio.github.io/

This hook script will make it possible to include binaries for ffmpeg, avbin, and freeimage.
References:
- imageio/imageio#270
- imageio/imageio#32

[skip ci] no test case for this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants