Skip to content

Commit 890e844

Browse files
committed
Moving typechecks under 'Execute Docker Build' step
1 parent 2267761 commit 890e844

File tree

4 files changed

+35
-35
lines changed

4 files changed

+35
-35
lines changed

.github/workflows/python.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,6 @@ jobs:
127127
source ci/scripts/util_enable_core_dumps.sh
128128
archery docker run ${{ matrix.image }}
129129
130-
- name: Run Archery typechecking
131-
run: archery docker run ${{ matrix.image }} /arrow/dev/run_typechecking.sh
132-
133-
- name: Test that PyArrow is present
134-
run: archery docker run ${{ matrix.image }} /arrow/ci/scripts/python_test.sh /arrow
135-
136130
- name: Docker Push
137131
if: >-
138132
success() &&
@@ -145,17 +139,6 @@ jobs:
145139
continue-on-error: true
146140
run: archery docker push ${{ matrix.image }}
147141

148-
# - name: Type check with mypy and pyright
149-
# run: |-
150-
# python -m pip install mypy pyright ty griffe libcst pytest hypothesis fsspec scipy-stubs pandas-stubs types-python-dateutil types-psutil types-requests griffe libcst sphinx types-cffi
151-
# pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple pyarrow
152-
# cd python
153-
# mypy
154-
# pyright
155-
# ty check
156-
# cd ..
157-
# python ./dev/update_stub_docstrings.py -f ./python/pyarrow-stubs
158-
159142
macos:
160143
name: ${{ matrix.architecture }} macOS ${{ matrix.macos-version }} Python 3
161144
runs-on: macos-${{ matrix.macos-version }}

dev/run_typechecking.sh renamed to ci/scripts/python_test_type_annotations.sh

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,26 @@
1919

2020
set -ex
2121

22-
# Install library stubs
23-
pip install pandas-stubs scipy-stubs sphinx types-cffi types-psutil types-requests types-python-dateutil
22+
if [ "${PYARROW_TEST_ANNOTATIONS}" == "ON" ]; then
2423

25-
# Install type checkers
26-
pip install mypy pyright ty
24+
pyarrow_dir=${1}
2725

28-
# TODO: pandas shouldn't be necessary, fix the stubs
29-
# Install other dependencies
30-
pip install pandas psutil
26+
# Install library stubs
27+
pip install pandas-stubs scipy-stubs sphinx types-cffi types-psutil types-requests types-python-dateutil
3128

32-
# Run type checkers
33-
cd /arrow/python
34-
mypy
35-
pyright
36-
ty check
29+
# Install type checkers
30+
pip install mypy pyright ty
31+
32+
# TODO: pandas shouldn't be necessary, fix the stubs
33+
# Install other dependencies
34+
pip install pandas psutil
35+
36+
# Run type checkers
37+
pushd "${pyarrow_dir}"
38+
mypy
39+
pyright
40+
ty check;
41+
42+
else
43+
echo "Skipping type annotation tests";
44+
fi

compose.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -935,12 +935,14 @@ services:
935935
environment:
936936
<<: [*common, *ccache, *sccache]
937937
PYTEST_ARGS: # inherit
938+
PYARROW_TEST_ANNOTATIONS: "ON"
938939
volumes: *conda-volumes
939940
command: &python-conda-command
940941
["
941942
/arrow/ci/scripts/cpp_build.sh /arrow /build &&
942943
/arrow/ci/scripts/python_build.sh /arrow /build &&
943-
/arrow/ci/scripts/python_test.sh /arrow"]
944+
/arrow/ci/scripts/python_test.sh /arrow &&
945+
/arrow/ci/scripts/python_test_type_annotations.sh /arrow/python"]
944946

945947
conda-python-emscripten:
946948
# Usage:
@@ -1015,14 +1017,16 @@ services:
10151017
ARROW_S3: "OFF"
10161018
ARROW_SUBSTRAIT: "OFF"
10171019
ARROW_WITH_OPENTELEMETRY: "OFF"
1020+
PYARROW_TEST_ANNOTATIONS: "ON"
10181021
SETUPTOOLS_SCM_PRETEND_VERSION:
10191022
volumes: *ubuntu-volumes
10201023
deploy: *cuda-deploy
10211024
command: &python-command >
10221025
/bin/bash -c "
10231026
/arrow/ci/scripts/cpp_build.sh /arrow /build &&
10241027
/arrow/ci/scripts/python_build.sh /arrow /build &&
1025-
/arrow/ci/scripts/python_test.sh /arrow"
1028+
/arrow/ci/scripts/python_test.sh /arrow &&
1029+
/arrow/ci/scripts/python_test_type_annotations.sh /arrow/python"
10261030

10271031
debian-python:
10281032
# Usage:
@@ -1510,6 +1514,7 @@ services:
15101514
python: ${PYTHON}
15111515
shm_size: *shm-size
15121516
environment:
1517+
PYARROW_TEST_ANNOTATIONS: "ON"
15131518
<<: [*common, *ccache, *sccache]
15141519
PARQUET_REQUIRE_ENCRYPTION: # inherit
15151520
HYPOTHESIS_PROFILE: # inherit
@@ -1520,7 +1525,8 @@ services:
15201525
/arrow/ci/scripts/cpp_build.sh /arrow /build &&
15211526
/arrow/ci/scripts/python_build.sh /arrow /build &&
15221527
mamba uninstall -y numpy &&
1523-
/arrow/ci/scripts/python_test.sh /arrow"]
1528+
/arrow/ci/scripts/python_test.sh /arrow &&
1529+
/arrow/ci/scripts/python_test_type_annotations.sh /arrow/python"]
15241530

15251531
conda-python-docs:
15261532
# Usage:
@@ -1540,13 +1546,15 @@ services:
15401546
BUILD_DOCS_CPP: "ON"
15411547
BUILD_DOCS_PYTHON: "ON"
15421548
PYTEST_ARGS: "--doctest-modules --doctest-cython"
1549+
PYARROW_TEST_ANNOTATIONS: "ON"
15431550
volumes: *conda-volumes
15441551
command:
15451552
["/arrow/ci/scripts/cpp_build.sh /arrow /build &&
15461553
/arrow/ci/scripts/python_build.sh /arrow /build &&
15471554
pip install -e /arrow/dev/archery[numpydoc] &&
15481555
archery numpydoc --allow-rule GL10,PR01,PR03,PR04,PR05,PR10,RT03,YD01 &&
1549-
/arrow/ci/scripts/python_test.sh /arrow"]
1556+
/arrow/ci/scripts/python_test.sh /arrow &&
1557+
/arrow/ci/scripts/python_test_type_annotations.sh /arrow/python"]
15501558

15511559
conda-python-dask:
15521560
# Possible $DASK parameters:

python/pyarrow/tests/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,9 @@ def get_modified_env_with_pythonpath():
170170
env = os.environ.copy()
171171
existing_pythonpath = env.get('PYTHONPATH', '')
172172

173-
module_path = os.path.abspath(
174-
os.path.dirname(os.path.dirname(pa.__file__)))
173+
module_path = os.path.abspath(os.path.dirname(os.path.dirname(
174+
pa.__file__ # type: ignore[no-matching-overload]
175+
)))
175176

176177
if existing_pythonpath:
177178
new_pythonpath = os.pathsep.join((module_path, existing_pythonpath))

0 commit comments

Comments
 (0)