kou commented on code in PR #48618:
URL: https://github.com/apache/arrow/pull/48618#discussion_r2725025386


##########
ci/scripts/python_test_type_annotations.sh:
##########
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -ex
+pyarrow_dir=${1}
+
+if [ "${PYARROW_TEST_ANNOTATIONS}" == "ON" ]; then
+  if [ -n "${ARROW_PYTHON_VENV:-}" ]; then
+    . "${ARROW_PYTHON_VENV}/bin/activate"
+  fi
+
+  # Install library stubs. Note some libraries contain their own type hints so 
they need to be installed.
+  pip install fsspec pandas-stubs scipy-stubs types-cffi types-psutil 
types-requests types-python-dateutil
+
+  # Install type checkers
+  pip install mypy pyright ty
+
+  # Run type checkers
+  pushd ${pyarrow_dir}
+  mypy
+  pyright
+  ty check;

Review Comment:
   ```suggestion
     ty check
   ```



##########
ci/scripts/python_test_type_annotations.sh:
##########
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -ex
+pyarrow_dir=${1}
+
+if [ "${PYARROW_TEST_ANNOTATIONS}" == "ON" ]; then
+  if [ -n "${ARROW_PYTHON_VENV:-}" ]; then
+    . "${ARROW_PYTHON_VENV}/bin/activate"
+  fi
+
+  # Install library stubs. Note some libraries contain their own type hints so 
they need to be installed.
+  pip install fsspec pandas-stubs scipy-stubs types-cffi types-psutil 
types-requests types-python-dateutil
+
+  # Install type checkers
+  pip install mypy pyright ty
+
+  # Run type checkers
+  pushd ${pyarrow_dir}
+  mypy
+  pyright
+  ty check;
+  popd
+else
+  echo "Skipping type annotation tests";

Review Comment:
   ```suggestion
     echo "Skipping type annotation tests"
   ```



##########
ci/scripts/python_test_type_annotations.sh:
##########


Review Comment:
   Could you enable lint for this file?
   
   ```diff
   diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
   index c4c4f04188..fb46b2eda0 100644
   --- a/.pre-commit-config.yaml
   +++ b/.pre-commit-config.yaml
   @@ -337,6 +337,7 @@ repos:
              ?^ci/scripts/python_sdist_build\.sh$|
              ?^ci/scripts/python_sdist_test\.sh$|
              ?^ci/scripts/python_wheel_unix_test\.sh$|
   +          ?^ci/scripts/python_test_type_annotations\.sh$|
              ?^ci/scripts/r_build\.sh$|
              ?^ci/scripts/r_revdepcheck\.sh$|
              ?^ci/scripts/release_test\.sh$|
   @@ -379,6 +380,7 @@ repos:
            # TODO: Remove this when we fix all lint failures
            files: >-
              (
   +          ?^ci/scripts/python_test_type_annotations\.sh$|
              ?^dev/release/05-binary-upload\.sh$|
              ?^dev/release/binary-recover\.sh$|
              ?^dev/release/post-03-binary\.sh$|
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to