@codemirror/lang-python

Python language support for the CodeMirror code editor, with highlighting, indentation, and autocompletion.

Library
npm
v6.2.1
42 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
24 /100 Needs Attention
Development Activity 4
Maintenance 0
Community 20
Maturity 60
Momentum 12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
82 /100 Excellent
Architecture 85
Code Quality 82
Innovation 80
Learning Curve 80

@codemirror/lang-python adds first-class Python editing to CodeMirror 6. It wraps the Lezer Python parser in a CodeMirror LanguageSupport, layering on syntax highlighting, context-aware indentation for blocks and continuation lines, code folding, and completion sources for both built-in globals and locally defined names.

Dropping the python() extension into an EditorView gives you a Python-aware editing surface without hand-rolling tokenizers or indentation heuristics. It is one of the official CodeMirror language packages, sharing the same architecture and release conventions as the rest of the ecosystem.

What You Get

  • A ready-to-use python() LanguageSupport extension for CodeMirror 6.
  • Syntax highlighting driven by the Lezer Python grammar.
  • Context-aware indentation for blocks, brackets, and continuation lines, including match/case, else/elif, and except handling.
  • Autocompletion for Python built-in globals, keywords, and locally defined names.
  • Code folding for functions, classes, collections, and multiline strings.

Common Use Cases

  • Building an in-browser Python code editor or REPL front-end.
  • Adding a Python editing mode to a documentation site, notebook, or teaching tool.
  • Powering code cells in a low-code or data-science web application.

Under The Hood

Architecture — The package is a thin, well-factored integration layer over the Lezer Python parser. src/python.ts defines pythonLanguage as an LRLanguage that configures the imported Lezer parser with indentNodeProp and foldNodeProp metadata; helper functions innerBody and indentBody walk the syntax tree to resolve Python’s whitespace-significant indentation, handling block bodies, match/case, and deindenting keywords. The exported python() factory returns a LanguageSupport bundling the language with two autocomplete data providers wired from src/complete.ts.

Tech Stack — Written entirely in TypeScript (100% of the source), it depends on @lezer/python and @lezer/common for parsing plus @codemirror/language, @codemirror/autocomplete, and @codemirror/state for editor integration. It builds to dual ESM/CJS output via the @codemirror/buildhelper toolchain (cm-buildhelper), ships type definitions, and is marked sideEffects: false for tree-shaking.

Code Quality — The codebase is compact (~12KB of source across python.ts and complete.ts) and idiomatic for the CodeMirror ecosystem, using a NodeWeakMap cache and a declarative gatherCompletions table keyed by node type to collect scoped definitions. Public APIs carry doc comments. Testing is present via a test-indent.ts suite run with cm-runtests, focused on the indentation logic that is the trickiest part of the package.

API Design — The public surface is minimal and ergonomic: importing python() and adding it to an editor’s extensions is the entire happy path, matching the uniform convention shared across all official CodeMirror language packages. Lower-level exports (pythonLanguage, globalCompletion, localCompletionSource) let advanced users compose custom behavior. The README documents each export with linked type references, keeping boilerplate near zero.

Used by 26 apps in this directory

Rust
63%
MIT

PostgresML

AI Development · Databases

6,823

Run ML training and LLM inference natively inside PostgreSQL with GPU acceleration — no data movement required.

View details
51
Repo Health
76
Technical
64
Dependency
Built with
Rust 63%
JavaScript 11%
Updated 1 years ago
Go
64%
MIT

sandboxd

Developer Tools · Devops

971

Self-hosted engine for AI app-builder products: give every user an isolated sandbox, a built-in coding agent, and a live preview URL — one command, no Kubernetes.

View details
77
Repo Health
83
Technical
68
Dependency
Built with
Go 64%
TypeScript 25%
Updated 4 days ago
Python
79%
AGPL 3.0

Skyvern

AI Agents · Automation

23,257

Skyvern (YC S2023) automates browser-based workflows by pairing LLMs with computer vision, letting agents click, fill, and extract data on sites they've never seen, without brittle XPath selectors that break on every layout change.

View details
89
Repo Health
82
Technical
70
Dependency
Built with
Python 79%
TypeScript 19%
Updated yesterday
Python
100%
Other

Sourcebot

AI Code Assistants · Developer Tools · Search

4,005

A self-hosted, AI-powered code search engine that indexes every repo across GitHub, GitLab, Bitbucket, Gitea, Gerrit, and Azure DevOps, so both engineers and coding agents can search, browse, and ask questions about your codebase from one place.

View details
86
Repo Health
83
Technical
61
Dependency
Built with
Python 100%
Updated 3 days ago
TypeScript
85%
Apache 2.0

superset

AI Code Assistants · AI Development

15,503

Orchestrate an army of AI coding agents—Claude Code, Codex, Gemini CLI, and more—running simultaneously in isolated git worktrees from a single Electron desktop app.

View details
86
Repo Health
80
Technical
64
Dependency
Built with
TypeScript 85%
Updated yesterday
TypeScript
68%
AGPL 3.0

Tolaria

Note Taking

20,161

A free, open-source, local-first desktop app for managing markdown knowledge bases on macOS, Windows, and Linux — for second brains, company docs, or AI assistant memory and procedures.

View details
84
Repo Health
71
Technical
68
Dependency
Built with
TypeScript 68%
HTML 15%
Updated yesterday
HTML
68%
AGPL 3.0

ToolJet

AI Agents · Low Code Platforms · No Code Platforms

41,123

Open-source AI-native platform to build and deploy internal tools, workflows, and AI agents with a visual drag-and-drop builder and 80+ data source integrations.

View details
94
Repo Health
81
Technical
63
Dependency
Built with
HTML 68%
JavaScript 20%
Updated yesterday
Python
68%
AGPL 3.0

Tracecat

AI Agents · Automation · Security

3,860

Open-source agentic security automation platform that runs AI agents and durable workflows at scale with sandboxed execution.

View details
89
Repo Health
88
Technical
66
Dependency
Built with
Python 68%
TypeScript 30%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers