You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just an idea.
Currently, I have one python file that I write to interface w/ ocaml (let's call it itf.py).
I.e. the ocaml side only calls functions defined in this file.
However, this said file may rely on other python files in the same directory to implement
complex things.
It would be nice if we can embed in some way those other files too.
Currently, I had to include by hand the other files into itf.py.
But, I hate to do this, I just duplicated code, if there are some bugs, I will need to correct in two places from now on.
Do you understand my need?
Would it be doable?
I could (should?) create a python library containing all those other files.
But then, the ocaml exe will rely on this library to be installed at runtime.
In terms of deployment, it would be nicer is the ocaml exe can embed everything needed (i.e. itf.py plus
all its required python files dependencies).
This is a sort of hacky solution, but do you know about stickytape? It is a script that allows you to "rollup" all the imported modules of your python program into a single mega script. Then you (I think) should probably be able to use the mega-script as your interface instead of your original interface.
The executable that it generates is movable...it works on my computer from any directory, and even if I move it on to a different server, without having to mess around with the PYTHONPATH or anything.
I think, this suggestion is great, but I will just use the unix cat command and achieve the same effect
in my gen_bindings.sh which invokes pyml_bindgen. :)
Activity
mooreryan commentedon May 14, 2023
This is a sort of hacky solution, but do you know about stickytape? It is a script that allows you to "rollup" all the imported modules of your python program into a single mega script. Then you (I think) should probably be able to use the mega-script as your interface instead of your original interface.
mooreryan commentedon May 14, 2023
Check this example out: https://github.com/mooreryan/pyml_bindgen_stickytape_example
The executable that it generates is movable...it works on my computer from any directory, and even if I move it on to a different server, without having to mess around with the
PYTHONPATHor anything.UnixJunkie commentedon May 14, 2023
UnixJunkie commentedon May 17, 2023
I consider this question has been properly answered. I will try soon the proposed solution.
UnixJunkie commentedon May 17, 2023
I think, this suggestion is great, but I will just use the unix cat command and achieve the same effect
in my gen_bindings.sh which invokes pyml_bindgen. :)