types-parsimonious
raw JSON → 0.11.0.20260408 verified Fri May 01 auth: no python
Typing stubs for parsimonious, providing type annotations for the parsimonious PEG parser library. Current version 0.11.0.20260408, updated regularly alongside typeshed.
pip install types-parsimonious Common errors
error Cannot find reference 'Grammar' in 'parsimonious.py' ↓
cause Direct import of Grammar from parsimonious module fails due to incorrect stub export.
fix
Use 'from parsimonious.grammar import Grammar' instead.
Warnings
gotcha The stubs are not perfect; some dynamic features of parsimonious may not be fully annotated. ↓
fix Use type: ignore where needed, or contribute improvements to typeshed.
Imports
- parsimonious wrong
import Grammar from parsimoniouscorrectimport parsimonious
Quickstart
import parsimonious
from parsimonious.grammar import Grammar
grammar = Grammar("greeting = 'Hello' name name = ~'[A-Za-z]+'")
tree = grammar.parse('Hello World')
print(tree)