go-python/cpy3

Convert go struct to dict

abemedia opened this issue · 6 comments

It would be great to have a helper function that converts a go struct or map to a Python dict.

As a matter of fact it would also be really useful to be able to convert other types, for example a function like ToPyObject which takes an interface and using reflection builds the relevant Python type.

A FromPyObject doing the reverse would be ideal too.

This would massively simplify interaction between Python and Go.

aadog commented

@abemedia your dream is complete

Let's try it, python bindings cgo-less

https://github.com/aadog/py3-go

This is out of scope for the C-API bindidings. However, I'd be open to creating a pkg (within this module) with higher level abstractions on top of the base C-API bindings that help with common tasks, like importing a module or exchanging data. (The C-API bindings should continue to exist "untampered" however).

Would welcome PRs in that direction!

@aadog Let's try it, python bindings cgo-less https://github.com/aadog/py3-go

thanks a lot, this looks like an amazing project, I will definitely try it. At a first look your project and this project don't seem to have exactly identical goals (for this project it's mainly C-API bindings that behave close to the original API - yours seems to have many more (which is quite exciting!)).

Any chance that you could clarify the license for your project? If it's compatible to this project, we might be able to steal from you. ;-)

aadog commented

@christian-korneck He doesn't have any restrictions, you can use it as you like

Toys written when you are bored, I wish you a good time

I actually already did this in a fork. Happy to create a PR for it if it is acceptable.
What shall I call the sub-package?

sure, a PR for further discussion would be welcome. I’d say let’s call it helpers for now, we can still discuss naming.