Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up uv
uses: astral-sh/setup-uv@v6
with:
python-version: "3.14"
python-version: "3.13" # Need to use 3.13 for docs build due to pythonnet dependency not yet supporting 3.14
enable-cache: true

- name: Set up Quarto
Expand Down
6 changes: 6 additions & 0 deletions src/modelskill/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

from __future__ import annotations

import sys

from abc import ABC, abstractmethod
from pathlib import Path
from typing import Any, Sequence, overload, TYPE_CHECKING
Expand Down Expand Up @@ -357,9 +359,13 @@ def from_res1d(cls, res: str | Path | Res1D) -> Network:
>>> network = Network.from_res1d("model.res1d")
>>> network = Network.from_res1d(Res1D("model.res1d"))
"""
if sys.version_info >= (3, 14):
raise NotImplementedError(f"Current version of 'mikeio1d' requires python < 3.14 and {sys.version} is being used.")

from mikeio1d import Res1D as _Res1D
from modelskill.model.adapters._res1d import Res1DReach


if isinstance(res, (str, Path)):
path = Path(res)
if path.suffix.lower() != ".res1d":
Expand Down
3 changes: 2 additions & 1 deletion tests/notebooks/test_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

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


def _process_notebook(notebook_filename, notebook_path="notebooks"):
Expand Down
8 changes: 8 additions & 0 deletions tests/test_network.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Test network models and observations"""

# ruff: noqa: E402
import sys
import pytest

pytest.importorskip("networkx")
Expand Down Expand Up @@ -434,3 +435,10 @@ def test_matching_workflow_multiple_nodes(self, sample_network, sample_node_data
for comparer in comparer_collection:
assert "Network_Model" in comparer.mod_names
assert comparer.n_points > 0


@pytest.mark.skipif(sys.version_info >= (3, 14), reason="mikeio1d requires Python < 3.14")
def test_open_res1d():
path_to_file = "./tests/testdata/network.res1d"
network = Network.from_res1d(path_to_file)
assert network.graph.number_of_nodes() == 259
Loading