Skip to content

prek hook

.pre-commit-config.yaml
repos:
    - repo: https://github.com/DetachHead/basedpyright-prek-mirror
      rev: v1.31.5
      hooks:
          - id: basedpyright

prek vs pre-commit

prek is a drop-in replacement for pre-commit written in rust, and with much better support from its maintainer. we highly recommend using it instead of pre-commit.

should i use this?

there are alternative approaches to commit hooks 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

prek 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 prek.

running basedpyright in the CI

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