Skip to content

jmelahman/go-bin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prebuilt Go Runtime

Deploy Status Go Latest Release PyPI

Overview

This package provides a prebuilt Go runtime for integrating Golang artifacts into Python projects.

Features

  • Automatic Go runtime download for multiple platforms
  • Cross-platform support (Windows, Linux, macOS)
  • Declarative integration with python build systems

Using the go binary

One potential use case for go-bin is to facilitate managing the go binary. Rather than managing multiple go installations, utilize tools such as uv to switch between environments.

Without needing anything other than uv, building a golang binary becomes as simple as,

uvx --from=go-bin go build ./...

Using go-bin for packaging

Whether you're building standalone go binaries or writing c-extensions in golang, this package allows a declarative and hermetic way to build golang source code.

Simply define a build dependency on go-bin,

[build-system]
requires = ["hatchling", "go-bin~=1.23.4"]
build-backend = "hatchling.build"

It is recommended to use compatible release versions (~=). Major, minor, and patch versions of go-bin will always correlate with Go versions while the latter digit is reserved for changes in packaging.

then use it in your build scripts as if it were your system's version of go. For an example, see github.com/jmelahman/connections.

Building the wheel locally

The build depends on a few environment variables to be set. For example, to build the v1.25.5 version for x64 Linux, run,

GITHUB_REF_NAME=v1.25.5 GOOS=linux GOARCH=amd64 uv build --wheel

About

Prebuilt golang binary

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages