Skip to main content

Vyper Language Server

Project description

Couleuvre

A lightweight Language Server for Vyper. It parses Vyper modules, extracts symbols, and supports basic navigation such as go-to-definition (including across imports), works with any Vyper version, and doesn't require Vyper to be installed.

Features

Feature Status
Syntax Highlighting ❌ Planned
Go to Definition ✅ Supported
Go to Modules ✅ Supported
Document Symbols ✅ Supported
Workspace Symbols ❌ Planned
References ⚠️ Alpha
Hover Information ❌ Planned
Diagnostics (Errors/Warnings) ✅ Supported
Code Completion ⚠️ Alpha
Document Formatting ❌ Planned
  • Automatic environment handling:
    • If the current environment already has the requested vyper version, use it directly
    • Otherwise, spin up and cache a dedicated uv-managed venv with the required vyper version

Architecture

couleuvre/
├── server.py              # LSP server (pygls) - handles client requests
├── parser.py              # Module parsing entry point
├── ast/
│   ├── parser.py          # Vyper AST → internal AST conversion
│   ├── nodes.py           # AST node dataclasses
│   ├── visitor.py         # AST visitor for symbol extraction
│   ├── environment.py     # Vyper environment abstraction
│   └── vyper_wrapper.py   # uv-managed Vyper version handling
└── features/
    ├── symbol_table.py    # Unified symbol table with metadata
    ├── symbols.py         # Document symbols (outline view)
    ├── definition.py      # Go-to-definition logic
    ├── references.py      # Find-all-references logic
    ├── resolve.py         # Symbol resolution utilities
    ├── diagnostics.py     # Semantic analysis diagnostics
    └── completion.py      # Code completion (self., module.)

Requirements

Installation

uv sync

Usage

  • As an LSP server (from source):
uv run -m couleuvre

How Vyper version is selected

  • Contracts can specify the compiler version via a pragma in the source (e.g., #pragma version ^0.4.0).
  • If no version is found, a default can be provided by the server based on the workspace/other files, or a diagnostic error will be shown.

Environment handling

  • System Environment: If the running environment's vyper matches the contract's version, it is used directly. This allows for resolving imports by using the current environment's search paths (e.g., snekmate).
  • Couleuvre Environment: Otherwise, Couleuvre creates/uses a cached virtualenv (via uv) at ~/.couleuvre/venvs/<version>/ for that version and runs Vyper with that interpreter. In this case, external imports that depend on system paths are not resolved.

Your editor should connect to the server via stdio (pygls). Point your client configuration to the above command.

Testing

uv run pytest

Alternatives

  • The official Vyper Language Server (https://github.com/vyperlang/vyper-lsp) is more feature-complete but only supports Vyper >= 0.4.1 and requires Vyper to be installed in the environment.

Disclaimer

Couleuvre is in early development, use at your own risk. Couleuvre is not affiliated with the Vyper project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

couleuvre-0.0.2.tar.gz (31.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

couleuvre-0.0.2-py3-none-any.whl (40.8 kB view details)

Uploaded Python 3

File details

Details for the file couleuvre-0.0.2.tar.gz.

File metadata

  • Download URL: couleuvre-0.0.2.tar.gz
  • Upload date:
  • Size: 31.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.29

File hashes

Hashes for couleuvre-0.0.2.tar.gz
Algorithm Hash digest
SHA256 af774033027420992bb40b305f44d4a1d5c81c74ff1a7130254c326b1ee37cb4
MD5 01c6882f0c90f7e6a1f48b5ce3287a8e
BLAKE2b-256 2c383f7973067e89bdda6ae0008dbc32e80e4d28632f1293b35aa44e3900f0aa

See more details on using hashes here.

File details

Details for the file couleuvre-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: couleuvre-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 40.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.29

File hashes

Hashes for couleuvre-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ee7e595a08c15c64927abe852c3620e4165bafb64b943715d6e4413f54bd2b6b
MD5 2650bdca7344bd3ac373b015fcc99d5c
BLAKE2b-256 54f7f33e5907a7ec0bdd58014fadbe85476b086541fc929672f413aa0a35950c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page