{"id":13712137,"url":"https://github.com/alxschwrz/codex_py2cpp","last_synced_at":"2025-05-06T21:33:19.166Z","repository":{"id":38403354,"uuid":"492536543","full_name":"alxschwrz/codex_py2cpp","owner":"alxschwrz","description":"Converts python code into c++ by using OpenAI CODEX.","archived":false,"fork":false,"pushed_at":"2024-07-10T07:39:55.000Z","size":32,"stargazers_count":490,"open_issues_count":0,"forks_count":46,"subscribers_count":15,"default_branch":"main","last_synced_at":"2024-08-03T23:24:05.612Z","etag":null,"topics":["ai","code-generation","codex","cpp","openai","python"],"latest_commit_sha":null,"homepage":"","language":"Python","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/alxschwrz.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":"2022-05-15T16:07:22.000Z","updated_at":"2024-07-22T13:56:35.000Z","dependencies_parsed_at":"2024-07-10T09:26:30.553Z","dependency_job_id":"d05cee5a-26ad-4960-bc1d-4adbf43dfe20","html_url":"https://github.com/alxschwrz/codex_py2cpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxschwrz%2Fcodex_py2cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxschwrz%2Fcodex_py2cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxschwrz%2Fcodex_py2cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxschwrz%2Fcodex_py2cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alxschwrz","download_url":"https://codeload.github.com/alxschwrz/codex_py2cpp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224535790,"owners_count":17327594,"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":["ai","code-generation","codex","cpp","openai","python"],"created_at":"2024-08-02T23:01:15.253Z","updated_at":"2024-11-13T22:31:18.120Z","avatar_url":"https://github.com/alxschwrz.png","language":"Python","readme":"\u003ch1 align=\"center\"\u003e🦾 codex_py2cpp 🤖 \u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    OpenAI Codex Python to C++ Code Generator\n\u003c/p\u003e\n\nYour Python Code is too slow? 🐌 \nYou want to speed it up but forgot how to code in C++? ⌨\nConvert your Python script to C++ Code using OpenAI Codex.\n\n## How it works\nReads a Python file and creates an input prompt which is then fed to OpenAI Codex to generate corresponding C++ code. The generated \ncode is getting compiled using g++ and if compilation is successful the executable is saved.\n\nTo generate your own files you need to get access to the Codex API (https://openai.com/blog/openai-codex/).\n## Installation\n```bash\ngit clone https://github.com/alxschwrz/codex_py2cpp.git\ncd codex_py2cpp\npip3 install -r requirements.txt\n```\n## Run example\nReads the file \"simpleScript.py\", and feeds the corresponding input prompt to OpenAI Codex. Compilable solutions \nare stored in the form of .cpp and .exe files.\n```\npython3 python2cppconverter.py\n```\n\nIf the generated C++ code got compiled, test it with\n```\n./simpleScript.exe\n```\nYou hopefully get the same output as when running\n```\npython3 simpleScript.py\n```\nCheck how much faster you are now ...\n```\ntime ./simpleScript.exe\ntime python3 simpleScript.py\n```\n\n### Example Code Generation:\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003cth\u003e[In]: Python Snippet\u003c/th\u003e\n\u003cth\u003e[Out]: How the CODEX conversion might look like\u003c/th\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n```python\ndef add_something(x, y):\n    print(\"casually adding some stuff together\")\n    z = x + y\n    return z\n\n\nif __name__ == \"__main__\":\n    print('Okay, lets go')\n    print(add_something(5, 2))\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n```cpp\n// C++ Code generated from Python Code: \n#include \u003ciostream\u003e\nusing namespace std;\n\nint add_something(int x, int y) {\n    cout \u003c\u003c \"casually adding some stuff together\" \u003c\u003c endl;\n    int z = x + y;\n    return z;\n}\n\nint main() {\n    cout \u003c\u003c \"Okay, lets go\" \u003c\u003c endl;\n    cout \u003c\u003c add_something(5, 2) \u003c\u003c endl;\n    return 0;\n}\n```\n\u003c/td\u003e\n\u003c/table\u003e\n\n\n\nPlease test your generated code before usage. This does not produce robust code conversions, but is intended to experiment with codex. [WIP]\n## Credits\n\nThis project is based on the OpenAI Codex project.\nInspired by https://github.com/tom-doerr\n\n\n","funding_links":[],"categories":["Demos","Python"],"sub_categories":["Code generation, manipulation \u0026 understanding"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falxschwrz%2Fcodex_py2cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falxschwrz%2Fcodex_py2cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falxschwrz%2Fcodex_py2cpp/lists"}