Added CI workflow, fixed data_vars bug, expanded tests, added API docs, and notebook runner.#117
Closed
Added CI workflow, fixed data_vars bug, expanded tests, added API docs, and notebook runner.#117
Conversation
- Fix data_vars bug in GridDatasetAccessor: was checking self._ds instead of self._grid, causing AttributeError when no grid recognised - Add .github/workflows/ci.yml: runs pytest on Python 3.10/3.11/3.12 across Linux, Windows, and macOS with coverage reporting - Add tests/test_accessor.py: covers accessor presence, grid recognition, property correctness (including data_vars regression test), and subsetting methods - Expand tests/test_utils.py: add tests for compute_2d_subset_mask - Add docs/api.rst: autodoc for accessor, grid, selector, and utils - Update docs/index.rst to include the new api page
- Add tests/test_notebooks.py: discovers all .ipynb files in docs/examples/ and runs them via nbconvert in a subprocess. Follows the existing --online marker pattern from conftest.py: regular_grid_2d.ipynb (local data) runs offline; all other notebooks (OPeNDAP/THREDDS/S3) are marked @pytest.mark.online and skipped unless --online is passed. - Update pyproject.toml: add nbconvert and ipykernel to dev deps - Update ci.yml: install nbconvert and ipykernel in test environment so offline notebook test runs automatically in CI
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR makes several related improvements to the project's infrastructure
and code quality, motivated by #108.
Changes
Bug Fix
xarray_subset_grid/accessor.py: Fixed a bug in thedata_varsproperty where
self._dswas checked instead ofself._grid. When nogrid implementation recognises the dataset,
self._gridisNone, andthe previous code would call
None.data_vars(ds), raising anAttributeError. The fix is a single-line change to checkself._grid.CI / GitHub Actions
.github/workflows/ci.yml: Adds a test workflow that runs on everypush and pull request to
main. It tests against Python 3.10, 3.11, and3.12 on Ubuntu, Windows, and macOS. Coverage is reported to Codecov from
the Ubuntu/3.12 runner.
Tests
tests/test_accessor.py: New test file covering accessor presence,grid recognition, all accessor properties (including a regression test for
the
data_varsbug), and subsetting methods (subset_bbox,subset_polygon,subset_vars,subset_surface_level).tests/test_utils.py: Expanded with two new tests for thecompute_2d_subset_maskutility function.Documentation
docs/api.rst: New page with autodoc entries for theaccessor,grid,selector, andutilsmodules.docs/index.rst: Updated toctree to include the new API reference page.Testing
All offline tests pass locally: