3

I am currently building an open-source project with Python for educational purposes, and I am going to add it on Github. It uses ffmpeg library as 64-bit compiled exe (I am on windows), by calling the executable with command line arguments within the code.

My question is that, how to handle the situation of other people try to use my code (let's say customers, even there are none). Because they would also need the ffmpeg executable.

  • Including ffmpeg executable to Github repo (Seems wrong, also would fail on multi-platform).
  • Add a dependency control in the beginning of code, informing the users that they should download the executable. (would make the user do some work)
  • Creating an installer that stores this file (don't know how to combine with github)

In linux, ffmpeg is install-able as a library in itself, adding it as a dependency would work in linux, however in Windows this would require adding installed directory to PATH (if installed, instead of copy-pasted near the code). Some more work for the user.

ffmpeg is just an example. I am also curious about this using other compiled binaries (if there is another method of using these projects, I am open to suggestions).

I also included ffmpeg and Python as tags just in case these tools supply guidance in these situations (couldn't find on internet, or did not know where to look).

Max Paython
  • 1,595
  • 2
  • 13
  • 25
  • So first of all there is no generic answer to this. You need to look at the license of the tools/binaries you are using. Some license prevent you from shipping the executable with your code and it needs to be downloaded separately. Also if you are cross platform, then steps in each environment will differ, so you will either document how to setup the executable in each environment or if you want to make it easy, you will include that as a part of your setup. This all also depends on how much effort you want to put to make life easy for person using your library. – Tarun Lalwani Jul 29 '19 at 03:12

2 Answers2

2

in Windows this would require adding installed directory to PATH (if installed, instead of copy-pasted near the code). Some more work for the user.

Not exactly.
Your program should, at first launch:

  • detect its runtime folder (the folder from which it is launched, which does not have to be in %PATH%)
  • detect if the executable it depends on is there, in the same folder (here, as an example, ffmpeg)
  • download it (from the Windows build page) in the runtime folder (meaning where your own program is)
  • run the rest of the program, calling the downloaded executable using, as its path, its runtime folder.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

It all obviously depend on the context, but if giving instruction for a package manager on each platform is not enough, you can offer to download an executable which contains your app and all the dependencies necessary in a sort of sandbox, and you need to make sure that your calls to these dependencies have the right path so they reference to the version inside the package to avoid any clash with an installed version.

This is something common when you want to sandbox a database and/or servers and for users to be able to delete it all in one go or make sure it does not clash with anything else.

This is what this MAMP project does. You've got everything you need in one application: MySQL database, Apache web server, PHP, etc. You can start and run your environment. If you put the executable to the trashcan, it deletes everything.

And it is not the only example. For ruby web applications there was a similar project called "locomotive". I don't know if it was done but something similar was in the pipeline for a Rails.app package. Also this is how the LÖVE project let's you distribute games. It just creates an executable for any platform containing the Lua programming language and all the libraries needed. Anybody can try the game or trash it without having to install anything else.

Mig
  • 662
  • 4
  • 13