Parso: A Python Parser

0.8.6 · active · verified Sat Mar 28

Parso is a Python parser that supports error recovery and round-trip parsing for different Python versions. It is currently at version 0.8.6, released on February 9, 2026, and follows a regular release cadence with updates approximately every 6 months.

Warnings

Install

Imports

Quickstart

This example demonstrates how to parse a simple Python function definition and call using Parso.

import parso

code = 'def greet(name):\n    return f"Hello, {name}!"\n\ngreet('World')'

# Parse the code
module = parso.parse(code, version='3.9')

# Access the root node
root_node = module.get_root_node()

# Print the parsed code
print(root_node.get_code())

view raw JSON →