Skip to content

use fiona engine for the test geopandas check #2593

use fiona engine for the test geopandas check

use fiona engine for the test geopandas check #2593

Workflow file for this run

name: build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.10", "3.11", "3.12"]
jsonschema-version: ["3.0", "latest"]
name: py ${{ matrix.python-version }} js ${{ matrix.jsonschema-version }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[all, dev]"
- name: Install specific jsonschema
# Only have to execute this if we don't want the latest jsonschema version
if: ${{ matrix.jsonschema-version != 'latest' }}
run: |
pip install jsonschema==${{ matrix.jsonschema-version }}
- name: Maybe uninstall optional dependencies
# We uninstall pyarrow and vegafusion for one job to test that we have not
# accidentally introduced a hard dependency on these libraries.
# Uninstalling for Python 3.8 is an arbitrary choice.
# Also see https://github.com/vega/altair/pull/3114
if: ${{ matrix.python-version == '3.8' }}
run: |
pip uninstall -y pyarrow vegafusion vegafusion-python-embed vl-convert-python anywidget
- name: Maybe install lowest supported pandas version
# We install the lowest supported pandas version for one job to test that
# it still works. Downgrade to the oldest versions of pandas and numpy that include
# Python 3.8 wheels, so only run this job for Python 3.8
if: ${{ matrix.python-version == '3.8' }}
run: |
pip install pandas==0.25.3 numpy==1.17.5
- name: Test that schema generation has no effect
run: |
python tools/generate_schema_wrapper.py
# This gets the paths of all files which were either deleted, modified
# or are not yet tracked by Git
files=`git ls-files --deleted --modified --others --exclude-standard`
# Depending on the shell it can happen that 'files' contains empty
# lines which are filtered out in the for loop below
files_cleaned=()
for i in "${files[@]}"; do
# Skip empty items
if [ -z "$i" ]; then
continue
fi
# Add the rest of the elements to a new array
files_cleaned+=("${i}")
done
if [ ${#files_cleaned[@]} -gt 0 ]; then
echo "The code generation modified the following files:"
echo $files
exit 1
fi
- name: Test Vega Datasets with GeoPandas
run: |
python -c "from vega_datasets import data; import geopandas as gpd; print(len(gpd.read_file(data.earthquakes.url, driver='GeoJSON')))"
- name: Test GeoPandas
run: |
python -c "import geopandas as gpd; gpd.options.io_engine = "fiona"; print(len(gpd.read_file('https://cdn.jsdelivr.net/npm/[email protected]/data/earthquakes.json', driver='GeoJSON')))"
- name: Test Get content-length
run: |
python -c "import urllib.request; url='https://cdn.jsdelivr.net/npm/[email protected]/data/earthquakes.json'; print(urllib.request.urlopen(urllib.request.Request(url, method='HEAD')).headers['Content-Length'])"
# - name: Test Fiona
# run: |
# python -c "import logging; logging.basicConfig(level=logging.DEBUG); import fiona; exec(\"\"\"with fiona.Env(CPL_DEBUG=True, CPL_CURL_VERBOSE=True, CPL_TIMESTAMP=True): features = fiona.open('/vsicurl/https://cdn.jsdelivr.net/npm/[email protected]/data/earthquakes.json'); print(len(features.schema['properties']))\"\"\")"
- name: Test with pytest
run: |
pytest --doctest-modules tests
- name: Validate Vega-Lite schema
run: |
# We install all 'format' dependencies of jsonschema as check-jsonschema
# only does the 'format' checks which are installed.
# We can always use the latest jsonschema version here.
# uri-reference check is disabled as the URIs in the Vega-Lite schema do
# not conform RFC 3986.
pip install 'jsonschema[format]' check-jsonschema --upgrade
check-jsonschema --check-metaschema altair/vegalite/v5/schema/vega-lite-schema.json --disable-formats uri-reference