diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d2e87f01..a317be09d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## neptune 1.12.0 ### Changes +- Added deprecation notice to model/model_version endpoints ([#1876](https://github.com/neptune-ai/neptune-client/pull/1876)) - Dropped support for Python 3.7 ([#1864](https://github.com/neptune-ai/neptune-client/pull/1864)) ### Fixes diff --git a/src/neptune/internal/utils/deprecation.py b/src/neptune/internal/utils/deprecation.py index 36d67ab45..2bb7bc996 100644 --- a/src/neptune/internal/utils/deprecation.py +++ b/src/neptune/internal/utils/deprecation.py @@ -46,7 +46,11 @@ def deco(f): def inner(*args, **kwargs): if deprecated_kwarg_name in kwargs: if required_kwarg_name in kwargs: - raise NeptuneParametersCollision(required_kwarg_name, deprecated_kwarg_name, method_name=f.__name__) + raise NeptuneParametersCollision( + required_kwarg_name, + deprecated_kwarg_name, + method_name=f.__name__, + ) warn_once( message=f"Parameter `{deprecated_kwarg_name}` is deprecated, use `{required_kwarg_name}` instead." @@ -61,3 +65,17 @@ def inner(*args, **kwargs): return inner return deco + + +def model_registry_deprecation(func): + @wraps(func) + def inner(*args, **kwargs): + warn_once( + "Neptune's model registry has been deprecated and will be removed in a future release." + "Use runs to store model metadata instead. For more, see https://docs.neptune.ai/model_registry/." + "If you are already using the model registry, you can migrate existing metadata to runs." + "Learn how: https://docs.neptune.ai/model_registry/migrate_to_runs/." + ) + return func(*args, **kwargs) + + return inner diff --git a/src/neptune/metadata_containers/model.py b/src/neptune/metadata_containers/model.py index b32827c5e..66e8cddcd 100644 --- a/src/neptune/metadata_containers/model.py +++ b/src/neptune/metadata_containers/model.py @@ -54,6 +54,7 @@ ) from neptune.internal.state import ContainerState from neptune.internal.utils import verify_type +from neptune.internal.utils.deprecation import model_registry_deprecation from neptune.internal.utils.ping_background_job import PingBackgroundJob from neptune.metadata_containers import MetadataContainer from neptune.metadata_containers.abstract import NeptuneObjectCallback @@ -165,6 +166,7 @@ class Model(MetadataContainer): container_type = ContainerType.MODEL + @model_registry_deprecation def __init__( self, with_id: Optional[str] = None, @@ -262,6 +264,7 @@ def get_url(self) -> str: sys_id=self._sys_id, ) + @model_registry_deprecation def fetch_model_versions_table( self, *, diff --git a/src/neptune/metadata_containers/model_version.py b/src/neptune/metadata_containers/model_version.py index 9159e459a..333673c4a 100644 --- a/src/neptune/metadata_containers/model_version.py +++ b/src/neptune/metadata_containers/model_version.py @@ -49,6 +49,7 @@ from neptune.internal.operation_processors.offline_operation_processor import OfflineOperationProcessor from neptune.internal.state import ContainerState from neptune.internal.utils import verify_type +from neptune.internal.utils.deprecation import model_registry_deprecation from neptune.internal.utils.ping_background_job import PingBackgroundJob from neptune.metadata_containers import MetadataContainer from neptune.metadata_containers.abstract import NeptuneObjectCallback @@ -160,6 +161,7 @@ class ModelVersion(MetadataContainer): container_type = ContainerType.MODEL_VERSION + @model_registry_deprecation def __init__( self, with_id: Optional[str] = None, diff --git a/src/neptune/metadata_containers/project.py b/src/neptune/metadata_containers/project.py index db06a3c84..d91963546 100644 --- a/src/neptune/metadata_containers/project.py +++ b/src/neptune/metadata_containers/project.py @@ -41,6 +41,7 @@ verify_type, verify_value, ) +from neptune.internal.utils.deprecation import model_registry_deprecation from neptune.metadata_containers import MetadataContainer from neptune.metadata_containers.abstract import NeptuneObjectCallback from neptune.metadata_containers.utils import ( @@ -330,6 +331,7 @@ def fetch_runs_table( progress_bar=progress_bar, ) + @model_registry_deprecation def fetch_models_table( self, *,