diff --git a/ci/scripts/python_test_type_annotations.sh b/ci/scripts/python_test_type_annotations.sh index 092bedf3f5ea..9c4ca3dd9731 100755 --- a/ci/scripts/python_test_type_annotations.sh +++ b/ci/scripts/python_test_type_annotations.sh @@ -29,10 +29,11 @@ fi pip install fsspec pandas-stubs scipy-stubs types-cffi types-psutil types-requests types-python-dateutil # Install type checkers -pip install mypy pyright ty +pip install mypy pyrefly pyright ty # Run type checkers cd "${pyarrow_dir}" mypy pyright --stats ty check --verbose --output-format concise +pyrefly check --summarize-errors diff --git a/docs/source/developers/python/development.rst b/docs/source/developers/python/development.rst index 91f98cab060b..a6fdf4d1c2f2 100644 --- a/docs/source/developers/python/development.rst +++ b/docs/source/developers/python/development.rst @@ -145,6 +145,17 @@ To run ty (note: currently only partially configured): $ cd arrow/python $ ty check +**pyrefly** + +To run pyrefly: + +.. code-block:: + + $ cd arrow/python + $ pyrefly check + +The pyrefly configuration is in the ``[tool.pyrefly]`` section of ``pyproject.toml``. + Maintaining Type Stubs ----------------------- diff --git a/python/pyproject.toml b/python/pyproject.toml index 68c1a807dd51..f98ed3fed899 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -137,6 +137,19 @@ exclude = [ stubPath = "pyarrow-stubs" typeCheckingMode = "basic" +# TODO: Enable type checking once stubs are merged +[tool.pyrefly] +project-includes = ["pyarrow-stubs"] +project-excludes = [ + "pyarrow", + "benchmarks", + "examples", + "scripts", + "build", +] +search-path = ["pyarrow-stubs"] +python-version = "3.11" + # TODO: Enable type checking once stubs are merged [tool.ty.environment] extra-paths = ["pyarrow-stubs"]