Pyright extension for coc.nvim

Overview

coc-pyright

GitHub Sponsors Patreon donate button PayPal donate button

Pyright extension for coc.nvim

1

Install

:CocInstall coc-pyright

Note: Pyright may not work as expected if can't detect project root correctly, check #521 and Using workspaceFolders in coc.nvim.

Commands

  • python.runLinting: Run linting
  • python.sortImports: Sort imports by isort
  • pyright.version: Show the currently used Pyright version in :messages
  • pyright.organizeimports: Organize imports by Pyright
  • pyright.restartserver: This command forces the type checker to discard all of its cached type information and restart analysis. It is useful in cases where new type stubs or libraries have been installed.
  • pyright.createtypestub: Creates Type Stubs with given module name, for example :CocCommand pyright.createtypestub numpy

Configurations

These configurations are used by coc-pyright, you need to set them in your coc-settings.json.

Configuration Description Default
pyright.enable Enable coc-pyright extension true
python.analysis.autoImportCompletions Determines whether pyright offers auto-import completions true
python.analysis.autoSearchPaths Automatically add common search paths like 'src' true
python.analysis.diagnosticMode Analyzes and reports errors for open only or all files in workspace openFilesOnly
python.analysis.stubPath Path to directory containing custom type stub files typings
python.analysis.typeshedPaths Paths to look for typeshed modules []
python.analysis.diagnosticSeverityOverrides Override the severity levels for individual diagnostics {}
python.analysis.typeCheckingMode Defines the default rule set for type checking basic
python.analysis.useLibraryCodeForTypes Use library implementations to extract type information true
python.pythonPath Path to Python python
python.venvPath Path to folder with a list of Virtual Environments ""
python.formatting.provider Provider for formatting autopep8
python.formatting.blackPath Custom path to black black
python.formatting.blackArgs Arguments passed to black []
python.formatting.blackdPath Custom path to blackd blackd
python.formatting.blackdHTTPURL Custom blackd server url ""
python.formatting.blackdHTTPHeaders Custom blackd request headers {}
python.formatting.yapfPath Custom path to yapf yapf
python.formatting.yapfArgs Arguments passed to yapf []
python.formatting.autopep8Path Custom path to autopep8 autopep8
python.formatting.autopep8Args Arguments passed to autopep8 []
python.linting.enabled Whether to lint Python files true
python.linting.flake8Enabled Whether to lint with flake8 false
python.linting.banditEnabled Whether to lint with bandit false
python.linting.mypyEnabled Whether to lint with mypy false
python.linting.pytypeEnabled Whether to lint with pytype false
python.linting.pycodestyleEnabled Whether to lint with pycodestyle false
python.linting.prospectorEnabled Whether to lint with prospector false
python.linting.pydocstyleEnabled Whether to lint with pydocstyleEnabled false
python.linting.pylamaEnabled Whether to lint with pylama false
python.linting.pylintEnabled Whether to lint with pylint false
python.sortImports.path Path to isort script, default using inner version ''
python.sortImports.args Arguments passed to isort []
pyright.server Custom pyright-langserver path ''
pyright.disableCompletion Disables completion from Pyright, left other LSP features work false
pyright.disableDiagnostics Disable diagnostics from Pyright false
pyright.completion.snippetSupport Enable completion snippets support true
pyright.organizeimports.provider Organize imports provider, pyright or isort pyright

pyrightconfig.json

Pyright supports pyrightconfig.json that provide granular control over settings.

Python typing and stub files

To provide best experience, Pyright requires packages to be type annotated and/or have stub files. The Python community is currently in a transition phase where package authors are actively looking to provide that. Meanwhile, stub files for well-known packages may also be obtained from 3rd party, for example:

Conda setup

  1. Create the following file:
#!/bin/bash
python "$@"
  1. Make it executable: chmod +x $path
  2. Add the following to your coc-settings.json:
"python.pythonPath": "<PUT PATH HERE>"
  1. Activate the environment before starting vim

This way python from your currently activated environment will be used

My Workflow with Pyright

  1. create venv in project: python3 -m venv .venv
  2. source .venv/bin/activate
  3. install modules with pip and work with Pyright
  4. deactivate

License

MIT


This extension is created by create-coc-extension

Owner
Heyward Fann
Heyward Fann
Plugin for mypy to support zope.interface

Plugin for mypy to support zope.interface The goal is to be able to make zope interfaces to be treated as types in mypy sense. Usage Install both mypy

Shoobx 36 Oct 29, 2022
Enforce the same configuration across multiple projects

Nitpick Flake8 plugin to enforce the same tool configuration (flake8, isort, mypy, Pylint...) across multiple Python projects. Useful if you maintain

Augusto W. Andreoli 315 Dec 25, 2022
Backport Python 3.8+ typing utils & add issubtype & more

typing-utils Backport Python3.8+ typing utils & issubtype & more Install API issubtype get_origin get_args get_type_hints Install pip install typi

10 Nov 09, 2022
It's not just a linter that annoys you!

README for Pylint - https://pylint.pycqa.org/ Professional support for pylint is available as part of the Tidelift Subscription. Tidelift gives softwa

Python Code Quality Authority 4.4k Jan 04, 2023
Custom Python linting through AST expressions

bellybutton bellybutton is a customizable, easy-to-configure linting engine for Python. What is this good for? Tools like pylint and flake8 provide, o

H. Chase Stevens 249 Dec 31, 2022
Pylint plugin for improving code analysis for when using Django

pylint-django About pylint-django is a Pylint plugin for improving code analysis when analysing code using Django. It is also used by the Prospector t

Python Code Quality Authority 544 Jan 06, 2023
A plugin for Flake8 that checks pandas code

pandas-vet pandas-vet is a plugin for flake8 that provides opinionated linting for pandas code. It began as a project during the PyCascades 2019 sprin

Jacob Deppen 146 Dec 28, 2022
Flake8 wrapper to make it nice, legacy-friendly, configurable.

THE PROJECT IS ARCHIVED Forks: https://github.com/orsinium/forks It's a Flake8 wrapper to make it cool. Lint md, rst, ipynb, and more. Shareable and r

Life4 232 Dec 16, 2022
mypy plugin for loguru

loguru-mypy A fancy plugin to boost up your logging with loguru mypy compatibility logoru-mypy should be compatible with mypy=0.770. Currently there

Tomasz Trębski 13 Nov 02, 2022
A simple program which checks Python source files for errors

Pyflakes A simple program which checks Python source files for errors. Pyflakes analyzes programs and detects various errors. It works by parsing the

Python Code Quality Authority 1.2k Dec 30, 2022
Utilities for pycharm code formatting (flake8 and black)

Pycharm External Tools Extentions to Pycharm code formatting tools. Currently supported are flake8 and black on a selected code block. Usage Flake8 [P

Haim Daniel 13 Nov 03, 2022
docstring style checker

pydocstyle - docstring style checker pydocstyle is a static analysis tool for checking compliance with Python docstring conventions. pydocstyle suppor

Python Code Quality Authority 982 Jan 03, 2023
coala provides a unified command-line interface for linting and fixing all your code, regardless of the programming languages you use.

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." ― John F. Woods coala provides a

coala development group 3.4k Dec 29, 2022
Pyright extension for coc.nvim

coc-pyright Pyright extension for coc.nvim Install :CocInstall coc-pyright Note: Pyright may not work as expected if can't detect project root correct

Heyward Fann 1.1k Jan 02, 2023
Code audit tool for python.

Pylama Code audit tool for Python and JavaScript. Pylama wraps these tools: pycodestyle (formerly pep8) © 2012-2013, Florent Xicluna; pydocstyle (form

Kirill Klenov 967 Jan 07, 2023
Simple Python style checker in one Python file

pycodestyle (formerly called pep8) - Python style guide checker pycodestyle is a tool to check your Python code against some of the style conventions

Python Code Quality Authority 4.7k Jan 01, 2023
OpenStack Hacking Style Checks. Mirror of code maintained at opendev.org.

Introduction hacking is a set of flake8 plugins that test and enforce the OpenStack StyleGuide Hacking pins its dependencies, as a new release of some

Mirrors of opendev.org/openstack 224 Jan 05, 2023
Tools for improving Python imports

imptools Tools for improving Python imports. Installation pip3 install imptools Overview Detailed docs import_path Import a module from any path on th

Danijar Hafner 7 Aug 07, 2022
Rust like Option and Result types in Python

Option Rust-like Option and Result types in Python, slotted and fully typed. An Option type represents an optional value, every Option is either Some

45 Dec 13, 2022
Flake8 plugin that checks import order against various Python Style Guides

flake8-import-order A flake8 and Pylama plugin that checks the ordering of your imports. It does not check anything else about the imports. Merely tha

Python Code Quality Authority 270 Nov 24, 2022