-
Notifications
You must be signed in to change notification settings - Fork 25
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
Skip tests that require kerchunk #259
Changes from all commits
f5a74be
91be89c
90806de
0b9b697
97d55cb
379830a
9f622ed
aa13eb7
e4e3d7e
b702f25
4f40f09
32aaac2
f59963f
6a5c8fa
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,60 @@ | ||
name: min-deps | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
paths-ignore: | ||
- 'docs/**' | ||
pull_request: | ||
branches: [ "main" ] | ||
paths-ignore: | ||
- 'docs/**' | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
|
||
test: | ||
name: ${{ matrix.python-version }}-build | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
strategy: | ||
matrix: | ||
python-version: ["3.12"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup micromamba | ||
uses: mamba-org/setup-micromamba@v1 | ||
with: | ||
environment-file: ci/min-deps.yml | ||
cache-environment: true | ||
create-args: >- | ||
python=${{matrix.python-version}} | ||
|
||
- name: Install virtualizarr | ||
run: | | ||
python -m pip install -e . --no-deps | ||
- name: Conda list information | ||
run: | | ||
conda env list | ||
conda list | ||
|
||
- name: Running Tests | ||
run: | | ||
python -m pytest ./virtualizarr --cov=./ --cov-report=xml --verbose | ||
|
||
- name: Upload code coverage to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
file: ./coverage.xml | ||
flags: unittests | ||
env_vars: OS,PYTHON | ||
name: codecov-umbrella | ||
fail_ci_if_error: false |
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. Probably for another discussion, but could we have all deps and optional deps in pyproject.toml then the optional Or maybe it's a good reason to transition to Pixi 🥇 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 know nothing about pixi, but would be open to that. 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. @maxrjones or @cisaacstern might have some real experience with it, but one really cool seeming thing is that you can have both conda and pip deps all in a pyproject.toml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: virtualizarr-min-deps | ||
channels: | ||
- conda-forge | ||
- nodefaults | ||
dependencies: | ||
- h5netcdf | ||
- h5py | ||
- hdf5 | ||
- netcdf4 | ||
- xarray>=2024.6.0 | ||
- numpy>=2.0.0 | ||
- numcodecs | ||
- packaging | ||
- ujson | ||
- universal_pathlib | ||
# Testing | ||
- codecov | ||
- pre-commit | ||
- mypy | ||
- ruff | ||
- pandas-stubs | ||
- pytest-mypy | ||
- pytest-cov | ||
- pytest | ||
- pooch | ||
- fsspec |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,20 +22,21 @@ requires-python = ">=3.10" | |
dynamic = ["version"] | ||
dependencies = [ | ||
"xarray>=2024.06.0", | ||
"kerchunk>=0.2.5", | ||
"h5netcdf", | ||
"numpy>=2.0.0", | ||
"ujson", | ||
"packaging", | ||
"universal-pathlib", | ||
"numcodecs", | ||
Comment on lines
24
to
+28
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. The minimum set of dependencies should look like this, and you could probably even make 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. Actually I re-added 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. Let's also leave the question of whether we really need fsspec/universal_pathlib for later, and just concentrate on removing kerchunk. 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. It might be nice to have more splits in the optional deps depending on the usecase, kind of like how Xarray handles it. We could have splits for different readers, writers and local/cloud usecases? 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 was thinking the same, but kept this PR targeted for now. |
||
"ujson", | ||
] | ||
|
||
[project.optional-dependencies] | ||
test = [ | ||
"codecov", | ||
"fastparquet", | ||
"fsspec", | ||
"h5netcdf", | ||
"h5py", | ||
"kerchunk>=0.2.5", | ||
"mypy", | ||
"netcdf4", | ||
"pandas-stubs", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
from collections.abc import Mapping | ||
from unittest.mock import patch | ||
|
||
import fsspec | ||
import numpy as np | ||
import pytest | ||
import xarray as xr | ||
|
@@ -13,9 +12,17 @@ | |
from virtualizarr.backend import FileType | ||
from virtualizarr.manifests import ManifestArray | ||
from virtualizarr.readers.kerchunk import _automatically_determine_filetype | ||
from virtualizarr.tests import has_astropy, has_tifffile, network, requires_s3fs | ||
from virtualizarr.tests import ( | ||
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. This is a great addition! Thanks for implementing it. 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. Another good idea just stolen from xarray 😅 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. The source of all good code |
||
has_astropy, | ||
has_tifffile, | ||
network, | ||
requires_kerchunk, | ||
requires_s3fs, | ||
requires_scipy, | ||
) | ||
|
||
|
||
@requires_scipy | ||
def test_automatically_determine_filetype_netcdf3_netcdf4(): | ||
# test the NetCDF3 vs NetCDF4 automatic file type selection | ||
|
||
|
@@ -75,6 +82,7 @@ def test_FileType(): | |
FileType(None) | ||
|
||
|
||
@requires_kerchunk | ||
class TestOpenVirtualDatasetIndexes: | ||
def test_no_indexes(self, netcdf4_file): | ||
vds = open_virtual_dataset(netcdf4_file, indexes={}) | ||
|
@@ -105,6 +113,7 @@ def index_mappings_equal(indexes1: Mapping[str, Index], indexes2: Mapping[str, I | |
return True | ||
|
||
|
||
@requires_kerchunk | ||
def test_cftime_index(tmpdir): | ||
"""Ensure a virtual dataset contains the same indexes as an Xarray dataset""" | ||
# Note: Test was created to debug: https://github.com/zarr-developers/VirtualiZarr/issues/168 | ||
|
@@ -130,6 +139,7 @@ def test_cftime_index(tmpdir): | |
assert vds.attrs == ds.attrs | ||
|
||
|
||
@requires_kerchunk | ||
class TestOpenVirtualDatasetAttrs: | ||
def test_drop_array_dimensions(self, netcdf4_file): | ||
# regression test for GH issue #150 | ||
|
@@ -237,6 +247,8 @@ def test_read_from_url(self, filetype, url): | |
assert isinstance(vds, xr.Dataset) | ||
|
||
def test_virtualizarr_vs_local_nisar(self): | ||
import fsspec | ||
|
||
# Open group directly from locally cached file with xarray | ||
url = "https://nisar.asf.earthdatacloud.nasa.gov/NISAR-SAMPLE-DATA/GCOV/ALOS1_Rosamond_20081012/NISAR_L2_PR_GCOV_001_005_A_219_4020_SHNA_A_20081012T060910_20081012T060926_P01101_F_N_J_001.h5" | ||
tmpfile = fsspec.open_local( | ||
|
@@ -266,6 +278,7 @@ def test_virtualizarr_vs_local_nisar(self): | |
xrt.assert_equal(dsXR, dsV) | ||
|
||
|
||
@requires_kerchunk | ||
class TestLoadVirtualDataset: | ||
def test_loadable_variables(self, netcdf4_file): | ||
vars_to_load = ["air", "time"] | ||
|
@@ -338,6 +351,7 @@ def test_open_dataset_with_scalar(self, hdf5_scalar, tmpdir): | |
assert vds.scalar.attrs == {"scalar": "true"} | ||
|
||
|
||
@requires_kerchunk | ||
@pytest.mark.parametrize( | ||
"reference_format", | ||
["json", "parquet", "invalid"], | ||
|
@@ -395,6 +409,7 @@ def test_open_virtual_dataset_existing_kerchunk_refs( | |
assert set(vds.variables) == set(netcdf4_virtual_dataset.variables) | ||
|
||
|
||
@requires_kerchunk | ||
def test_notimplemented_read_inline_refs(tmp_path, netcdf4_inlined_ref): | ||
# For now, we raise a NotImplementedError if we read existing references that have inlined data | ||
# https://github.com/zarr-developers/VirtualiZarr/pull/251#pullrequestreview-2361916932 | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was probably a better way to do this than just making an entire extra workflow file but my github-actions-fu is weak