Skip to content

Commit 6f2f175

Browse files
committed
Revert from pre-commit to ci/scripts/python_test_type_annotations.sh
1 parent 27a4a65 commit 6f2f175

3 files changed

Lines changed: 45 additions & 61 deletions

File tree

.pre-commit-config.yaml

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -188,66 +188,6 @@ repos:
188188
?^python/pyarrow/util\.py$|
189189
?^python/pyarrow/vendored/|
190190
)
191-
- repo: https://github.com/pre-commit/mirrors-mypy
192-
rev: v1.15.0
193-
hooks:
194-
- id: mypy
195-
alias: python
196-
name: Python (Stubs) Type Check (mypy)
197-
args:
198-
- "--config-file=python/pyproject.toml"
199-
- "python/pyarrow-stubs"
200-
files: >-
201-
^python/pyarrow-stubs/
202-
pass_filenames: false
203-
additional_dependencies:
204-
- fsspec
205-
- pandas-stubs
206-
- scipy-stubs
207-
- types-cffi
208-
- types-psutil
209-
- types-requests
210-
- types-python-dateutil
211-
- repo: https://github.com/RobertCraigie/pyright-python
212-
rev: v1.1.408
213-
hooks:
214-
- id: pyright
215-
alias: python
216-
name: Python (Stubs) Type Check (pyright)
217-
args:
218-
- "--project=python/pyproject.toml"
219-
files: >-
220-
^python/pyarrow-stubs/
221-
pass_filenames: false
222-
env:
223-
PYRIGHT_PYTHON_FORCE_VERSION: latest
224-
additional_dependencies:
225-
- fsspec
226-
- pandas-stubs
227-
- scipy-stubs
228-
- types-cffi
229-
- types-psutil
230-
- types-requests
231-
- types-python-dateutil
232-
- repo: local
233-
hooks:
234-
- id: ty
235-
alias: python
236-
name: Python (Stubs) Type Check (ty)
237-
language: python
238-
entry: ty check python/pyarrow-stubs
239-
files: >-
240-
^python/pyarrow-stubs/
241-
pass_filenames: false
242-
additional_dependencies:
243-
- ty
244-
- fsspec
245-
- pandas-stubs
246-
- scipy-stubs
247-
- types-cffi
248-
- types-psutil
249-
- types-requests
250-
- types-python-dateutil
251191
- repo: local
252192
hooks:
253193
- id: lintr
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
20+
set -ex
21+
pyarrow_dir=${1}
22+
23+
if [ "${PYARROW_TEST_ANNOTATIONS}" == "ON" ]; then
24+
if [ -n "${ARROW_PYTHON_VENV:-}" ]; then
25+
. "${ARROW_PYTHON_VENV}/bin/activate"
26+
fi
27+
28+
# Install library stubs. Note some libraries contain their own type hints so they need to be installed.
29+
pip install fsspec pandas-stubs scipy-stubs types-cffi types-psutil types-requests types-python-dateutil
30+
31+
# Install type checkers
32+
pip install mypy pyright ty
33+
34+
# Run type checkers
35+
pushd ${pyarrow_dir}
36+
mypy
37+
pyright
38+
ty check;
39+
popd
40+
else
41+
echo "Skipping type annotation tests";
42+
fi

compose.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1530,13 +1530,15 @@ services:
15301530
BUILD_DOCS_CPP: "ON"
15311531
BUILD_DOCS_PYTHON: "ON"
15321532
PYTEST_ARGS: "--doctest-modules --doctest-cython"
1533+
PYARROW_TEST_ANNOTATIONS: "ON"
15331534
volumes: *conda-volumes
15341535
command:
15351536
["/arrow/ci/scripts/cpp_build.sh /arrow /build &&
15361537
/arrow/ci/scripts/python_build.sh /arrow /build &&
15371538
pip install -e /arrow/dev/archery[numpydoc] &&
15381539
archery numpydoc --allow-rule GL10,PR01,PR03,PR04,PR05,PR10,RT03,YD01 &&
1539-
/arrow/ci/scripts/python_test.sh /arrow"]
1540+
/arrow/ci/scripts/python_test.sh /arrow &&
1541+
/arrow/ci/scripts/python_test_type_annotations.sh /arrow/python"]
15401542

15411543
conda-python-dask:
15421544
# Possible $DASK parameters:

0 commit comments

Comments
 (0)