Skip to content

A fast, lightweight bridge between Monaco Editor (or any LSP client) and Pyright, enabling full Python language intelligence — autocompletion, hover docs, diagnostics, and more — directly in the browser or desktop apps.

Notifications You must be signed in to change notification settings

jesse-ai/python-language-server

Repository files navigation

Pyright LSP WebSocket Bridge

A WebSocket bridge for the Pyright language server with a bundled Node.js runtime. This service provides Python language server capabilities (autocomplete, type checking, diagnostics, etc.) through a WebSocket interface, primarily used by the Jesse dashboard to provide IntelliSense features for Jesse strategies.

Overview

This repository delivers:

  • WebSocket Bridge - Translates WebSocket messages to Pyright LSP protocol
  • Bundled Runtime - Includes Node.js, eliminating system dependencies
  • Cross-Platform Support - Works on Linux, macOS, and Windows
  • Optimized Builds - ~70% size reduction with production-only dependencies

Technology Stack

  • TypeScript - Main language for the bridge implementation
  • Node.js - Runtime environment
  • Pyright - Microsoft's static type checker for Python
  • WebSocket (ws) - WebSocket communication
  • vscode-ws-jsonrpc - JSON-RPC over WebSocket
  • esbuild - Fast JavaScript bundler

Development

Setup

npm install

Running in Development Mode

npm start -- \
  --port 9011 \
  --bot-root /path/to/jesse-bot \
  --jesse-root /path/to/jesse

Command-Line Arguments

  • --port - WebSocket server port (required)
  • --bot-root - Absolute path to the Jesse bot root directory (required)
  • --jesse-root - Absolute path to the Jesse framework root directory (required)

Build

Single Platform (Linux x64)

./build.sh

Output: output/linux-x64.tar.gz (~34 MB)

All Platforms

./build-all.sh

Outputs:

  • linux-x64.tar.gz / linux-arm64.tar.gz
  • darwin-x64.tar.gz / darwin-arm64.tar.gz
  • win32-x64.zip

Deployment & Usage

Linux/macOS

# Extract the archive
tar -xzf linux-x64.tar.gz

# Run the server
cd linux-x64
./start.sh \
  --port 9011 \
  --bot-root /path/to/jesse-bot \
  --jesse-root /path/to/jesse

Windows

REM Extract win32-x64.zip

REM Run the server
cd win32-x64
start.bat --port 9011 --bot-root C:\path\to\jesse-bot --jesse-root C:\path\to\jesse

Configuration

The Pyright language server is configured via pyrightconfig.json. The bridge automatically deploys this configuration file to the bot root directory specified by --bot-root on startup. You can customize type checking behavior, Python version, include/exclude patterns, and more.

Features

  • ✅ Bundled Node.js runtime (no system dependencies)
  • ✅ Optimized build (~70% size reduction)
  • ✅ Cross-platform support (Linux, macOS, Windows)
  • ✅ Production-ready dependencies only
  • ✅ WebSocket-based communication
  • ✅ Full Pyright LSP capabilities

Architecture

The bridge acts as a middleware between WebSocket clients (like the Jesse dashboard) and the Pyright language server:

Client (Jesse Dashboard) <-> WebSocket <-> Bridge <-> Pyright LSP

Messages are translated between WebSocket and the Language Server Protocol, enabling Python IntelliSense features in web-based interfaces.

File Structure

  • index.ts - Entry point and CLI argument handling
  • pyright-bridge.ts - WebSocket bridge implementation
  • pyrightconfig.json - Pyright configuration
  • package.json - Node.js project configuration
  • build.sh - Build script for Linux x64
  • build-all.sh - Build script for all platforms
  • output/ - Build output directory (generated)

License

This project is part of the Jesse ecosystem.

About

A fast, lightweight bridge between Monaco Editor (or any LSP client) and Pyright, enabling full Python language intelligence — autocompletion, hover docs, diagnostics, and more — directly in the browser or desktop apps.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •