Static Type Checks #6457
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Static type checks | |
| # | |
| # This workflow runs static type checks using mypy. | |
| # | |
| # It is run on every commit to the main and pull request branches. It is also | |
| # scheduled to run daily on the main branch. | |
| # | |
| name: Static Type Checks | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'pygmt/**/*.py' | |
| - '.github/workflows/type_checks.yml' | |
| pull_request: | |
| paths: | |
| - 'pygmt/**/*.py' | |
| - '.github/workflows/type_checks.yml' | |
| # Schedule daily tests | |
| schedule: | |
| - cron: '0 0 * * *' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| permissions: {} | |
| jobs: | |
| static_check: | |
| name: Static Type Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout current git repository | |
| - name: Checkout | |
| uses: actions/checkout@v6.0.1 | |
| with: | |
| persist-credentials: false | |
| # Setup Python | |
| - name: Set up Python | |
| uses: actions/setup-python@v6.1.0 | |
| with: | |
| python-version: '3.14' | |
| # Need to install following packages: | |
| # 1. required packages | |
| # 2. type checker and stub packages | |
| # 3. other packages that are used somewhere in PyGMT | |
| pip-install: | | |
| numpy pandas xarray packaging | |
| mypy pandas-stubs pyarrow-stubs | |
| - name: List install packages | |
| run: python -m pip list | |
| - name: Static type check | |
| run: make typecheck |