py-ast - v1.16.0
    Preparing search index...

    Function parseModule

    • Parse Python source code and return an AST.

      Parameters

      • source: string

        The Python source code to parse

      • Optionalfilename: string

        The filename (optional, defaults to '')

      Returns Module

      The parsed module's AST

      If source contains a syntax error

      import { parseModule } from "py-ast";

      const tree = parseModule("def f(): pass", "example.py");