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

Serve implementation as a library #25

Open
m-anshuman2166 opened this issue May 15, 2022 · 5 comments
Open

Serve implementation as a library #25

m-anshuman2166 opened this issue May 15, 2022 · 5 comments

Comments

@m-anshuman2166
Copy link

@Abestanis as much as what i see, I need your library seriously for running my python code

But, main issue is : I want your implementation to be available as a library (That can run python code provided as a string)

It would be really helpful to me

@m-anshuman2166 m-anshuman2166 changed the title Server as a library Serve implementation as a library May 15, 2022
@pmp-p
Copy link

pmp-p commented May 15, 2022

You could use RPC for that : udp on localhost is really very fast.

@Abestanis
Copy link
Owner

This already somewhat exists in APython_PyApp as a template. It's unfortunately not bundled as a library, but all the code you need would be in here and you could just copy and paste it into your app for now. You could start a new activity in a new process and then do what the app template does, but instead of passing a path to a file to the interpreter, give it your code via the -c command line argument.

You could use RPC for that : udp on localhost is really very fast.

RPC was an option I initially considered, but the approach I endet up using in the APython_PyApp executes the code as part of the apps process, so there is no need for RPC. This also means that the Python code has access to the permissions of the calling App, instead of the permissions of the Python host.
I am aware that there are restrictions on executing native code which isn't bundled in your own app on newer Android versions (Termux has a similar problem which I think applies to us as well), so we might have to revert to RPC at some point. For now, if you target an old enough sdk version, it should work.

@m-anshuman2166
Copy link
Author

Hmm, and what do we have to say about python updates 😅

Im not so professional in JNI

@m-anshuman2166
Copy link
Author

m-anshuman2166 commented May 15, 2022

@Abestanis I'm much more than interested in your project (if you wannna continue...)

@Abestanis
Copy link
Owner

I do plan to update to the latest version, as mentioned in #23, but I'm currently also busy with other projects. I will try to look into it over the next week, no promises though.

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

3 participants