pystarlark icon indicating copy to clipboard operation
pystarlark copied to clipboard

How to build a wheel for Python 3.11?

Open seperman opened this issue 2 years ago • 2 comments

Hi @ColdHeat I'm very interested in using Starlark for sandboxing Python. Is there any way you can guide me to get it up and running for Python 3.11?

When I try to install it via pip:

  subprocess.check_call(cmd, cwd=cwd, env=dict(os.environ, **env))
  File "/home/user/.pyenv/versions/3.11.4/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '('go', 'build', '-buildmode=c-shared', '-o', '/home/user/Workspace/tools/pystarlark/build/lib.linux-x86_64-cpython-311/pystarlark/starlark.cpython-311-x86_64-linux-gnu.so', '-ldflags=-s -w')' returned non-zero exit status 2

I cloned the repo and upgraded setuptools-golang and cffi versions to the latest and I still get the same error. Thank you

seperman avatar Sep 13 '23 18:09 seperman

Hi there, you need to have golang installed to build this library. It's a little tricky admittedly.

You may want to consider https://github.com/caketop/python-starlark-go which I believe has 3.11 wheels.

Alternatively if you could the build.yml action to include 3.11 I can probably cut a new release to PyPI.

ColdHeat avatar Sep 13 '23 18:09 ColdHeat

Thanks for the prompt response. I do have go installed. I can't get the stderr for subprocess.CalledProcessError in setuptools-golang to see what it is complaining about. The path it is referring to in the error (/home/user/Workspace/tools/pystarlark/build/lib.linux-x86_64-cpython-311/pystarlark/starlark.cpython-311-x86_64-linux-gnu.so) does not exist. Not sure what to do. Thanks for pointing out the python-starlark-go

seperman avatar Sep 13 '23 19:09 seperman