{"id":13906274,"url":"https://github.com/DataDog/go-python3","last_synced_at":"2025-07-18T04:30:39.800Z","repository":{"id":33869445,"uuid":"156261074","full_name":"DataDog/go-python3","owner":"DataDog","description":"Go bindings to the CPython-3 API","archived":true,"fork":false,"pushed_at":"2021-11-02T16:03:07.000Z","size":84,"stargazers_count":376,"open_issues_count":14,"forks_count":139,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-08-07T23:47:32.029Z","etag":null,"topics":["bindings","go","golang","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DataDog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-05T18:05:32.000Z","updated_at":"2024-07-30T02:08:32.000Z","dependencies_parsed_at":"2022-07-28T21:08:53.654Z","dependency_job_id":null,"html_url":"https://github.com/DataDog/go-python3","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fgo-python3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fgo-python3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fgo-python3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fgo-python3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DataDog","download_url":"https://codeload.github.com/DataDog/go-python3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226344594,"owners_count":17610173,"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":["bindings","go","golang","python","python3"],"created_at":"2024-08-06T23:01:32.496Z","updated_at":"2024-11-25T14:31:13.593Z","avatar_url":"https://github.com/DataDog.png","language":"Go","readme":"**This repo will be archived on December 1st 2021. While still readable it will no longer be maintained.** There's a community maintained successor of this project at https://github.com/go-python/cpy3 .\n\n# go-python3\n\n**Currently supports python-3.7 only.**\n\nGolang bindings for the C-API of CPython-3.\n\nThis package provides a ``go`` package named \"python\" under which most of the\n``PyXYZ`` functions and macros of the public C-API of CPython have been\nexposed. Theoretically, you should be able use https://docs.python.org/3/c-api\nand know what to type in your ``go`` program.\n\n\nThis project was inspired by https://github.com/sbinet/go-python. Go and take a look if we need something for python-2.7!\n\n# Install\n\n## Deps\n\nWe will need `pkg-config` and a working `python3.7` environment to build these\nbindings. Make sure you have Python libraries and header files installed as\nwell (`python3.7-dev` on Debian or `python3-devel` on Centos for example)..\n\nBy default `pkg-config` will look at the `python3` library so if you want to\nchoose a specific version just symlink `python-X.Y.pc` to `python3.pc` or use\nthe `PKG_CONFIG_PATH` environment variable.\n\n## Go get\n\nThen simply `go get github.com/DataDog/go-python3`\n\n# API\n\nSome functions mix go code and call to Python function. Those functions will\nreturn and `int` and `error` type. The `int` represent the Python result code\nand the `error` represent any issue from the Go layer.\n\nExample:\n\n`func PyRun_AnyFile(filename string)` open `filename` and then call CPython API\nfunction `int PyRun_AnyFile(FILE *fp, const char *filename)`.\n\nTherefore its signature is `func PyRun_AnyFile(filename string) (int, error)`,\nthe `int` represent the error code from the CPython `PyRun_AnyFile` function\nand error will be set if we failed to open `filename`.\n\nIf an error is raise before calling th CPython function `int` default to `-1`.\n\nTake a look at some [examples](examples)\n","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDataDog%2Fgo-python3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDataDog%2Fgo-python3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDataDog%2Fgo-python3/lists"}