How do I run Python code on ICP?

Are there any relevant documents for reference at present?

4 Likes

There arenโ€™t at the moment. Broadly, the canisters can run any language that compiles down to WebAssembly (wasm), and Python would need its interpreter bundled with it in the wasm module, there looks like being some progress on this though: GitHub - appcypher/awesome-wasm-langs: ๐Ÿ˜Ž A curated list of languages that compile directly to or have their VMs in WebAssembly

2 Likes

Thank you for your reply.

It might not be too far out there to create a canister that runs some Python: Using GitHub - RustPython/RustPython: A Python Interpreter written in Rust you can execute Python from Rust, and this compiles to Wasm. So someone could probably write a Python CDK based on that.

(I did some experiments last year, but got distracted.)

9 Likes

This would be AWESOME!!! Really hope official support for this is considered :pray:

1 Like

This exists now, Kybra is a Python CDK created by my company Demergent Labs: GitHub - demergent-labs/kybra: Python CDK for the Internet Computer

5 Likes