Skip to content

Commit

Permalink
Added deprecation warning for model/model_version endpoints (#1876)
Browse files Browse the repository at this point in the history
Co-authored-by: Sabine <[email protected]>
  • Loading branch information
SiddhantSadangi and normandy7 authored Oct 2, 2024
1 parent 2c5aaca commit 26e08ab
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
20 changes: 19 additions & 1 deletion src/neptune/internal/utils/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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
3 changes: 3 additions & 0 deletions src/neptune/metadata_containers/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -165,6 +166,7 @@ class Model(MetadataContainer):

container_type = ContainerType.MODEL

@model_registry_deprecation
def __init__(
self,
with_id: Optional[str] = None,
Expand Down Expand Up @@ -262,6 +264,7 @@ def get_url(self) -> str:
sys_id=self._sys_id,
)

@model_registry_deprecation
def fetch_model_versions_table(
self,
*,
Expand Down
2 changes: 2 additions & 0 deletions src/neptune/metadata_containers/model_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -160,6 +161,7 @@ class ModelVersion(MetadataContainer):

container_type = ContainerType.MODEL_VERSION

@model_registry_deprecation
def __init__(
self,
with_id: Optional[str] = None,
Expand Down
2 changes: 2 additions & 0 deletions src/neptune/metadata_containers/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -330,6 +331,7 @@ def fetch_runs_table(
progress_bar=progress_bar,
)

@model_registry_deprecation
def fetch_models_table(
self,
*,
Expand Down

0 comments on commit 26e08ab

Please sign in to comment.