vyper-lsp


Namevyper-lsp JSON
Version 0.0.9 PyPI version JSON
download
home_page
SummaryLanguage server for Vyper, a pythonic smart contract language
upload_time2023-12-09 02:28:14
maintainer
docs_urlNone
authorz80
requires_python>=3.10,<3.12
licenseMIT
keywords vyper lsp vyper-lsp
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Vyper LSP Server

## Requirements

Vyper LSP requires a minimum vyper version of 0.3.7. For full support, it is also required that the Vyper version installed in your virtual environment is capable of compiling your contract.

For example, a vyper contract with `#pragma version 0.3.8` cannot be compiled with `0.3.10`, so you must install `vyper==0.3.8` if you want full support while working with this contract.

A contract with `#pragma version >=0.3.8` will work fine with any installed vyper version greater than the requirement, so you can get full support while editing this contract if you have the latest vyper version installed.

## 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:

> TODO: publish on pypi

`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.

``` emacs-lisp
(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`

``` 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

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "vyper-lsp",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<3.12",
    "maintainer_email": "",
    "keywords": "vyper,lsp,vyper-lsp",
    "author": "z80",
    "author_email": "z80@ophy.xyz",
    "download_url": "https://files.pythonhosted.org/packages/87/e9/1f479d992c7be268b442e45cc556a923dd05cbaf2bee9f9600a793fbed44/vyper-lsp-0.0.9.tar.gz",
    "platform": null,
    "description": "# Vyper LSP Server\n\n## Requirements\n\nVyper LSP requires a minimum vyper version of 0.3.7. For full support, it is also required that the Vyper version installed in your virtual environment is capable of compiling your contract.\n\nFor example, a vyper contract with `#pragma version 0.3.8` cannot be compiled with `0.3.10`, so you must install `vyper==0.3.8` if you want full support while working with this contract.\n\nA contract with `#pragma version >=0.3.8` will work fine with any installed vyper version greater than the requirement, so you can get full support while editing this contract if you have the latest vyper version installed.\n\n## Install Vyper-LSP\n\n### via `pipx`\nI like `pipx` because it handles creating an isolated env for executables and putting them on your path.\n\n`pipx install git+https://github.com/vyperlang/vyper-lsp.git`\n\n### via `pip`\nYou can install using `pip` if you manage your environments through some other means:\n\n> TODO: publish on pypi\n\n`pip install git+https://github.com/vyperlang/vyper-lsp.git`\n\n## Verify installation\n\nCheck that `vyper-lsp` is on your path:\n\nIn your terminal, run `which vyper-lsp`. If installation was succesful, you should see the path to your installed executable.\n\n## Editor Setup\n\n### Emacs\n\nThe following emacs lisp snippet will create a Vyper mode derived from Python Mode, and sets up vyper-lsp.\n\n``` emacs-lisp\n(define-derived-mode vyper-mode python-mode \"Vyper\" \"Major mode for editing Vyper.\")\n\n(add-to-list 'auto-mode-alist '(\"\\\\.vy\\\\'\" . vyper-mode))\n\n(with-eval-after-load 'lsp-mode\n  (add-to-list 'lsp-language-id-configuration\n               '(vyper-mode . \"vyper\"))\n  (lsp-register-client\n   (make-lsp-client :new-connection\n                    (lsp-stdio-connection `(,(executable-find \"vyper-lsp\")))\n                    :activation-fn (lsp-activate-on \"vyper\")\n                    :server-id 'vyper-lsp)))\n```\n\n### Neovim\n\nAdd the following to your `neovim` lua config.\n\nIt should be at `~/.config/nvim/init.lua`\n\n``` lua\nvim.api.nvim_create_autocmd({ \"BufEnter\" }, {\n  pattern = { \"*.vy\" },\n  callback = function()\n    vim.lsp.start({\n      name = \"vyper-lsp\",\n      cmd = { \"vyper-lsp\" },\n      root_dir = vim.fs.dirname(vim.fs.find({ \".git\" }, { upward = true })[1])\n    })\n  end,\n})\n\nvim.api.nvim_create_autocmd({ \"BufEnter\" }, {\n  pattern = { \"*.vy\" },\n  callback = function()\n    vim.lsp.start({\n      name = \"vyper-lsp\",\n      cmd = { \"vyper-lsp\" },\n      root_dir = vim.fs.dirname(vim.fs.find({ \".git\" }, { upward = true })[1])\n    })\n  end,\n})\n\nvim.api.nvim_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', { noremap = true, silent = true })\nvim.api.nvim_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', { noremap = true, silent = true })\nvim.api.nvim_set_keymap('n', 'gr', '<Cmd>lua vim.lsp.buf.references()<CR>', { noremap = true, silent = true })\nvim.api.nvim_set_keymap('n', 'gi', '<Cmd>lua vim.lsp.buf.implementation()<CR>', { noremap = true, silent = true })\nvim.api.nvim_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', { noremap = true, silent = true })\nvim.api.nvim_set_keymap('n', '<C-k>', '<Cmd>lua vim.lsp.buf.signature_help()<CR>', { noremap = true, silent = true })\nvim.api.nvim_set_keymap('n', '[d', '<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', { noremap = true, silent = true })\nvim.api.nvim_set_keymap('n', ']d', '<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>', { noremap = true, silent = true })\n\n```\n\n\n### VS Code\n\nSee `vyper-lsp` VS Code extension\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Language server for Vyper, a pythonic smart contract language",
    "version": "0.0.9",
    "project_urls": null,
    "split_keywords": [
        "vyper",
        "lsp",
        "vyper-lsp"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7121119279947ba6ed1b8caeafc0087a59b3ed5464d76c210d7af001e7c44bd0",
                "md5": "8c75fe27df206edae42df522c2f8b81a",
                "sha256": "4aa701602b2dfa5fd4fbe7e0e0dd87894192f57a92e061778e03aacbdfa56665"
            },
            "downloads": -1,
            "filename": "vyper_lsp-0.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8c75fe27df206edae42df522c2f8b81a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<3.12",
            "size": 51823,
            "upload_time": "2023-12-09T02:28:16",
            "upload_time_iso_8601": "2023-12-09T02:28:16.299119Z",
            "url": "https://files.pythonhosted.org/packages/71/21/119279947ba6ed1b8caeafc0087a59b3ed5464d76c210d7af001e7c44bd0/vyper_lsp-0.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "87e91f479d992c7be268b442e45cc556a923dd05cbaf2bee9f9600a793fbed44",
                "md5": "a15cf0b29f573a2816ef0641e8a61810",
                "sha256": "b2f9f61df4746b173aaad00ab0d6380e9f3d1031cb9b5e258804d70bfbe9af9e"
            },
            "downloads": -1,
            "filename": "vyper-lsp-0.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "a15cf0b29f573a2816ef0641e8a61810",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<3.12",
            "size": 50856,
            "upload_time": "2023-12-09T02:28:14",
            "upload_time_iso_8601": "2023-12-09T02:28:14.651701Z",
            "url": "https://files.pythonhosted.org/packages/87/e9/1f479d992c7be268b442e45cc556a923dd05cbaf2bee9f9600a793fbed44/vyper-lsp-0.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-09 02:28:14",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "vyper-lsp"
}
        
z80
Elapsed time: 0.15319s