pre-commit never installs from the repository under test as it makes caching intractable (it only uses the contents of the configuration and installs in such a way that your repository is intentionally inaccessible)
requiring repository-local state usually indicates it isn't a good fit for the framework and you may be trying to do too much
that said, you can hack around this by using language: system / repo: local -- but these are the unsupported escape hatch where setting up the "correct state" for your tools is on the burden of your users rather than the framework
disclaimer: I wrote pre-commit
Answer from anthony sottile on Stack Overflow
» pip install pyright
pre-commit-config adding local dependencies - Stack Overflow
Add an official pre-commit hook
I don't like mypy, and pyright (i like) does not integrate with project.toml
python - Pyright not detect current pyenv environment - Stack Overflow
Videos
pre-commit never installs from the repository under test as it makes caching intractable (it only uses the contents of the configuration and installs in such a way that your repository is intentionally inaccessible)
requiring repository-local state usually indicates it isn't a good fit for the framework and you may be trying to do too much
that said, you can hack around this by using language: system / repo: local -- but these are the unsupported escape hatch where setting up the "correct state" for your tools is on the burden of your users rather than the framework
disclaimer: I wrote pre-commit
In order to resolve pyright issues for my pre-commit hooks, I added this in my pre-commit-config.yml :
- repo: local
hooks:
- id: install-local-package
name: Install Local Package
entry: pip install path/to/package
language: system
pass_filenames: false
always_run: true
What do you recommend?
Why I don't like mypy? because it does not do type inference in multiple cases, whereas pyright is just fantastic at that.
Just getting started with pre-commit and I think it's awesome. Looking to find out what other code automation tools people are using. Let me know what works for you and why. Thanks!