1
0
mirror of https://github.com/jbranchaud/til synced 2026-07-13 02:16:09 +00:00

Add BasedPyright Will Use Pyright Config as a Python TIL

This commit is contained in:
jbranchaud
2026-07-12 13:08:10 -05:00
parent b7af4da998
commit b520d6525b
2 changed files with 28 additions and 1 deletions
+2 -1
View File
@@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/).
For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter). For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter).
_1817 TILs and counting..._ _1818 TILs and counting..._
See some of the other learning resources I work on: See some of the other learning resources I work on:
@@ -1067,6 +1067,7 @@ If you've learned something here, support my efforts writing daily TILs by
- [Argument Defaults Are Evaluated When Function Is Defined](python/argument-defaults-are-evaluated-when-function-is-defined.md) - [Argument Defaults Are Evaluated When Function Is Defined](python/argument-defaults-are-evaluated-when-function-is-defined.md)
- [Assert Is Only A Development Check](python/assert-is-only-a-development-check.md) - [Assert Is Only A Development Check](python/assert-is-only-a-development-check.md)
- [Avoid Modification With Frozen Dataclass](python/avoid-modification-with-frozen-dataclass.md) - [Avoid Modification With Frozen Dataclass](python/avoid-modification-with-frozen-dataclass.md)
- [BasedPyright Will Use Pyright Config](python/basedpyright-will-use-pyright-config.md)
- [Break Debugger On First Line Of Program](python/break-debugger-on-first-line-of-program.md) - [Break Debugger On First Line Of Program](python/break-debugger-on-first-line-of-program.md)
- [Check If Package Is Installed With Pip](python/check-if-package-is-installed-with-pip.md) - [Check If Package Is Installed With Pip](python/check-if-package-is-installed-with-pip.md)
- [Check Precondition Before Click Arg Parsing](python/check-precondition-before-click-arg-parsing.md) - [Check Precondition Before Click Arg Parsing](python/check-precondition-before-click-arg-parsing.md)
@@ -0,0 +1,26 @@
# BasedPyright Will Use Pyright Config
I was transitioning my [`py-vmt` project](https://github.com/jbranchaud/py-vmt)
from `pyright` to `basedpyright` for Python type checking. That's because Zed
uses `basedpyright` by default and `pyright` doesn't work in Cursor, whereas
`basedpyright` does. I wanted to unify around one set of type check tooling.
I swapped out `pyright` for `basedpyright` in my dev dependencies, updated what
was being called in my `Taskfile.yml`, and GitHub workflow action.
What I didn't have to change, though, was the `tool.pyright` config heading in
my `pyproject.toml`. For aesthetics I could have changed it to
`tool.basedpyright`. However, `basedpyright` knows to look for either config, so
I can leave that one as is.
```toml
[tool.pyright]
include = ["src", "tests"]
typeCheckingMode = "basic"
```
If I introduce a `pyrightconfig.json` file to the project, which is also
supported by `basedpyright`, it will take precedence over the settings in
`pyproject.toml`.
[source](https://docs.basedpyright.com/v1.24.0/configuration/config-files/)