esprima
ECMAScript parsing infrastructure for multipurpose analysis in Python
What it is and what it does
Esprima is a Python port of the original JavaScript ECMAScript parser, providing both tokenization (lexical analysis) and parsing (syntactic analysis) to generate abstract syntax trees conforming to the ESTree standard. It supports ECMAScript 2017 and includes experimental JSX support. The parser can optionally track node locations in the source code.
The package has no runtime dependencies and is a pure Python implementation. However, it is abandoned—the last release was in August 2018 and the last repository commit in March 2023—meaning no new features, bug fixes, or security updates will be issued. It was originally designed for Python 2.7 and Python 3.3–3.6, and its behavior on modern Python versions is untested.
Use it for:
- Build static analysis tools that inspect JavaScript code structure without executing it.
- Generate code transformations or refactoring scripts by manipulating the parsed AST.
- Implement linters or style checkers that need to understand JavaScript syntax.
- Extract metadata from JavaScript files (e.g., function names, variable declarations).
- Transpile or analyze React JSX syntax (experimental support).
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Esprima parses ECMAScript (JavaScript) source code into an abstract syntax tree, supporting tokenization and full syntactic analysis of JavaScript programs.
No. The package is abandoned with no maintenance since 2018 and untested on modern Python versions. If you need JavaScript parsing in Python, prefer an actively maintained alternative. Install only if you are maintaining legacy code that already depends on esprima and cannot migrate.
Install
esprima on PyPI
pip
pip install esprimauv
uv add esprimapoetry
poetry add esprimaInstalling esprima
Before you install
Installation requires a source build (high friction). The package is abandoned—last release was 2018-08-24 and last commit 2023-03-01—so expect no maintenance or security updates going forward.
License in practice
BSD License (permissive) allows commercial and private use with minimal restrictions, though you should retain license notices in derivative works.
Quickstart
pip install esprima
import esprima
program = 'const answer = 42'
tokens = esprima.tokenize(program)
ast = esprima.parseScript(program)
Classifiers indicate Python 2.7 and Python 3.3–3.6 support; compatibility with modern Python versions (3.8+) is unspecified and untested.
Verify before relying
- Whether the package works reliably on Python versions newer than 3.6, given no recent maintenance.
- Whether JSX support is production-ready or experimental only.
- Current state of the Python port relative to the original JavaScript Esprima—feature parity and bug-fix status.
Package facts
| License | BSD License (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,912 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 484,449/month — #6,403 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: esprima-4.0.1.tar.gz
Keywords: esprima, ecmascript, javascript, parser, ast
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
esprima2Parses and tokenizes JavaScript code up to ECMA…
permissive · top 15,000 on PyPI
pyjsparserParses JavaScript source code into an abstract…
permissive · top 15,000 on PyPI
tree-sitter-javascriptProvides a JavaScript and JSX parser grammar…
permissive · top 5,000 on PyPI
Js2Py-3.13Js2Py translates and executes JavaScript code…
permissive · top 15,000 on PyPI
Js2PyJs2Py translates and executes JavaScript code…
permissive · top 5,000 on PyPI
tree-sitter-typescriptProvides TypeScript and TSX language grammars…
permissive · top 5,000 on PyPI
quickjs-rsExecutes JavaScript code inside a WebAssembly…
permissive · top 15,000 on PyPI
regressProvides Python bindings to the Rust regress…
permissive · top 5,000 on PyPI
luaparserParses Lua source code into an abstract syntax…
permissive · top 15,000 on PyPI
gastProvides a unified Abstract Syntax Tree…
permissive · top 5,000 on PyPI