| # 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. |
| |
| name: test-python |
| |
| on: |
| push: |
| branches: |
| - main |
| pull_request: |
| branches: |
| - main |
| paths: |
| - '.github/workflows/python.yaml' |
| - 'src/nanoarrow/**' |
| - 'python/**' |
| |
| permissions: |
| contents: read |
| |
| jobs: |
| test-python: |
| |
| runs-on: ${{ matrix.os }} |
| strategy: |
| matrix: |
| os: [ubuntu-latest] |
| python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
| |
| steps: |
| - uses: actions/checkout@v7 |
| |
| - name: Set up Python ${{ matrix.python-version }} |
| uses: actions/setup-python@v6 |
| with: |
| python-version: ${{ matrix.python-version }} |
| cache: 'pip' |
| |
| - name: Install nanoarrow |
| run: | |
| pushd python |
| pip install .[test] |
| popd |
| pip list |
| |
| - name: Run tests |
| run: | |
| pytest python/tests -v -s |
| |
| - name: Check type stubs |
| if: success() && matrix.python-version == '3.13' |
| run: | |
| pip install mypy |
| cd src/nanoarrow |
| for mod in $(find . -name "*.pyx" | sed -e "s|./||" -e "s|.pyx||"); do |
| cat $mod |
| stubtest "nanoarrow.$mod" |
| done |
| |
| - name: Run doctests |
| if: success() && matrix.python-version == '3.13' |
| run: | |
| pytest --pyargs nanoarrow --doctest-modules |
| |
| # Make sure we can build a source distribution and install from it |
| python-install: |
| runs-on: ubuntu-latest |
| steps: |
| - uses: actions/checkout@v7 |
| - uses: actions/setup-python@v6 |
| with: |
| python-version: '3.x' |
| - name: Install packaging tools |
| run: | |
| pip install --upgrade pip |
| pip install build twine |
| |
| - name: Build |
| run: | |
| cd python |
| python -m build --sdist --wheel |
| |
| - name: Check install from sdist |
| run: | |
| pip install python/dist/nanoarrow-*.tar.gz |
| python -c "import nanoarrow; print(nanoarrow.__version__)" |
| pip uninstall --yes nanoarrow |
| |
| - name: Check install from wheel |
| run: | |
| pip install python/dist/nanoarrow-*.whl |
| python -c "import nanoarrow; print(nanoarrow.__version__)" |
| pip uninstall --yes nanoarrow |
| |
| - name: Run twine check |
| run: | |
| twine check --strict python/dist/* |