Skip to content

Serve implementation as a library #25

Description

@m-anshuman2166

@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

Activity

changed the title [-]Server as a library[/-] [+]Serve implementation as a library[/+] on May 15, 2022

pmp-p commented on May 15, 2022

@pmp-p

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

Abestanis commented on May 15, 2022

@Abestanis
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 commented on May 15, 2022

@m-anshuman2166
Author

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

Im not so professional in JNI

m-anshuman2166 commented on May 15, 2022

@m-anshuman2166
Author

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

Abestanis commented on May 15, 2022

@Abestanis
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions