Skip to content

Embed into another program #138

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

Closed
alexec opened this issue Feb 17, 2021 · 6 comments
Closed

Embed into another program #138

alexec opened this issue Feb 17, 2021 · 6 comments

Comments

@alexec
Copy link

alexec commented Feb 17, 2021

Is it possible to embed this? Like Otto (https://github.com/robertkrimen/otto).

@sbinet
Copy link
Member

sbinet commented Feb 22, 2021

as can be seen in https://github.com/go-python/gpython/blob/master/main.go#L120, embedding a gpython vm is like:

res, err := vm.Run(module.Globals, module.Globals, code, nil)

ie:

is that too low level an API?

@alexec
Copy link
Author

alexec commented Feb 22, 2021

I actually figured it out:

https://github.com/argoproj/argo-workflows/blob/master/util/python/python.go

I wrote code to convert Go types into Python types. Is there another way?

@miathedev
Copy link

My question is similar. I would like to execute methods of a Python script from my Golang application.
Is that possible in a easy way? I need something more high-level fashioned.

@sbinet
Copy link
Member

sbinet commented Jan 10, 2022

I'll try to provide a simple example.
but this will have to wait for #144 to be merged (as the API is changing a bit to allow for multiple VM-contexts to run concurrently)

@drew-512
Copy link
Contributor

drew-512 commented Jan 10, 2022

In the coming days I'll PR the main README and add updated docs and snippets for newcomers to more easily get up and running. The changes coming offer a couple new high-level calls that make life very nice to use and embed gpython.

@sbinet
Copy link
Member

sbinet commented Feb 13, 2022

fixed w/ #159

@sbinet sbinet closed this as completed Feb 13, 2022
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

4 participants