Python
Elide can run Python applications under the Python 3 language standard; Elide behaves nearly identically to CPython.
elide ./script.py
def hello():
print("Elide can run Python!")
Language Engine
Elide can execute Python using GraalPython from Oracle.
Language | Python |
---|---|
Standard |
|
Maturity | |
Engine | |
Tools | uv (see Python Tooling) |
Python Interop
Developers can expose Python symbols (functions, classes, and values) to the polyglot context using the elide
built-in module:
from elide import bind, poly
@bind
def say_hello(name = "Python"):
"""Render a hello greeting to the specified name."""
return f"Hello, {name}!"
# use `poly` if you want to rename the symbol
# (it's shorthand for 'polyglot')
@poly(name = "goodbye")
def say_goodbye(name = "Python"):
"""Render a goodbye greeting to the specified name."""
return f"Goodbye, {name}!"
# you can return other functions and complex types!
@bind
def message(leaving = False):
"""Return a message renderer based on the user's disposition."""
if leaving:
return say_goodbye
return say_hello
Now, from TypeScript, for example:
import { message } from "./my-python.py"
console.log(JSON.stringify({hello: message()()}))
console.log(JSON.stringify({goodbye: message(true)()}))
elide ./my-index.ts
{"hello": "Hello, Python!"}
{"goodbye": "Goodbye, Python!"}
Last modified: 15 March 2025