skillfed

esprima

ECMAScript parsing infrastructure for multipurpose analysis in Python

esprima v4.0.1 484.4K downloads/30d#6,403 on PyPI267
Permissive license BSD License Abandoned released

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 esprima

uv

uv add esprima

poetry

poetry add esprima

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Topic :: Software Development :: Code GeneratorsTopic :: Software Development :: CompilersTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: General

Tags

javascript parser pythonecmascript ast generatorjs code tokenizerjavascript syntax treeecmascript 2017 parserjsx parser pythonjavascript lexical analysis
parserjavascriptast

More Python Modules packages