Skip to main content

Setuptools Gopy extension plugin

Project description

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"]
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

Acknowledgements

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

setuptools_gopy-0.0.4.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

setuptools_gopy-0.0.4-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file setuptools_gopy-0.0.4.tar.gz.

File metadata

  • Download URL: setuptools_gopy-0.0.4.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for setuptools_gopy-0.0.4.tar.gz
Algorithm Hash digest
SHA256 659c42e7b74fcf9b1e15ec51bd0c22e4b5f43022d0f30699438fe9ec32291e28
MD5 0cb94a6e54c38fc33a8dd3f00b7f8eae
BLAKE2b-256 e2c237eab9f0759ecdf2a900dff8f64289ac661e785d66eac926cb36eef759aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for setuptools_gopy-0.0.4.tar.gz:

Publisher: pypi.yaml on LouisBrunner/setuptools-gopy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file setuptools_gopy-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for setuptools_gopy-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ad7267859d865a33b9ac00f100768c22643c55d280bc23b37b4ee26bc54dbcbc
MD5 d377f58e94f4d4773a856393f560bc89
BLAKE2b-256 9f2c01f0a32f82de3e39825b938fdc39b05d87225a3341493c8295e76a48bc48

See more details on using hashes here.

Provenance

The following attestation bundles were made for setuptools_gopy-0.0.4-py3-none-any.whl:

Publisher: pypi.yaml on LouisBrunner/setuptools-gopy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page