Skip to content
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

Minimal deps test in CI #72

Merged
merged 4 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,15 @@ jobs:
- name: Test with tox
run: |
tox
minimal-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create virtual env
run: python3 -m venv venv --upgrade-deps
- name: Install pyaro
run: source venv/bin/activate && pip install ./
- name: Try importing pyaro
run: source venv/bin/activate && python -c "import pyaro; print(pyaro.__version__)"

16 changes: 12 additions & 4 deletions src/pyaro/timeseries/Filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,11 +1227,11 @@ def __init__(
upper: float | None = None,
):
if "cf_units" not in sys.modules:
raise ModuleNotFoundError(
logger.info(
"valleyfloor_relaltitude filter is missing required dependency 'cf-units'. Please install to use this filter."
)
if "xarray" not in sys.modules:
raise ModuleNotFoundError(
logger.info(
"valleyfloor_relaltitude filter is missing required dependency 'xarray'. Please install to use this filter."
)

Expand All @@ -1254,8 +1254,16 @@ def name(self):
return "valleyfloor_relaltitude"

def filter_stations(self, stations: dict[str, Station]) -> dict[str, Station]:
filtered_stations = {}
if "cf_units" not in sys.modules:
raise ModuleNotFoundError(
"valleyfloor_relaltitude filter is missing required dependency 'cf-units'. Please install to use this filter."
)
if "xarray" not in sys.modules:
raise ModuleNotFoundError(
"valleyfloor_relaltitude filter is missing required dependency 'xarray'. Please install to use this filter."
)

filtered_stations = {}
with xr.open_dataset(self._topo_file) as topo:
for k, v in stations.items():
lat = v.latitude
Expand Down Expand Up @@ -1285,7 +1293,7 @@ def _calculate_relative_altitude(
*,
radius: float,
altitude: float,
topo: xr.Dataset,
topo: "xr.Dataset",
):
"""Calculates relative altitude
Expand Down