Vyper LSP Server
Requirements
Vyper LSP requires a minimum vyper version of 0.4.1. For full support, it is also required that the Vyper version installed in your virtual environment is capable of compiling your contract.
Development
Setting up Development Environment
-
Install uv (Fast Python package installer and resolver)
# Install with pip pip install uv # Or on macOS with Homebrew brew install uv
-
Clone the repository
git clone https://github.com/vyperlang/vyper-lsp.git cd vyper-lsp
-
Install dependencies
uv pip install -e .
-
Run tests
uv run pytest
Code Quality and Testing
- Run linting:
ruff check . - Format code:
ruff format . - Generate test coverage:
coverage run -m pytest && coverage report
Install Vyper-LSP
via pipx
I like pipx because it handles creating an isolated env for executables and putting them on your path.
pipx install git+https://github.com/vyperlang/vyper-lsp.git
via pip
You can install using pip if you manage your environments through some other means:
pip install git+https://github.com/vyperlang/vyper-lsp.git
Verify installation
Check that vyper-lsp is on your path:
In your terminal, run which vyper-lsp. If installation was succesful, you should see the path to your installed executable.
Editor Setup
Emacs
The following emacs lisp snippet will create a Vyper mode derived from Python Mode, and sets up vyper-lsp.
(define-derived-mode vyper-mode python-mode "Vyper" "Major mode for editing Vyper.")
(add-to-list 'auto-mode-alist '("\\.vy\\'" . vyper-mode))
(with-eval-after-load 'lsp-mode
(add-to-list 'lsp-language-id-configuration
'(vyper-mode . "vyper"))
(lsp-register-client
(make-lsp-client :new-connection
(lsp-stdio-connection `(,(executable-find "vyper-lsp")))
:activation-fn (lsp-activate-on "vyper")
:server-id 'vyper-lsp)))
Neovim
Add the following to your neovim lua config.
It should be at ~/.config/nvim/init.lua
vim.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = { "*.vy" },
callback = function()
vim.lsp.start({
name = "vyper-lsp",
cmd = { "vyper-lsp" },
root_dir = vim.fs.dirname(vim.fs.find({ ".git" }, { upward = true })[1])
})
end,
})
vim.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = { "*.vy" },
callback = function()
vim.lsp.start({
name = "vyper-lsp",
cmd = { "vyper-lsp" },
root_dir = vim.fs.dirname(vim.fs.find({ ".git" }, { upward = true })[1])
})
end,
})
vim.api.nvim_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', 'gr', '<Cmd>lua vim.lsp.buf.references()<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', 'gi', '<Cmd>lua vim.lsp.buf.implementation()<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<C-k>', '<Cmd>lua vim.lsp.buf.signature_help()<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '[d', '<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', ']d', '<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>', { noremap = true, silent = true })
VS Code
See vyper-lsp VS Code extension
Metadata
Release files for vyper-lsp 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| vyper_lsp-0.1.4.tar.gz | 52.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vyper_lsp-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 75.2 kB
Release files / vyper_lsp-0.1.4.tar.gz
| Download URL | vyper_lsp-0.1.4.tar.gz |
|---|---|
| Size | 52.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3337f9b2acfdf7030293aff5ccd9ae8ee8c3fe24f302e6773df56378b8d4159e
|
|
BLAKE2b-256 checksum How to use checksums |
118809732d3fc5a218db217befb0dcbcca80123bd1dad3f1634e6c49d28d5669
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.8
|
Release files / vyper_lsp-0.1.4-py3-none-any.whl
| Download URL | vyper_lsp-0.1.4-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec30be01ec35620157379d4bf28c71b7d604df0cac102b8d03d983f5a9789c8a
|
|
BLAKE2b-256 checksum How to use checksums |
270ecea94568a34cc90b3152b5d4719677aee2ccc562021cc8aca7bd927dfc3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.8
|
Security for vyper-lsp 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.