cue-lang / cue

The home of the CUE language! Validate and define text-based and dynamic configuration
https://cuelang.org
Apache License 2.0
5.01k stars 283 forks source link

Python bindings #162

Open cueckoo opened 3 years ago

cueckoo commented 3 years ago

Originally opened by @jtrakk in https://github.com/cuelang/cue/issues/162

I'm wondering if CUE might support Python bindings.

As far as I know, the simplest and most widely supported interfaces are via CFFI, as in this Go example. Binaries can be distributed in the wheel format on PyPI.

cueckoo commented 3 years ago

Original reply by @mpvl in https://github.com/cuelang/cue/issues/162#issuecomment-546199878

This could live in a cuelang repo, like cuelang/lang-python is someone wants to take this on.

cueckoo commented 3 years ago

Original reply by @mpvl in https://github.com/cuelang/cue/issues/162#issuecomment-546587123

@jtrakk could you perhaps comment on which features you would want to expose in the API. The API of CUE is quite large.

cueckoo commented 3 years ago

Original reply by @jtrakk in https://github.com/cuelang/cue/issues/162#issuecomment-546632633

Even a minimal set of features could be useful. For example, translation between CUE strings and built-in Python types (or even JSON strings) would be enough to get started with CUE if it were packaged on PyPI so I could just pip install it.

cueckoo commented 3 years ago

Original reply by @bep in https://github.com/cuelang/cue/issues/162#issuecomment-546636671

SInce Cue is a Go project, it would probably make sense to look at https://github.com/google/starlark-go

cueckoo commented 3 years ago

Original reply by @mbarkhau in https://github.com/cuelang/cue/issues/162#issuecomment-790215156

This project has been created in the meantime: https://pypi.org/project/pycue/

It's a wrapper around the cue CLI command.

philipdexter commented 3 years ago

There's this https://github.com/philipdexter/pycue which I created a long time ago