{"id":16032692,"url":"https://github.com/voutilad/gogopython","last_synced_at":"2025-07-13T07:40:04.348Z","repository":{"id":250372545,"uuid":"834242076","full_name":"voutilad/gogopython","owner":"voutilad","description":"Go bindings for creating and managing embedded Python interpreters.","archived":false,"fork":false,"pushed_at":"2024-08-28T14:19:18.000Z","size":256,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-30T00:33:04.259Z","etag":null,"topics":["cpython","ffi-bindings","go","python"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/voutilad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-26T18:31:43.000Z","updated_at":"2024-12-20T01:34:19.000Z","dependencies_parsed_at":"2024-08-12T20:05:19.018Z","dependency_job_id":"4f054b11-5ffa-4894-835b-22f1af18e6c0","html_url":"https://github.com/voutilad/gogopython","commit_stats":null,"previous_names":["voutilad/gogopython"],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voutilad%2Fgogopython","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voutilad%2Fgogopython/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voutilad%2Fgogopython/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voutilad%2Fgogopython/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voutilad","download_url":"https://codeload.github.com/voutilad/gogopython/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238117424,"owners_count":19419223,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpython","ffi-bindings","go","python"],"created_at":"2024-10-08T21:40:20.355Z","updated_at":"2025-02-10T13:11:41.723Z","avatar_url":"https://github.com/voutilad.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gogopython\n[![Build and Test](https://github.com/voutilad/gogopython/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/voutilad/gogopython/actions/workflows/build-and-test.yml)\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"./gogopython.jpg\" width=\"45%\" alt=\"A redpanda \u0026 a python sipping tea together as friends.\"\u003e\n\u003c/div\u003e\n\nPython, but in Go.\n\n```bash\nCGO_ENABLED=0 go build\n```\n\n\u003e Heads up: this currently requires Python 3.12. No if's, and's or but's.\n\n## Using\n\n`gogopython` merely exposes the Python C-Api, so you'll need to use it just \nlike you would without Go. For an example of spinning up a sub-interpreter,\nsee the example program in `cmd/main.go`.\n\n## Library Detection\n\nThe biggest pain is finding the Python dynamic library. On some Linux systems,\nit must be installed separately (Debian-based distros for sure).\n\n```bash\nsudo apt install libpython3.12\n```\n\n`gogopython` will try to find the library using `distutils` via the given\nPython binary. This may require installing `setuptools` via `pip`.\n\n## Quick command line test\n\nSimply run the example program via `go run example/example.go` or,\nif `python3` is not in your path, provide it as a command line\nargument. For example, using a virtual environment might look like:\n\n```\n# Create and activate virtual environment.\npython3 -m venv venv\n. venv/bin/activate\n\n# Install setuptools. This is used for library discovery.\npip install setuptools\n\n# We no longer need the virtual environment enabled.\ndeactivate\n\n# Run the test app.\ngo run example/example.go ./venv/bin/python3\n```\n\n\u003e Note: if on Linux, make sure you have `setuptools` installed.\n\n## Known Issues\n\n- Requires Python 3.12 as it uses sub-interpreters. Sorry, not sorry.\n\n- Linux requires a shim using the `ffi` Go module that uses `purego` \n  to leverage `libffi`, so on Linux `libffi` must be available. This\n  is all because some super old Python C API functions decide to\n  return a struct on the stack and `purego` only supports that on\n  macOS currently.\n\n- The Python API is super thread local storage oriented. Using it with\n  Go is a small nightmare. Gratuitous use of `runtime.LockOSThread()`\n  is required. `gogopython` does not enforce this behavior.\n\n- Not all of the C API is wrapped and is being wrapped incrementally\n  as needed.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoutilad%2Fgogopython","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoutilad%2Fgogopython","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoutilad%2Fgogopython/lists"}