skillfed

setuptools-golang

A setuptools extension for building cpython extensions written in golang.

setuptools-golang v2.9.0 1.4M downloads/30d#3,987 on PyPI104
Permissive license MIT Abandoned released

What it is and what it does

setuptools-golang is a setuptools plugin that lets you write CPython extension modules in Go instead of C or C++. You define Go source files as extension modules in your setup.py, and the tool compiles them into native Python extensions using Go's cgo mechanism. It handles the build configuration, GOPATH management, and optional binary stripping to reduce extension size.

The package is primarily useful for teams that want to leverage Go's concurrency model, standard library, or existing Go codebases to accelerate performance-critical sections of Python applications. It also provides a tool for building manylinux wheels so end users can install pre-compiled extensions without needing a Go compiler. However, the project is now archived and no longer maintained, meaning new Python or Go versions may introduce incompatibilities that won't be fixed.

Use it for:

  • Accelerate CPU-bound Python code by rewriting hot loops or algorithms in Go and exposing them as Python functions.
  • Integrate existing Go libraries or services into Python applications without rewriting them in C or Python.
  • Build and distribute pre-compiled manylinux wheels so Python users don't need Go or a C compiler installed.
  • Prototype Go-based performance improvements to Python projects while keeping the public API in Python.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A setuptools extension that builds CPython extensions from Go source code, enabling developers to write performance-critical Python modules in Go and package them as standard Python extensions.

No—do not install for new projects. The package is archived and abandoned; no releases have been made since the latest release and the repository accepts no new contributions. While it works for existing projects already using it, starting a new Go-Python integration on this tool risks hitting unresolved bugs or incompatibilities with future Python or Go versions. Consider alternatives for new work.

Install

setuptools-golang on PyPI

pip

pip install setuptools-golang

uv

uv add setuptools-golang

poetry

poetry add setuptools-golang

Installing setuptools-golang

Before you install

Low install friction with a single runtime dependency on setuptools. However, the project is archived and abandoned, with no releases for over a year, signaling that maintenance has ended and future compatibility issues may not be addressed.

License in practice

MIT license is permissive, allowing commercial and private use with minimal restrictions—you may use this in proprietary projects without obligation to share modifications.

Quickstart

# In setup.py:
from setuptools import setup, Extension

setup(
    name='myproject',
    build_golang={'root': 'github.com/user/project'},
    ext_modules=[Extension('example', ['example.go'])],
    setup_requires=['setuptools-golang'],
)

# Then: pip install .

Requires Go >= 1.5 installed on the build system; Python >= 3.8 required; supported on Linux, macOS, and win32.

Verify before relying

  • Whether the archived repository will receive security patches or compatibility fixes for future Python or Go releases.
  • Current real-world usage and whether the Go cgo/CPython API integration remains stable with modern Go and Python versions.
  • Compatibility with PyPy3 given the abandoned maintenance status.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 1 — setuptools
Maintenance abandoned — 1,112 days since the last release
Last repo commit (repository archived)
First released
Downloads 1,375,874/month — #3,987 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: setuptools_golang-2.9.0-py2.py3-none-any.whl

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

build python extensions in gogolang cpython extension buildersetuptools go integrationpython go bindingsgo to python extension
go-interopextension-building

More Build Tools packages