asottile / setuptools-golang-examples Goto Github PK
View Code? Open in Web Editor NEWExample extensions written for https://github.com/asottile/setuptools-golang
License: MIT License
Example extensions written for https://github.com/asottile/setuptools-golang
License: MIT License
I have a more complex extension I'm trying to write that has a fair amount of Python code and a Python C extension that wraps a library written in Go. The Python code and the Python C extension are in one repo, and the Go code is outside of that. I'm trying to figure out if it's possible to somehow merge the C extension code (c and h files) with the code from the Go library into one directory before building.
It's kind of an odd thing to do, but the purpose of the code in the Go repo is to build a c-shared library that can be used on its own. I'm just wrapping that C API in a Python module.
I have created an example that uses setuptools-golang
for compilation of the Go module, but then uses cffi
to create the interface to Python.
This means that things like
// #include <Python.h>
// int PyArg_ParseTuple_ll(PyObject*, long*, long*);
are not required anymore. The only glue-code function on the Go-side is one that casts/wraps C arrays to Go slices and the actual function is using Go-native types.
The rest of the gluecode is written in Python and the cffi
module compilation is written in Python, too.
Known issue: As of Go 1.6, passing C pointers to and from Go is more strict, producing panics in ArrayToSlice
. Since I don't understand how that could be fixed the code currently needs to be run with GODEBUG=cgocheck=0
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.