diff --git a/doc/source/development/contributing_codebase.rst b/doc/source/development/contributing_codebase.rst index 63554447f295e..c6b2cd10519ae 100644 --- a/doc/source/development/contributing_codebase.rst +++ b/doc/source/development/contributing_codebase.rst @@ -266,17 +266,21 @@ This module will ultimately house types for repeatedly used concepts like "path- Validating type hints ~~~~~~~~~~~~~~~~~~~~~ -pandas uses `mypy `_ and `pyright `_ to statically analyze the code base and type hints. After making any change you can ensure your type hints are correct by running +pandas uses `mypy `_ and `pyright `_ to statically analyze the code base and type hints. After making any change you can ensure your type hints are consistent by running .. code-block:: shell + pre-commit run --hook-stage manual --all-files mypy + pre-commit run --hook-stage manual --all-files pyright + pre-commit run --hook-stage manual --all-files pyright_reportGeneralTypeIssues # the following might fail if the installed pandas version does not correspond to your local git version - pre-commit run --hook-stage manual --all-files + pre-commit run --hook-stage manual --all-files stubtest - # if the above fails due to stubtest - SKIP=stubtest pre-commit run --hook-stage manual --all-files +in your python environment. -in your activated python environment. A recent version of ``numpy`` (>=1.22.0) is required for type validation. +.. warning:: + + * Please be aware that the above commands will use the current python environment. If your python packages are older/newer than those installed by the pandas CI, the above commands might fail. This is often the case when the ``mypy`` or ``numpy`` versions do not match. Please see :ref:`how to setup the python environment ` or select a `recently succeeded workflow `_, select the "Docstring validation, typing, and other manual pre-commit hooks" job, then click on "Set up Conda" and "Environment info" to see which versions the pandas CI installs. .. _contributing.ci: