[GSoC 2017] Coding period Week 4 - Week 5 with gopy@CERN-HSF

GSoC2017 Hi, all! This post is about what I did for on from 4th week to 5th week of the coding period at Google Summer of Code 2017.

FirstEval

To begin with, my project was passed for 1st evaluation for Google Summer Of Code 2017. I am really happy to pass this evaluation. Also, I really appreciate to my mentors, Sebastien Binet and Alexandre Claude. Sebastien gave me lots of feedback for me. And all of them are really helpful to proceed my project.

For this week, I worked on several tiny issues. Here is the list.

gopy: go-1.9 requires exactly one main package for c-shared libs

This issue was detected from our Travis CI. We tested every go version on the Travis CI and gopy build was failed for go-1.9. I found that Google development team updated -buildmode=c-shared. So, I updated gopy not to use c-shared for the go get command. Also, I sent my first patch to go dev team.

gencffi: Support bool types

Bool type is one of the built-in types of Go. So I updated CFFI engines to support bool type. this code could be run on the Python.

root@180a6474ebba:~/go/src/github.com/go-python/gopy/_examples/simple# pypy test.py 
doc(pkg):
'simple is a simple package.\n'
pkg.Func()...
fct = pkg.Func...
fct()...
pkg.Add(1,2)= 3
pkg.Bool(True)= True
pkg.Bool(False)= False

cffi: Let Python3 handles string as ASCII.

Because of string handling method has a difference between Python2 and Python3, Handling string is one of the major issues for this project. Python2 handles string as ASCII type for a default but Python3 handles string as Unicode type for the default. So, using Gostring on Python sides, we need to unify the types for the string.

In the near future, we need to use a Unicode type for string but right now I decide it to unify string type as ASCII. Now, Python3 can run gopy generated codes which contain string for return types.

root@180a6474ebba:~/go/src/github.com/go-python/gopy/_examples/simple# python3 test.py 
doc(pkg):
'simple is a simple package.\n'
pkg.Func()...
fct = pkg.Func...
fct()...
pkg.Add(1,2)= 3
pkg.Bool(True)= True
pkg.Bool(False)= False

On the week 6, I worked on cffi: Support struct types. I will talk about it in the next post.

Thank you.

Happy hacking

Written on July 8, 2017