{"id":13578157,"url":"https://github.com/py2many/py2many","last_synced_at":"2025-05-15T01:04:11.125Z","repository":{"id":36966914,"uuid":"332357790","full_name":"py2many/py2many","owner":"py2many","description":"Transpiler of Python to many other languages","archived":false,"fork":false,"pushed_at":"2025-05-12T20:53:08.000Z","size":1977,"stargazers_count":933,"open_issues_count":120,"forks_count":60,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-05-15T01:03:02.402Z","etag":null,"topics":["ast","dart","dlang","golang","julia","kotlin","mojo","nim","python","rust","smt","transpiler","vlang","ziglang"],"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/py2many.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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,"zenodo":null}},"created_at":"2021-01-24T03:19:12.000Z","updated_at":"2025-05-14T19:39:27.000Z","dependencies_parsed_at":"2024-04-16T22:03:26.810Z","dependency_job_id":"b4db886d-d52e-412d-ab35-9dacb064e8ed","html_url":"https://github.com/py2many/py2many","commit_stats":{"total_commits":1033,"total_committers":18,"mean_commits":"57.388888888888886","dds":0.5759922555663117,"last_synced_commit":"24e839586affd521bba636671dca47fd4346ba72"},"previous_names":["adsharma/py2many"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py2many%2Fpy2many","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py2many%2Fpy2many/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py2many%2Fpy2many/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py2many%2Fpy2many/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/py2many","download_url":"https://codeload.github.com/py2many/py2many/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254254040,"owners_count":22039792,"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":["ast","dart","dlang","golang","julia","kotlin","mojo","nim","python","rust","smt","transpiler","vlang","ziglang"],"created_at":"2024-08-01T15:01:28.003Z","updated_at":"2025-05-15T01:04:11.082Z","avatar_url":"https://github.com/py2many.png","language":"Python","readme":"# py2many: Python to many CLike languages transpiler\n\n![Build](https://github.com/py2many/py2many/actions/workflows/fast.yaml/badge.svg)\n![License](https://img.shields.io/github/license/adsharma/py2many?color=brightgreen)\n\n## Why\n\nPython is popular, easy to program in, but has poor runtime\nperformance. We can fix that by transpiling a subset of the language\ninto a more performant, statically typed language.\n\nA second benefit is security. Writing security sensitive\ncode in a low level language like C is error prone and could\nlead to privilege escalation. Specialized languages such as\n[wuffs](https://github.com/google/wuffs) exist to address this use\ncase. py2many can be a more general purpose solution to the problem\nwhere you can verify the source via unit tests before you transpile.\n\nA third potential use case is to accelerate python code by transpiling\nit into an [extension](https://github.com/adsharma/py2many/issues/62)\n\nSwift and Kotlin dominate the mobile app development workflow. However, there is\nno one solution that works well for lower level libraries where there is desire\nto share code between platforms. Kotlin Mobile Multiplatform (KMM) is a player\nin this place, but it hasn't really caught on. py2many provides an alternative.\n\nLastly, it's a great educational tool to learn a new language by implementing\na backend for your favorite language.\n\n## Status\n\nRust is the language where the focus of development has been.\n\nC++14 is historically the first language to be supported.\nC++17 is now required for some features.\n\nPreliminary support exists for Julia, Kotlin, Nim, Go, Dart, V, and D.\n\npy2many can also emit Python 3 code that includes inferred type annotations,\nand revisions to the syntax intended to simplify parsing of the code.\n\n## History\n\nBased on Julian Konchunas' [pyrs](http://github.com/konchunas/pyrs).\n\nBased on Lukas Martinelli [Py14](https://github.com/lukasmartinelli/py14)\nand [Py14/python-3](https://github.com/ProgVal/py14/tree/python-3) branch by Valentin\nLorentz.\n\n## Example\n\nOriginal Python version.\n\n```python\ndef fib(i: int) -\u003e int:\n    if i == 0 or i == 1:\n        return 1\n    return fib(i - 1) + fib(i - 2)\n```\n\nTranspiled Rust code:\n\n```rust\nfn fib(i: i32) -\u003e i32 {\n    if i == 0 || i == 1 {\n        return 1;\n    }\n    return (fib((i - 1)) + fib((i - 2)));\n}\n```\n\nTranspiled code for other languages:\n\nhttps://github.com/adsharma/py2many/tree/main/tests/expected (fib*)\n\n## Trying it out\n\nRequirements:\n\n- Python 3.8+\n\nLocal installation:\n\n```sh\npip3 install --user  # installs to $HOME/.local\n```\n\nOR\n\n```sh\nsudo pip3 install  # installs systemwide\n```\n\nAdd the py2many script to your $PATH and run:\n\nTranspiling:\n\n```sh\npy2many --cpp=1 tests/cases/fib.py\npy2many --rust=1 tests/cases/fib.py\npy2many --julia=1 tests/cases/fib.py\npy2many --kotlin=1 tests/cases/fib.py\npy2many --nim=1 tests/cases/fib.py\npy2many --dart=1 tests/cases/fib.py\npy2many --go=1 tests/cases/fib.py\npy2many --dlang=1 tests/cases/fib.py\n```\n\nCompiling:\n\n```sh\nclang tests/expected/fib.cpp\n./scripts/rust-runner.sh run tests/expected/fib.rs\n...\ndmd -run tests/cases/fib.d\n```\n\nMany of the transpilers rely on a language specific formatter to parse the output and reformat it.\nTypically this is the most prominent formatter for the language, such as `rustfmt` for Rust.\n\nMost of the transpilers also rely on external libraries to provide bridges from\nPython constructs to the target language.\n\nThe steps to install these external libraries can be found in `.github/workflows/main.yml`.\n\n# Contributing\n\nSee [CONTRIBUTING.md](https://github.com/adsharma/py2many/blob/main/CONTRIBUTING.md)\nfor how to test your changes and contribute to this project.\n","funding_links":[],"categories":["Python","FFI Bindings"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpy2many%2Fpy2many","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpy2many%2Fpy2many","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpy2many%2Fpy2many/lists"}