Skip to content

Commit d44ee6e

Browse files
authored
Merge pull request #620 from DHI/japr/fix-merge
Fixing build errors caused by network support
2 parents 05f194d + 8c537ca commit d44ee6e

4 files changed

Lines changed: 17 additions & 2 deletions

File tree

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up uv
1717
uses: astral-sh/setup-uv@v6
1818
with:
19-
python-version: "3.14"
19+
python-version: "3.13" # Need to use 3.13 for docs build due to pythonnet dependency not yet supporting 3.14
2020
enable-cache: true
2121

2222
- name: Set up Quarto

src/modelskill/network.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
from __future__ import annotations
1515

16+
import sys
17+
1618
from abc import ABC, abstractmethod
1719
from pathlib import Path
1820
from typing import Any, Sequence, overload, TYPE_CHECKING
@@ -357,9 +359,13 @@ def from_res1d(cls, res: str | Path | Res1D) -> Network:
357359
>>> network = Network.from_res1d("model.res1d")
358360
>>> network = Network.from_res1d(Res1D("model.res1d"))
359361
"""
362+
if sys.version_info >= (3, 14):
363+
raise NotImplementedError(f"Current version of 'mikeio1d' requires python < 3.14 and {sys.version} is being used.")
364+
360365
from mikeio1d import Res1D as _Res1D
361366
from modelskill.model.adapters._res1d import Res1DReach
362367

368+
363369
if isinstance(res, (str, Path)):
364370
path = Path(res)
365371
if path.suffix.lower() != ".res1d":

tests/notebooks/test_notebooks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
_TEST_DIR = os.path.dirname(os.path.abspath(__file__))
99
PARENT_DIR = os.path.join(_TEST_DIR, "../..")
10-
SKIP_LIST = ["Download", "Metocean_track_comparison_global", "Metrics_widget"]
10+
SKIP_LIST = ["Download", "Metocean_track_comparison_global", "Metrics_widget", "Collection_systems_network"]
11+
# We skip Collection_systems_network.ipynb since it uses Network.from_res1d() which uses pythonnet and, currently, it does not support python 3.14
1112

1213

1314
def _process_notebook(notebook_filename, notebook_path="notebooks"):

tests/test_network.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Test network models and observations"""
22

33
# ruff: noqa: E402
4+
import sys
45
import pytest
56

67
pytest.importorskip("networkx")
@@ -434,3 +435,10 @@ def test_matching_workflow_multiple_nodes(self, sample_network, sample_node_data
434435
for comparer in comparer_collection:
435436
assert "Network_Model" in comparer.mod_names
436437
assert comparer.n_points > 0
438+
439+
440+
@pytest.mark.skipif(sys.version_info >= (3, 14), reason="mikeio1d requires Python < 3.14")
441+
def test_open_res1d():
442+
path_to_file = "./tests/testdata/network.res1d"
443+
network = Network.from_res1d(path_to_file)
444+
assert network.graph.number_of_nodes() == 259

0 commit comments

Comments
 (0)