Skip to content

pre-commit hook

.pre-commit-config.yaml
repos:
    - repo: https://github.com/DetachHead/basedpyright-pre-commit-mirror
      rev: v1.13.0 # or whatever the latest version is at the time
      hooks:
          - id: basedpyright

should i use this?

we don't recommend pre-commit as there are better alternatives for most of its use cases. also its maintainer is notoriously very rude to users.

we will continue to support pre-commit, however there are alternative approaches you may want to consider depending on your use case.

checking your code before committing

we instead recommend integrating basedpyright with your IDE. doing so will show errors on your code as you write it, instead of waiting until you go to commit your changes.

running non-python tools in a python project

pre-commit can be useful when the tool does not have a pypi package, because it can automatically manage nodejs and install npm packages for you without you ever having to install nodejs yourself. basedpyright already solves this problem with pyright by bundling the npm package as a pypi package, so you don't need to use pre-commit.

running basedpyright in the CI

basedpyright already integrates well with CI by default when using the pypi package.