The python-language-server (pyright-lsp) repository is a WebSocket bridge for the Pyright language server with a bundled Node.js runtime. It 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.
- Provide a WebSocket bridge to Pyright language server
- Bundle Node.js runtime for standalone distribution
- Enable cross-platform Python language server capabilities
- Support Jesse dashboard with Python language features
- Deliver optimized, production-ready builds
- TypeScript - Main language for the bridge implementation
- Node.js - Runtime environment
- Pyright - Microsoft's static type checker for Python
- Ruff - Fast Python linter and formatter (bundled for formatting support)
- WebSocket (ws) - WebSocket communication
- vscode-ws-jsonrpc - JSON-RPC over WebSocket
- esbuild - Fast JavaScript bundler
- tsx - TypeScript execution for development
# Navigate to the project
cd /Users/salehmir/Codes/jesse/dev-jesse/python-language-server
# Install dependencies (if needed)
npm install
# Start the server in development mode
npm start -- --port 9011 --project-root /path/to/project --jesse-relative-path jesse_folder_name --bot-relative-path jesse-bot_folder_name# Build for Linux x64 with Ruff formatting support
npm run build:linux
# Build for macOS (Intel and Apple Silicon) with Ruff
npm run build:mac
# Build for Linux and macOS with Ruff
npm run build:all
# Or use the script directly for specific platforms
./build-with-ruff.sh linux:x64 darwin:arm64# Linux x64 only (Pyright only, no Ruff)
./build.sh
# All platforms (Pyright only, no Ruff)
./build-all.shbuild.sh- Build for Linux x64 only (no Ruff)build-all.sh- Build for all supported platforms (no Ruff)build-with-ruff.sh- Build with Ruff formatting support for Linux & macOS
With Ruff (recommended):
linux-x64.tar.gz(~46 MB) - Includes Ruff formatterdarwin-x64.tar.gz(~44 MB) - Intel Mac with Ruffdarwin-arm64.tar.gz(~44 MB) - Apple Silicon with Ruff
Without Ruff:
linux-x64.tar.gz(~34 MB) - Pyright only
- WebSocket Bridge - Translates WebSocket messages to Pyright LSP protocol
- Formatting Interception - Intercepts LSP formatting requests and handles them with Ruff
- Bundled Runtime - Includes Node.js (and Ruff if built with
build-with-ruff.sh) - Strategy Module Support - Automatically handles Jesse's strategy structure (
.pyfiles that are actually__init__.pymodules) - Production-only Dependencies - Optimized builds exclude dev dependencies
- Cross-Platform - All path handling uses Node.js
pathmodule for Windows/Linux/macOS compatibility
- Don't write comments for functions unless specifically asked
- Follow TypeScript best practices
- Use async/await for asynchronous operations
- Ensure proper error handling and logging
pyrightconfig.json- Pyright language server configuration- Command-line arguments:
--port- WebSocket server port (default: 9011)--project-root- Root directory of the Python project--jesse-relative-path- Relative path to Jesse framework folder--bot-relative-path- Relative path to Jesse bot folder
- Use
console.log()for debugging in TypeScript/JavaScript code - Check WebSocket connection status
- Monitor Pyright LSP communication messages
- Verify project-root and path configurations
- Edit
pyright-bridge.tsorindex.ts - Test in development mode with
npm start - Build for your platform with
./build.sh - Test the built package
- Implement the feature in TypeScript
- Test locally in development mode
- Build and verify the production bundle works
- Test cross-platform compatibility if needed
- Update
package.json - Run
npm install - Test in development mode
- Rebuild and verify production builds
After building, the output packages are ready for deployment:
Linux/macOS:
tar -xzf linux-x64.tar.gz
cd linux-x64
./start.sh --port 9011 --project-root /path/to/project --jesse-relative-path jesse_folder_name --bot-relative-path jesse-bot_folder_nameWindows:
REM Extract win32-x64.zip
cd win32-x64
start.bat --port 9011 --project-root C:\path\to\project --jesse-relative-path jesse_folder_name --bot-relative-path jesse-bot_folder_nameindex.ts- Entry pointpyright-bridge.ts- WebSocket bridge implementationpyrightconfig.json- Pyright configurationpackage.json- Node.js project configuration and dependenciesbuild.sh- Build script for Linux x64build-all.sh- Build script for all platformsoutput/- Build output directory (generated)