--- id: esprima2 version: "6.0.0" license: BSD-2-Clause license_treatment: permissive maintenance: active --- # esprima2 — high-performance javascript parser, tokenizer and lexical analyser License: permissive · Maintenance: active · Downloads: 262.9K/mo ## What it is and what it does esprima2 is a JavaScript parser written in Python that converts JavaScript source code into an abstract syntax tree (AST) or token stream. It supports syntax up to ECMA 2025 and is built on a faithful Python port of the original esprima library, extended with modern ECMAScript features that the upstream projects no longer maintain. The parser produces output in the ESTree standardized format, making it compatible with tools and libraries that expect that structure. You use it to analyze or manipulate JavaScript code from Python—tokenizing to extract individual language elements, or parsing to build a complete syntax tree for traversal, transformation, or code generation. It includes experimental JSX support and optional source location tracking. The package is backed by roughly 1500 unit tests and requires Python 3.10 or later. Use it for: - Static analysis of JavaScript code to detect patterns, security issues, or code quality problems. - Building a JavaScript-to-Python transpiler or code generator that needs to understand JS syntax. - Extracting metadata from JavaScript files (function names, imports, dependencies) for tooling. - Linting or formatting JavaScript code by walking and inspecting its AST. - Embedding JavaScript parsing in a Python application that processes user-supplied JS code. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses and tokenizes JavaScript code up to ECMA 2025 syntax, producing an ESTree-compatible abstract syntax tree or token stream for analysis and manipulation. Yes, if you need to parse modern JavaScript from Python. The package is actively maintained, has no dependencies, installs easily, carries a permissive license, and supports current ECMAScript syntax. It is relatively new (first release July 2025) but shows active development and reasonable test coverage. No known security vulnerabilities. The main caveat is that JSX support is marked experimental, so verify it meets your needs if you rely on that feature. ## Install pip install esprima2 uv add esprima2 poetry add esprima2 ## Installing esprima2 Before you install: Low friction: pure Python wheel with no runtime dependencies. Repository is active with a recent commit on 2026-04-22 and 71 stars; first release was 2025-07-29, so it is relatively new but under active maintenance. License in practice: BSD-2-Clause is permissive; you may use, modify, and distribute this package with minimal restrictions, provided you retain the license notice. Quickstart: pip install esprima2 import esprima program = 'const answer = 42' tokens = esprima.tokenize(program) ast = esprima.parseScript(program) Requires Python 3.10 or later. Verify before relying: - Whether JSX support is production-ready or remains experimental in practice. - Performance characteristics when parsing large or complex JavaScript files. - Completeness of ECMA 2025 syntax coverage beyond the stated feature claim. ## Package facts - License: BSD-2-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 262.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags javascript parser python, ecmascript ast generator, js tokenizer python, javascript syntax tree, ecma 2025 parser, javascript lexical analysis, ast from javascript code, javascript-parsing, ast-generation, code-analysis [View on SkillFed](https://skillfed.io/packages/esprima2) · [View on PyPI](https://pypi.org/project/esprima2/)