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

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

For this week, I worked on cffi: Support map. This feature is now currently only supported by cffi engine. :)

The first thing I did to support this feature is an adding cgo APIs to interact with map types. I added set/get functions and length function.

Next step was generating protocols for map types as I did before for slices/arrays. The only difference between before is handling key/value data.

I submitted my PR based on which I described. My mentor Sebastien commented about the unit testing. because key orders of a map can be changed for every running. I updated my PR and then merged.

After my PR was merged, gopy can run maps.go file by using CFFI engine.

root@180a6474ebba:~/go/src/github.com/go-python/gopy/_examples/maps# pypy test.py 
maps.Sum from Go map: 8.0
maps.Sum from Python dictionary: 8.0
maps.Keys from Go map: []int{1, 2}
maps.Values from Go map: []float64{3, 5}
maps.Keys from Python dictionary: []int{1, 2}
maps.Values from Python dictionary: []float64{3, 5}

This is my final work for Google Summer of Code 2017. I am going to upload a final report and epilog of this summer project soon.

However, my contribution for gopy is not the end. There is more thing that we should do for gopy to use in production mode. I will talk about it in my final report

Lastly, I am really thank you to my main mentor Sebastien Binet who lead my project very successfully. Without him, there was no chance for me to run this project for this summer.

Thank you.

Happy hacking

Written on August 15, 2017