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

Make vm.import_from_str() so we can import string python programs as modules #5177

Closed
lattice0 opened this issue Feb 20, 2024 · 2 comments
Closed
Assignees
Labels
C-enhancement New feature or request

Comments

@lattice0
Copy link

Summary

Make an option to vm.import_from_str(). Currently, vm.import expects us to have a file path, and thus the python file needs to be somewhere in the system or maybe in a virtual file system. For some cases the python file could come as a string. I know that the mini repl allows us to run runtime generated python code, but there's no way to turn a string python program into a module inside the VM so I can then get the function attribute and call it with arguments.

#5173 is what I tried to do

Expected use case

Run python programs generated at runtime, but also be able to get its attributes like functions and call them with arguments. Currently we can only compile a string and run it, no way to turn it into a module on the VM

@lattice0 lattice0 added the C-enhancement New feature or request label Feb 20, 2024
@youknowone
Copy link
Member

Related to #5041
I think having this one is convenient for embedded interpreters

@youknowone
Copy link
Member

#5214 added a similar feature. Thank you for suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants