Skip to content

Add ShpWriter and ShxWriter. Reduce clutter from tests, by using temp dirs for writing shapefiles. #205

Add ShpWriter and ShxWriter. Reduce clutter from tests, by using temp dirs for writing shapefiles.

Add ShpWriter and ShxWriter. Reduce clutter from tests, by using temp dirs for writing shapefiles. #205

# This workflow will run the pre-commit hooks (including linters), and the tests with a variety of Python versions
name: Run pre-commit hooks and tests
on:
push:
pull_request:
workflow_call:
workflow_dispatch:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install the latest version of uv and set the python version
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
version: 0.11.15 # uv version
python-version: "3.14"
- name: uv Sync project, asserting locked with dev dependency group
run: uv sync --frozen --group lint
- run: uv run pre-commit run --all-files --show-diff-on-failure --color=always ${{ inputs.extra_args }}
shell: bash
mypy-strict:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install the latest version of uv and set the python version
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
version: 0.11.15 # uv version
python-version: "3.14"
# use latest mypy version here, (even though pinned to 1.19.1 in lint group for Python 3.9 support)
- name: Run mypy --strict
run: uvx mypy --strict ./src/shapefile.py
build_wheel_and_sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Build wheel from the project repo
uses: ./.github/actions/build_wheel_and_sdist
test_on_all_platforms:
needs: build_wheel_and_sdist
strategy:
fail-fast: false
matrix:
python-version: [
"3.14",
"3.13",
"3.12",
"3.15-dev",
"3.11",
"3.10",
"3.9",
]
os: [
"ubuntu-24.04",
"windows-latest",
"macos-latest",
]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v6
with:
path: ./Pyshp
- name: Non-network tests
uses: ./Pyshp/.github/actions/test
with:
pyshp_repo_directory: ./Pyshp
- name: "Network tests (on Localhost ${{ !(matrix.os == 'ubuntu-24.04' && matrix.python-version == '3.14') }})"
uses: ./Pyshp/.github/actions/test
with:
extra_args: '-m network'
replace_remote_urls_with_localhost: ${{ !(matrix.os == 'ubuntu-24.04' && matrix.python-version == '3.14') }}
# Checkout to ./PyShp, as the test job also needs to check out the artefact repo
pyshp_repo_directory: ./Pyshp