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

how to make pyml aware of a single python "module" #77

Closed
UnixJunkie opened this issue Jan 27, 2022 · 7 comments
Closed

how to make pyml aware of a single python "module" #77

UnixJunkie opened this issue Jan 27, 2022 · 7 comments

Comments

@UnixJunkie
Copy link

No description provided.

@UnixJunkie UnixJunkie changed the title how to make pyml aware of a single python "module how to make pyml aware of a single python "module" Jan 27, 2022
@UnixJunkie
Copy link
Author

Sorry, I am writing a proper question now...

@UnixJunkie
Copy link
Author

If I have a python "module". I.e. I wrote a couple of functions into a Python file.
Let's say toto.py.
What is the proper way to make pyml aware of this Python module?
My plan is for my ocaml program to just call functions from this module, which would have done all the imports it needs and such.
Do I have to install this toto.py file? How (using pip?) and where should it be installed?
Sorry if this is a dumb question.

@UnixJunkie
Copy link
Author

Or, is there a way to say: "please pyml, interprete the toto.py file because then I am going to call functions from it" ?

@UnixJunkie
Copy link
Author

In pyml_tests.ml there are probably some example bits that I need.

@thierry-martinez
Copy link
Owner

Sorry for the delay. I think that let toto = Py.Import.import_module "toto" should do the trick.

@UnixJunkie
Copy link
Author

Thanks a lot Thierry! You're the best.

@UnixJunkie
Copy link
Author

UnixJunkie commented Jan 31, 2022

I wonder if I can combine this with the ocaml library (mirage/ocaml-crunch) which allows to statically include a file.
Hence, I would not need to have to install this python file somewhere, it would always be part of my ocaml executable! :)
That would make the deployment of the executable super easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants