Skip to content

lexilla-py: Python bindings for Lexilla

CI PyPI License: MIT Python versions

Permissively-licensed Python bindings for Lexilla, the lexer library for Scintilla.

View on PyPI · View on GitHub

Status

See GitHub Issues for what's done and what's next, and the project board for the joint roadmap with pyside6-scintilla (issues and PRs from both repos are added to it automatically).

Installation

Install from PyPI:

pip install lexilla

Usage

from lexilla import Language, create_lexer
from lexilla.pyside6_scintilla import set_lexer
from pyside6_scintilla import ScintillaEdit

editor = ScintillaEdit()
lexer = create_lexer(Language.CPP)
assert lexer is not None
set_lexer(editor, lexer)

set_lexer() hands a created lexer to a pyside6-scintilla ScintillaEdit via SCI_SETILEXER, transferring ownership to it — see the lexilla_highlighting example for a complete example.

Why this exists

Lexilla creates the lexer objects (ILexer5) that a Scintilla editor widget attaches via SCI_SETILEXER — it's a separate, Qt-free C++ library from Scintilla itself since Scintilla 5.0. This project exposes that library directly to Python. In practice, pyside6-scintilla is its only consumer, wired up via the set_lexer() convenience function (see Usage above) rather than raw SCI_SETILEXER pointer plumbing; it's kept as a separate package so this binding's release cadence and vendored Lexilla version can track upstream Lexilla releases independently of pyside6-scintilla's own release cycle — see Project mission for the full background.

Development

See the Development section for the project's mission, how the vendored Lexilla source is verified against upstream, and (as they fill in) the bindings architecture and build instructions. See GitHub Issues for the ordered list of upcoming work. This repo has no examples of its own — see pyside6-scintilla's examples instead.