At https://pandas.pydata.org/docs/dev/development/contributing_codebase.html#validating-type-hints we tell people to validate the types of their code by doing: pre-commit run --hook-stage manual --all-files
. The problem here is that this causes autotyping
and pylint
to run.
pylint
takes a long time, so we should tell people to skip it.
Worse is that autotyping
causes lots of files to change, so you end up with a bigger set of changed files.
I think we should modify the .pre-commit-config.yaml
to define a typing
stage that only runs pyright
and mypy
.
Even if we do that, I get a lot of typing errors on the code in main
from both type checkers. So that should be addressed as well.
Comment From: MarcoGorelli
Hey
Even if we do that, I get a lot of typing errors on the code in main from both type checkers. So that should be addressed as well.
CI is green - do you have the same version(s) of packages installed? I've sometimes had failures when I had, for example, a different numpy version
Comment From: twoertwein
I think we should modify the
.pre-commit-config.yaml
to define atyping
stage that only runspyright
andmypy
.
I think we can define only one manual stage (which started out to contain only mypy+pyright and then pylint+autotyping were moved there as well).
Could change the typing documentation to:
pre-commit run --hook-stage manual mypy
pre-commit run --hook-stage manual pyright
pre-commit run --hook-stage manual pyright_reportGeneralTypeIssues
Comment From: Dr-Irv
Could change the typing documentation to:
pre-commit run --hook-stage manual mypy pre-commit run --hook-stage manual pyright pre-commit run --hook-stage manual pyright_reportGeneralTypeIssues
Yes, and you have to add that you need to stage the changed files before doing the typing check.
Comment From: Dr-Irv
CI is green - do you have the same version(s) of packages installed? I've sometimes had failures when I had, for example, a different numpy version
So I had done mamba env update -f environment.yml
, but because pandas-dev
was activated, not all packages (including mypy
) were updated. So by deactivating the environment, then doing the mamba update
command, everything got properly updated.
Maybe we need to put something in the contributing docs about how to update the environment when you merge with upstream/main
.
Comment From: jayam30
Hey I want to start my contribution with this, could I be assigned this
Comment From: Dr-Irv
Hey I want to start my contribution with this, could I be assigned this
Thanks for the offer, but we have an active PR #51352 that has the required changes.