diff --git a/README.md b/README.md index 59b74d5..dec70db 100644 --- a/README.md +++ b/README.md @@ -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). -_1817 TILs and counting..._ +_1818 TILs and counting..._ 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) - [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) +- [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) - [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) diff --git a/python/basedpyright-will-use-pyright-config.md b/python/basedpyright-will-use-pyright-config.md new file mode 100644 index 0000000..02a9953 --- /dev/null +++ b/python/basedpyright-will-use-pyright-config.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/)