1.1.362 • Published 2 days ago

coc-pyright v1.1.362

Weekly downloads
3,188
License
MIT
Repository
github
Last release
2 days ago

coc-pyright

Pyright extension for coc.nvim, with additional features:

  • semanticTokens highlighting!
  • inlayHints supports
  • codeActions to add imports, ignore typing check, run tests and more
  • linting with bandit, flake8, mypy, ruff, prospector, pycodestyle, pydocstyle, pyflakes, pylama, pylint, pytype
  • formatting with ruff, yapf, black, autopep8, darker, blackd, pyink
  • testing with unittest or pytest, supports codeLens
  • sort imports with ruff, isort and pyright
  • extract method and variables with rope

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 or ruff
  • pyright.version: Show the currently used Pyright version
  • 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
  • pyright.fileTest: Run test for current test file
  • pyright.singleTest: Run test for single nearest test

Configurations

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

ConfigurationDescriptionDefault
pyright.enableEnable coc-pyright extensiontrue
python.analysis.autoImportCompletionsDetermines whether pyright offers auto-import completionstrue
python.analysis.autoSearchPathsAutomatically add common search paths like 'src'true
python.analysis.diagnosticModeAnalyzes and reports errors for open only or all files in workspaceopenFilesOnly
python.analysis.stubPathPath to directory containing custom type stub filestypings
python.analysis.typeshedPathsPaths to look for typeshed modules[]
python.analysis.diagnosticSeverityOverridesOverride the severity levels for individual diagnostics{}
python.analysis.typeCheckingModeDefines the default rule set for type checkingbasic
python.analysis.useLibraryCodeForTypesUse library implementations to extract type informationtrue
python.pythonPathPath to Pythonpython
python.venvPathPath to folder with a list of Virtual Environments""
python.formatting.providerProvider for formattingautopep8
python.formatting.blackPathCustom path to blackblack
python.formatting.blackArgsArguments passed to black[]
python.formatting.darkerPathCustom path to darkerdarker
python.formatting.darkerArgsArguments passed to darker[]
python.formatting.pyinkPathCustom path to pyinkpyink
python.formatting.pyinkArgsArguments passed to pyink[]
python.formatting.blackdPathCustom path to blackdblackd
python.formatting.blackdHTTPURLCustom blackd server url""
python.formatting.blackdHTTPHeadersCustom blackd request headers{}
python.formatting.yapfPathCustom path to yapfyapf
python.formatting.yapfArgsArguments passed to yapf[]
python.formatting.autopep8PathCustom path to autopep8autopep8
python.formatting.autopep8ArgsArguments passed to autopep8[]
python.linting.enabledWhether to lint Python files with external linterstrue
python.linting.flake8EnabledWhether to lint with flake8false
python.linting.banditEnabledWhether to lint with banditfalse
python.linting.mypyEnabledWhether to lint with mypyfalse
python.linting.ruffEnabledWhether to lint with rufffalse
python.linting.pytypeEnabledWhether to lint with pytypefalse
python.linting.pycodestyleEnabledWhether to lint with pycodestylefalse
python.linting.prospectorEnabledWhether to lint with prospectorfalse
python.linting.pydocstyleEnabledWhether to lint with pydocstylefalse
python.linting.pylamaEnabledWhether to lint with pylamafalse
python.linting.pylintEnabledWhether to lint with pylintfalse
python.linting.pyflakesEnabledWhether to lint with pyflakesfalse
python.sortImports.pathPath to isort script, default using inner version''
python.sortImports.argsArguments passed to isort[]
pyright.serverCustom pyright-langserver path''
pyright.disableCompletionDisables completion from Pyrightfalse
pyright.disableDiagnosticsDisable diagnostics from Pyrightfalse
pyright.disableDocumentationDisables hover documentation from Pyrightfalse
pyright.disableProgressNotificationsDisable the initialization and workdone progress notificationsfalse
pyright.completion.importSupportEnable python-import completion source supporttrue
pyright.completion.snippetSupportEnable completion snippets supporttrue
pyright.organizeimports.providerOrganize imports provider, pyright, ruff or isortpyright
pyright.inlayHints.functionReturnTypesEnable inlay hints for function return typestrue
pyright.inlayHints.variableTypesEnable inlay hints for variable typestrue
pyright.inlayHints.parameterTypesEnable inlay hints for parameter typestrue
pyright.testing.providerProvider for testing, supports unittest and pytestunittest
pyright.testing.unittestArgsArguments passed to unittest[]
pyright.testing.pytestArgsArguments passed to pytest[]

Additional configuration options can be found in package.json.

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 "$@"
  2. Make it executable: chmod +x $path

  3. Set python.pythonPath in your coc-settings.json: "python.pythonPath": "<PUT PATH HERE>"
  4. 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 built with create-coc-extension

1.1.362

2 days ago

1.1.360

19 days ago

1.1.355

2 months ago

1.1.351

3 months ago

1.1.348

4 months ago

1.1.347

4 months ago

1.1.345

4 months ago

1.1.342

5 months ago

1.1.339

5 months ago

1.1.331

7 months ago

1.1.330

7 months ago

1.1.337

6 months ago

1.1.336

6 months ago

1.1.335

6 months ago

1.1.334

6 months ago

1.1.333

7 months ago

1.1.332

7 months ago

1.1.320

9 months ago

1.1.325

9 months ago

1.1.316

11 months ago

1.1.315

11 months ago

1.1.310

12 months ago

1.1.305

1 year ago

1.1.304

1 year ago

1.1.307

1 year ago

1.1.303

1 year ago

1.1.301

1 year ago

1.1.298

1 year ago

1.1.296

1 year ago

1.1.295

1 year ago

1.1.293

1 year ago

1.1.292

1 year ago

1.1.291

1 year ago

1.1.284

1 year ago

1.1.283

1 year ago

1.1.282

1 year ago

1.1.280

1 year ago

1.1.275

2 years ago

1.1.272

2 years ago

1.1.271

2 years ago

1.1.270

2 years ago

1.1.265

2 years ago

1.1.262

2 years ago

1.1.260

2 years ago

1.1.269

2 years ago

1.1.268

2 years ago

1.1.267

2 years ago

1.1.266

2 years ago

1.1.255

2 years ago

1.1.253

2 years ago

1.1.252

2 years ago

1.1.251

2 years ago

1.1.250

2 years ago

1.1.243

2 years ago

1.1.229

2 years ago

1.1.228

2 years ago

1.1.232

2 years ago

1.1.231

2 years ago

1.1.235

2 years ago

1.1.219

2 years ago

1.1.220

2 years ago

1.1.223

2 years ago

1.1.208

2 years ago

1.1.210

2 years ago

1.1.215

2 years ago

1.1.191

2 years ago

1.1.194

2 years ago

1.1.206

2 years ago

1.1.185

3 years ago

1.1.189

2 years ago

1.1.190

2 years ago

1.1.181

3 years ago

1.1.180

3 years ago

1.1.177

3 years ago

1.1.176

3 years ago

1.1.172

3 years ago

1.1.171

3 years ago

1.1.170

3 years ago

1.1.168

3 years ago

1.1.166

3 years ago

1.1.164

3 years ago

1.1.163

3 years ago

1.1.162

3 years ago

1.1.161

3 years ago

1.1.159

3 years ago

1.1.158

3 years ago

1.1.157

3 years ago

1.1.156

3 years ago

1.1.155

3 years ago

1.1.154

3 years ago

1.1.152

3 years ago

1.1.150

3 years ago

1.1.144

3 years ago

1.1.143

3 years ago

1.1.148

3 years ago

1.1.146

3 years ago

1.1.141

3 years ago

1.1.140

3 years ago

1.1.133

3 years ago

1.1.139

3 years ago

1.1.137

3 years ago

1.1.136

3 years ago

1.1.135

3 years ago

1.1.134

3 years ago

1.1.129

3 years ago

1.1.128

3 years ago

1.1.127

3 years ago

1.1.126

3 years ago

1.1.125

3 years ago

1.1.123

3 years ago

1.1.122

3 years ago

1.1.120

3 years ago

1.1.118

3 years ago

1.1.117

3 years ago

1.1.116

3 years ago

1.1.115

3 years ago

1.1.114

3 years ago

1.1.113

3 years ago

1.1.112

3 years ago

1.1.109

3 years ago

1.1.108

3 years ago

1.1.106

3 years ago

1.1.105

3 years ago

1.1.104

3 years ago

1.1.103

3 years ago

1.1.101

3 years ago

1.1.100

3 years ago

1.1.98

3 years ago

1.1.97

3 years ago

1.1.96

3 years ago

1.1.95

3 years ago

1.1.94

3 years ago

1.1.91

3 years ago

1.1.89

3 years ago

1.1.87

3 years ago

1.1.86

3 years ago

1.1.85

4 years ago

1.1.84

4 years ago

1.1.83

4 years ago

1.1.82

4 years ago

1.1.81

4 years ago

1.1.80

4 years ago

1.1.79

4 years ago

1.1.78

4 years ago

1.1.75

4 years ago

1.1.71

4 years ago

1.1.68

4 years ago

1.1.66

4 years ago

1.1.65

4 years ago

1.1.64

4 years ago

1.1.63

4 years ago

1.1.62

4 years ago

1.1.61

4 years ago

1.1.60

4 years ago

1.1.59

4 years ago

1.1.58

4 years ago

1.1.57

4 years ago

1.1.56

4 years ago

1.1.55

4 years ago

1.1.54

4 years ago

1.1.53

4 years ago

1.1.52

4 years ago

1.1.51

4 years ago

1.1.50

4 years ago

1.1.49

4 years ago

1.1.48

4 years ago

1.1.47

4 years ago

1.1.46

4 years ago

1.1.45

4 years ago

1.1.44

4 years ago

1.1.43

4 years ago

1.1.42

4 years ago

1.1.41

4 years ago

1.1.40

4 years ago

1.1.39

4 years ago

1.1.37

4 years ago

1.1.36

4 years ago

1.1.35

4 years ago

1.1.34

4 years ago

1.1.33

4 years ago

1.1.32

4 years ago

1.1.31

4 years ago

1.1.30-1

4 years ago

1.1.30

4 years ago

1.1.29

4 years ago

1.1.28

4 years ago

1.1.27

4 years ago

1.1.26

4 years ago

1.1.25

4 years ago

1.1.24

4 years ago

1.1.23

4 years ago

1.1.22-1

4 years ago

1.1.22

4 years ago

1.1.21

4 years ago

1.1.20

4 years ago

1.1.19

4 years ago

1.1.18

4 years ago

1.1.17

4 years ago

1.1.16

4 years ago

1.1.15-1

4 years ago

1.1.15

4 years ago

1.1.14

4 years ago

1.1.13

4 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.0.84

5 years ago

1.0.83

5 years ago

1.0.82

5 years ago

1.0.81

5 years ago

1.0.80

5 years ago

1.0.79

5 years ago

1.0.74

5 years ago

1.0.73

5 years ago

1.0.72

5 years ago

1.0.71

5 years ago

1.0.68

5 years ago

1.0.67

5 years ago

1.0.66

5 years ago

1.0.65

5 years ago

1.0.64

5 years ago

1.0.63

5 years ago

1.0.62

5 years ago

1.0.61

5 years ago

1.0.60

5 years ago

1.0.59

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago