-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-32609: [CI] Add type checking infrastructure and CI workflow for type annotations #48618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
30017ff
28fba3a
5858f47
59ce2dd
0de99a0
c327d26
090185e
5c13084
ee72560
19b54bc
c23cb9c
491ff2c
ba07ac8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| @rem Licensed to the Apache Software Foundation (ASF) under one | ||
| @rem or more contributor license agreements. See the NOTICE file | ||
| @rem distributed with this work for additional information | ||
| @rem regarding copyright ownership. The ASF licenses this file | ||
| @rem to you under the Apache License, Version 2.0 (the | ||
| @rem "License"); you may not use this file except in compliance | ||
| @rem with the License. You may obtain a copy of the License at | ||
| @rem | ||
| @rem http://www.apache.org/licenses/LICENSE-2.0 | ||
| @rem | ||
| @rem Unless required by applicable law or agreed to in writing, | ||
| @rem software distributed under the License is distributed on an | ||
| @rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| @rem KIND, either express or implied. See the License for the | ||
| @rem specific language governing permissions and limitations | ||
| @rem under the License. | ||
|
|
||
| @echo on | ||
|
|
||
| set PYARROW_DIR=%1 | ||
|
|
||
| if "%PYARROW_TEST_ANNOTATIONS%"=="ON" ( | ||
| echo Annotation testing on Windows ... | ||
|
|
||
| @REM Install library stubs. Note some libraries contain their own type hints so they need to be installed. | ||
| %PYTHON_CMD% -m pip install fsspec pandas-stubs scipy-stubs types-cffi types-psutil types-requests types-python-dateutil || exit /B 1 | ||
|
|
||
| @REM Install type checkers | ||
| %PYTHON_CMD% -m pip install mypy pyright ty || exit /B 1 | ||
|
|
||
| @REM Run type checkers | ||
| pushd %PYARROW_DIR% | ||
|
|
||
| mypy || exit /B 1 | ||
| pyright || exit /B 1 | ||
| ty check || exit /B 1 | ||
| popd | ||
| ) else ( | ||
| echo Annotation testing skipped on Windows ... | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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"; | ||
| fi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -919,12 +919,14 @@ services: | |
| environment: | ||
| <<: [*common, *ccache, *sccache] | ||
| PYTEST_ARGS: # inherit | ||
| PYARROW_TEST_ANNOTATIONS: "ON" | ||
| volumes: *conda-volumes | ||
| command: &python-conda-command | ||
| [" | ||
| /arrow/ci/scripts/cpp_build.sh /arrow /build && | ||
| /arrow/ci/scripts/python_build.sh /arrow /build && | ||
| /arrow/ci/scripts/python_test.sh /arrow"] | ||
| /arrow/ci/scripts/python_test.sh /arrow && | ||
| /arrow/ci/scripts/python_test_type_annotations.sh /arrow/python"] | ||
|
|
||
| conda-python-emscripten: | ||
| # Usage: | ||
|
|
@@ -1001,14 +1003,16 @@ services: | |
| ARROW_S3: "OFF" | ||
| ARROW_SUBSTRAIT: "OFF" | ||
| ARROW_WITH_OPENTELEMETRY: "OFF" | ||
| PYARROW_TEST_ANNOTATIONS: "ON" | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @raulcd do you think we actually want to be able to toggle these? I'm thinking we don't really need them
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think is worth it if instead of using a separate
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, agreed with your reasoning. I also introduced |
||
| SETUPTOOLS_SCM_PRETEND_VERSION: | ||
| volumes: *ubuntu-volumes | ||
| deploy: *cuda-deploy | ||
| command: &python-command > | ||
| /bin/bash -c " | ||
| /arrow/ci/scripts/cpp_build.sh /arrow /build && | ||
| /arrow/ci/scripts/python_build.sh /arrow /build && | ||
| /arrow/ci/scripts/python_test.sh /arrow" | ||
| /arrow/ci/scripts/python_test.sh /arrow && | ||
| /arrow/ci/scripts/python_test_type_annotations.sh /arrow/python" | ||
|
|
||
| debian-python: | ||
| # Usage: | ||
|
|
@@ -1500,6 +1504,7 @@ services: | |
| python: ${PYTHON} | ||
| shm_size: *shm-size | ||
| environment: | ||
| PYARROW_TEST_ANNOTATIONS: "ON" | ||
| <<: [*common, *ccache, *sccache] | ||
| PARQUET_REQUIRE_ENCRYPTION: # inherit | ||
| HYPOTHESIS_PROFILE: # inherit | ||
|
|
@@ -1510,7 +1515,8 @@ services: | |
| /arrow/ci/scripts/cpp_build.sh /arrow /build && | ||
| /arrow/ci/scripts/python_build.sh /arrow /build && | ||
| mamba uninstall -y numpy && | ||
| /arrow/ci/scripts/python_test.sh /arrow"] | ||
| /arrow/ci/scripts/python_test.sh /arrow && | ||
| /arrow/ci/scripts/python_test_type_annotations.sh /arrow/python"] | ||
|
|
||
| conda-python-docs: | ||
| # Usage: | ||
|
|
@@ -1530,13 +1536,15 @@ services: | |
| BUILD_DOCS_CPP: "ON" | ||
| BUILD_DOCS_PYTHON: "ON" | ||
| PYTEST_ARGS: "--doctest-modules --doctest-cython" | ||
| PYARROW_TEST_ANNOTATIONS: "ON" | ||
| volumes: *conda-volumes | ||
| command: | ||
| ["/arrow/ci/scripts/cpp_build.sh /arrow /build && | ||
| /arrow/ci/scripts/python_build.sh /arrow /build && | ||
| pip install -e /arrow/dev/archery[numpydoc] && | ||
| archery numpydoc --allow-rule GL10,PR01,PR03,PR04,PR05,PR10,RT03,YD01 && | ||
| /arrow/ci/scripts/python_test.sh /arrow"] | ||
| /arrow/ci/scripts/python_test.sh /arrow && | ||
| /arrow/ci/scripts/python_test_type_annotations.sh /arrow/python"] | ||
|
|
||
| conda-python-dask: | ||
| # Possible $DASK parameters: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.