Registry / devops / esprima2

esprima2

JSON →
library6.0.0pypypi✓ verified 81d ago

A high-performance JavaScript parser, tokenizer, and lexical analyzer with a focus on speed and correctness. Version 6.0.0 runs on Python >=3.10, ported from the esprima JavaScript library. Regular releases with active maintenance.

pip install esprima2
INSTALL
IMPORT
SIG · ESPRIMA2
E
esprima2
devopspythonv6.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parseScript
from esprima import parseScript
from esprima2 import parseScript
parseModule
from esprima import parseModule
parse
from esprima import parse

Parse JavaScript source into AST and tokenize it.

import esprima2 code = '''function foo(x) { if (x > 10) { return x * 2; } return x + 1; }''' ast = esprima2.parseScript(code) print(ast.body[0].id.name) # foo tokens = esprima2.tokenize(code) print(tokens)
Debug
Known issues
breakingparse() is removed; use parseScript() or parseModule() instead.
fix
Replace esprima2.parse(code) with esprima2.parseScript(code) for scripts, or esprima2.parseModule(code) for modules.
affects: >=6.0.0
breakingPython 3.9 support dropped; requires Python >=3.10.
fix
Upgrade Python to 3.10 or higher.
affects: >=6.0.0
deprecatedThe 'comment' option in parse() is deprecated; use the 'comments' option.
fix
Use comments=True instead of comment=True.
affects: >=5.x
Upgrade
Version history
6.0.0latest on PyPI · released Apr 22, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
esprima2 — pip install esprima2 · libregistry