Skip to content

Commit 89bafd2

Browse files
authored
DOC: run typing checks (#51352)
* DOC: run typing checks * update wording a bit * reference python setup * reference pandas CI * include url to workflows
1 parent a131266 commit 89bafd2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

doc/source/development/contributing_codebase.rst

+9-5
Original file line numberDiff line numberDiff line change
@@ -272,17 +272,21 @@ This module will ultimately house types for repeatedly used concepts like "path-
272272
Validating type hints
273273
~~~~~~~~~~~~~~~~~~~~~
274274

275-
pandas uses `mypy <http://mypy-lang.org>`_ and `pyright <https://github.com/microsoft/pyright>`_ to statically analyze the code base and type hints. After making any change you can ensure your type hints are correct by running
275+
pandas uses `mypy <http://mypy-lang.org>`_ and `pyright <https://github.com/microsoft/pyright>`_ to statically analyze the code base and type hints. After making any change you can ensure your type hints are consistent by running
276276

277277
.. code-block:: shell
278278
279+
pre-commit run --hook-stage manual --all-files mypy
280+
pre-commit run --hook-stage manual --all-files pyright
281+
pre-commit run --hook-stage manual --all-files pyright_reportGeneralTypeIssues
279282
# the following might fail if the installed pandas version does not correspond to your local git version
280-
pre-commit run --hook-stage manual --all-files
283+
pre-commit run --hook-stage manual --all-files stubtest
281284
282-
# if the above fails due to stubtest
283-
SKIP=stubtest pre-commit run --hook-stage manual --all-files
285+
in your python environment.
284286

285-
in your activated python environment. A recent version of ``numpy`` (>=1.22.0) is required for type validation.
287+
.. warning::
288+
289+
* 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 <contributing.mamba>` or select a `recently succeeded workflow <https://github.com/pandas-dev/pandas/actions/workflows/code-checks.yml?query=branch%3Amain+is%3Asuccess>`_, 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.
286290

287291
.. _contributing.ci:
288292

0 commit comments

Comments
 (0)