Setuptools plugin for Gopy extensions
setuptools-gopy is a plugin for setuptools to build Go Python extensions using gopy.
Usage
You can configure setuptools-gopy either through pyproject.toml or setup.py:
[build-system]
requires = ["setuptools", "setuptools-gopy >= 0.0.7"]
build-backend = "setuptools.build_meta"
[project]
name = "simple"
version = "0.0.1"
[tool.setuptools.packages]
find = { where = ["python"] }
[[tool.setuptools-gopy.ext-packages]]
# the name of the package to create (e.g. this will create hello.py, _hello.DYLIB_SUFFIX and go.py in the simple package)
name = "simple.hello"
# name of the package to build (as would be accessible through the go cli)
go_package = "github.com/LouisBrunner/setuptools-gopy/examples/simple"
# optional: select which version of Go to install (otherwise expects the system to have it installed)
go_version = "1.24.1"
from setuptools import find_packages, setup
from setuptools_gopy import GopyExtension
setup(
name="simple",
version="0.0.1",
packages=find_packages(where="python"),
package_dir={"": "python"},
gopy_extensions=[
GopyExtension(
# same as above
"simple.hello",
"github.com/LouisBrunner/setuptools-gopy/examples/simple",
go_version="1.24.1"
)
],
)
In either case, you need to provide a target: this is the name of the Go package which should be built.
Once built, you can import Go symbols like so:
from .hello import Hello
Note that the name of the file will match the Go package that you imported.
Examples
examples/simpleshows a simple example of calling a Go function from Python- Check
gopy-ha-proton-drivefor a real-life example
Acknowledgements
- This repository is heavily inspired by
setuptools-rust, thanks to them!
Metadata
Release files for setuptools-gopy 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| setuptools_gopy-0.0.9.tar.gz | 16.5 kB | With provenance | Details for setuptools_gopy-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| setuptools_gopy-0.0.9-py3-none-any.whl | Python 3 | none | any | Details for setuptools_gopy-0.0.9-py3-none-any.whl |
Total release size: 31.0 kB
Release files / setuptools_gopy-0.0.9.tar.gz
| Download URL | setuptools_gopy-0.0.9.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7f72320d752a9af4be4232972ee4667fb7037746136cd4efcada12d74e0bd94
|
|
BLAKE2b-256 checksum How to use checksums |
ec53a18c40038d6c24f955544d5018b18f1ca9aa4e16bdf540b52427589eff99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 23, 2025.
Transparency logRelease files / setuptools_gopy-0.0.9-py3-none-any.whl
| Download URL | setuptools_gopy-0.0.9-py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d64191c1059ebc8da8dd66630c335b19eeab7421fe845df975804a599e5bb46a
|
|
BLAKE2b-256 checksum How to use checksums |
48d75a5827d53ef88bff576b003757dc71d2ea27cc471f920a329e4b9d7290f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 23, 2025.
Transparency logSecurity for setuptools-gopy 0.0.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for setuptools_gopy-0.0.9.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 23, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.