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
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
Flashcards - A flash card application with 2 optional command line arguments

Flashcards A flash card application with 2 optional command line arguments impor

Özgür Yildirim 2 Jul 15, 2022
Check for python builtins being used as variables or parameters

Flake8 Builtins plugin Check for python builtins being used as variables or parameters. Imagine some code like this: def max_values(list, list2):

Gil Forcada Codinachs 98 Jan 08, 2023
A plugin for Flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle.

flake8-bugbear A plugin for Flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycode

Python Code Quality Authority 869 Dec 30, 2022
A plugin for Flake8 that provides specializations for type hinting stub files

flake8-pyi A plugin for Flake8 that provides specializations for type hinting stub files, especially interesting for linting typeshed. Functionality A

Łukasz Langa 58 Jan 04, 2023
Optional static typing for Python 3 and 2 (PEP 484)

Mypy: Optional Static Typing for Python Got a question? Join us on Gitter! We don't have a mailing list; but we are always happy to answer questions o

Python 14.4k Jan 08, 2023
A Pylint plugin to analyze Flask applications.

pylint-flask About pylint-flask is Pylint plugin for improving code analysis when editing code using Flask. Inspired by pylint-django. Problems pylint

Joe Schafer 62 Sep 18, 2022
Mylint - My really simple rendition of how a linter works.

mylint My really simple rendition of how a linter works. This original version was written for my AST article. Since then I've added tests and turned

Tushar Sadhwani 2 Dec 29, 2021
PEP-484 typing stubs for SQLAlchemy 1.4 and SQLAlchemy 2.0

SQLAlchemy 2 Stubs These are PEP-484 typing stubs for SQLAlchemy 1.4 and 2.0. They are released concurrently along with a Mypy extension which is desi

SQLAlchemy 139 Dec 30, 2022
Flake8 plugin to validate annotations complexity

flake8-annotations-complexity An extension for flake8 to report on too complex type annotations. Complex type annotations often means bad annotations

BestDoctor 41 Dec 28, 2022
:sparkles: Surface lint errors during code review

✨ Linty Fresh ✨ Keep your codebase sparkly clean with the power of LINT! Linty Fresh parses lint errors and report them back to GitHub as comments on

Lyft 183 Dec 18, 2022
Run isort, pyupgrade, mypy, pylint, flake8, and more on Jupyter Notebooks

Run isort, pyupgrade, mypy, pylint, flake8, mdformat, black, blacken-docs, and more on Jupyter Notebooks ✅ handles IPython magics robustly ✅ respects

663 Jan 08, 2023
A plugin for flake8 integrating Mypy.

flake8-mypy NOTE: THIS PROJECT IS DEAD It was created in early 2017 when Mypy performance was often insufficient for in-editor linting. The Flake8 plu

Łukasz Langa 103 Jun 23, 2022
Flake8 extension for checking quotes in python

Flake8 Extension to lint for quotes. Major update in 2.0.0 We automatically encourage avoiding escaping quotes as per PEP 8. To disable this, use --no

Zachary Heller 157 Dec 13, 2022
❄️ A flake8 plugin to help you write better list/set/dict comprehensions.

flake8-comprehensions A flake8 plugin that helps you write better list/set/dict comprehensions. Requirements Python 3.6 to 3.9 supported. Installation

Adam Johnson 398 Dec 23, 2022
Performant type-checking for python.

Pyre is a performant type checker for Python compliant with PEP 484. Pyre can analyze codebases with millions of lines of code incrementally – providi

Facebook 6.2k Jan 04, 2023
Flake8 plugin to find commented out or dead code

flake8-eradicate flake8 plugin to find commented out (or so called "dead") code. This is quite important for the project in a long run. Based on eradi

wemake.services 277 Dec 27, 2022
🦆 Better duck-typing with mypy-compatible extensions to Protocol

🦆 Quacks If it walks like a duck and it quacks like a duck, then it must be a duck Thanks to PEP544, Python now has protocols: a way to define duck t

Arie Bovenberg 9 Nov 14, 2022
Tool for automatically reordering python imports. Similar to isort but uses static analysis more.

reorder_python_imports Tool for automatically reordering python imports. Similar to isort but uses static analysis more. Installation pip install reor

Anthony Sottile 589 Dec 26, 2022
Flake8 Type Annotation Checking

flake8-annotations flake8-annotations is a plugin for Flake8 that detects the absence of PEP 3107-style function annotations and PEP 484-style type co

S. Co1 118 Jan 05, 2023