Skip to content
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
10 changes: 10 additions & 0 deletions ndsl/namelist.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import dataclasses
import warnings
from typing import Any, Self

import f90nml
Expand Down Expand Up @@ -617,6 +618,15 @@ def from_f90nml(cls, namelist: f90nml.Namelist) -> Self:
}
return cls(**namelist_dict)

def __post_init__(self) -> None:
warnings.warn(
"Usage of `ndsl.Namelist` is discouraged. The class will be "
"removed in the next version together with `NamelistDefaults`, see "
"https://github.com/NOAA-GFDL/NDSL/issues/64.",
DeprecationWarning,
stacklevel=2,
)


def namelist_to_flatish_dict(nml_input: Any) -> dict:
nml = dict(nml_input)
Expand Down
8 changes: 8 additions & 0 deletions tests/test_namelist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import pytest

from ndsl import Namelist


def test_ndsl_namelist_deprecation() -> None:
with pytest.deprecated_call():
my_namelist = Namelist()