mirror of
https://github.com/vinta/awesome-python.git
synced 2026-11-10 01:34:28 -06:00
Merge branch 'audit-basedpyright'
This commit is contained in:
@@ -669,6 +669,7 @@ _Tools for static analysis, linters and code quality checkers. Also see [awesome
|
||||
- [mypy](https://github.com/python/mypy) - A static type checker for Python.
|
||||
- [ty](https://github.com/astral-sh/ty) - An extremely fast Python type checker and language server.
|
||||
- [pyright](https://github.com/microsoft/pyright) - Full-featured static type checker for Python from Microsoft, the engine behind Pylance.
|
||||
- [basedpyright](https://github.com/DetachHead/basedpyright) - A pyright fork with stricter defaults and Pylance features in its language server.
|
||||
- [pyrefly](https://github.com/meta/pyrefly) - A fast type checker and language server for Python.
|
||||
|
||||
### Testing
|
||||
|
||||
@@ -14,7 +14,7 @@ How to choose:
|
||||
- Refactoring: Rope from your editor or a script, ast-grep for pattern rewrites
|
||||
- Type checking Django or Pydantic code: mypy with its plugins, Pyrefly without
|
||||
- Adding types to a partly typed codebase: ty
|
||||
- Type checking in VS Code: Pyright, which Pylance runs on
|
||||
- Type checking in your editor: Pyright in VS Code via Pylance, basedpyright in other editors
|
||||
|
||||
Ruff [can replace Flake8, Black, and isort](https://docs.astral.sh/ruff/), plus dozens of Flake8 plugins. Its docs suggest you [start with a small rule set](https://docs.astral.sh/ruff/linter/#rule-selection), add one group at a time, and list them explicitly in `select`. Ruff is [a linter, not a type checker](https://docs.astral.sh/ruff/faq/#how-does-ruff-compare-to-ty-mypy-pyright-or-pyre), so run a type checker alongside it.
|
||||
|
||||
@@ -48,4 +48,6 @@ ty is a type checker and language server [designed for adoption](https://docs.as
|
||||
|
||||
Pyright [checks all code by default](https://github.com/microsoft/pyright/blob/main/docs/mypy-comparison.md#type-checking-unannotated-code), annotated or not, which its language server features rely on. In VS Code, its docs [recommend Pylance](https://github.com/microsoft/pyright/blob/main/docs/installation.md), which includes Pyright. Run it [in CI to keep the project type clean](https://github.com/microsoft/pyright/blob/main/docs/getting-started.md), then turn on `# pyright: strict` file by file.
|
||||
|
||||
basedpyright is a fork of Pyright that [re-implements some of Pylance's features](https://docs.basedpyright.com/latest/benefits-over-pyright/pylance-features/) in its language server, so you get them in any editor. It [turns on every rule by default](https://docs.basedpyright.com/latest/benefits-over-pyright/better-defaults/). On an existing project, run `basedpyright --writebaseline` and commit the file it writes, so it [reports errors only in new or changed code](https://docs.basedpyright.com/latest/benefits-over-pyright/baseline/).
|
||||
|
||||
Pylint, Prospector, Import Linter, and ty all need to see your project's dependencies, so run them [from the project's own environment](https://pylint.readthedocs.io/en/latest/user_guide/installation/pre-commit-integration.html), not a separate one. For more Python code analysis tools, see [awesome-static-analysis](https://github.com/analysis-tools-dev/static-analysis).
|
||||
|
||||
Reference in New Issue
Block a user