Skip to content

PythonBlock

A Python block component that can be used to render a block of Python code.

import { PythonBlock } from "@alloy-js/python";
<PythonBlock opener="string">
{children}
</PythonBlock>
childrenChildren
openeroptional string
<PythonBlock opener="def my_function()">
  <VariableDeclaration name="x" type="int" />
  <VariableDeclaration name="y" type="str" />
</PythonBlock>

renders to

def my_function():
  x: int = None
  y: str = None