Skip to content

ImportStatement

A Python import statement.

import { ImportStatement } from "@alloy-js/python";
<ImportStatement path="string" symbols={Set<ImportedSymbol>} />
pathstring
symbolsoptionalSet<[unresolved link]>

This component renders an import statement for a given path and symbols. If no symbols are provided, it will render a simple import statement. If symbols are provided, it will render an import statement with the specified symbols.

<ImportStatement path="os" />
<ImportStatement path="math" symbols={new Set([new ImportedSymbol("sqrt", "sqrt")])} />

This will generate:

import os
from math import sqrt