BlogsDatadogEmbedding Python in Go

Embedding Python in Go

Embedding Python in Go

1
posts
2018

This post details the initial integration of CPython into the Datadog Agent, a Go binary. It explains how cgo is used to bridge Go and C APIs, enabling the embedding of the Python interpreter. The article covers initializing and finalizing the interpreter, importing modules, and calling Python functions from Go, highlighting the use of the go-python library as a wrapper for cgo details. It also touches upon the Global Interpreter Lock (GIL) as a consideration for concurrency.

2018

Cgo and Python | Datadog

4/16/2018

This post introduces the concept and implementation of embedding a CPython interpreter within a Go binary (Datadog Agent) using cgo. It provides code examples for initializing the interpreter, importing Python modules, and executing Python functions from Go. The use of the go-python library is presented as a way to abstract cgo complexities. The article also briefly discusses the implications of the Global Interpreter Lock (GIL) for concurrency.