FutureStatement
A future statement that imports features from future.
Future statements are directives to the compiler that a particular module should be compiled using syntax or semantics from a future Python release. They must appear near the top of the module, after the module docstring (if any).
Use this in the futureImports prop of SourceFile to ensure proper placement.
import { FutureStatement } from "@alloy-js/python";
<FutureStatement feature="string" />import { FutureStatement } from "@alloy-js/python/stc";
FutureStatement({ feature: string }).children(children)| feature | stringThe name of the feature to import from future. |
Example
Section titled “Example”<SourceFile path="models.py" futureImports={<FutureStatement feature="annotations" />}> <ClassDeclaration name="User"> <PropertyDeclaration name="manager" type="User" /> </ClassDeclaration></SourceFile>renders to
from __future__ import annotations
class User: manager: User