Skip to content

Commit

Permalink
Delete legacy package (#1685)
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksanderWWW authored and Raalsky committed Mar 14, 2024
1 parent 90dfdf9 commit 5509484
Show file tree
Hide file tree
Showing 113 changed files with 17 additions and 11,699 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
rev: v1.5.4
hooks:
- id: insert-license
files: ^src/neptune/(?!new/|legacy/|vendor/)[^/]+(?:/[^/]+)*\.py$
files: ^src/neptune/(?!new/|vendor/)[^/]+(?:/[^/]+)*\.py$
args: [ "--license-filepath", ".github/license_header.txt", "--allow-past-years"]
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Breaking changes
- Deleted `neptune.new` package ([#1684](https://github.com/neptune-ai/neptune-client/pull/1684))
- Deleted `neptune.legacy` package ([#1685](https://github.com/neptune-ai/neptune-client/pull/1685))

### Features
- ?
Expand Down
8 changes: 1 addition & 7 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,10 @@ component_management:
- src/neptune/logging/**
- src/neptune/metadata_containers/**
- src/neptune/new/**
- src/netpune/types/**
- src/neptune/types/**
- src/neptune/vendor/**
- src/neptune/*.py

- component_id: legacy
name: legacy
paths:
- src/neptune/legacy/**
- src/neptune/common/**

- component_id: management
name: management
paths:
Expand Down
43 changes: 0 additions & 43 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ python = "^3.7"
importlib-metadata = { version = "*", python = "<3.8" }
typing-extensions = ">=3.10.0"

# Missing compatibility layer between Python 2 and Python 3
six = ">=1.12.0"
future = ">=0.17.1"

# Utility
packaging = "*"
click = ">=7.0"
Expand Down Expand Up @@ -301,45 +297,6 @@ module = [
"neptune.internal.utils.uncaught_exception_handler",
"neptune.internal.websockets.websocket_signals_background_job",
"neptune.internal.websockets.websockets_factory",
"neptune.legacy",
"neptune.legacy.api_exceptions",
"neptune.legacy.backend",
"neptune.legacy.checkpoint",
"neptune.legacy.exceptions",
"neptune.legacy.experiments",
"neptune.legacy.internal.abort",
"neptune.legacy.internal.api_clients.backend_factory",
"neptune.legacy.internal.api_clients.client_config",
"neptune.legacy.internal.api_clients.credentials",
"neptune.legacy.internal.api_clients.hosted_api_clients.hosted_alpha_leaderboard_api_client",
"neptune.legacy.internal.api_clients.hosted_api_clients.hosted_backend_api_client",
"neptune.legacy.internal.api_clients.hosted_api_clients.mixins",
"neptune.legacy.internal.api_clients.hosted_api_clients.utils",
"neptune.legacy.internal.api_clients.offline_backend",
"neptune.legacy.internal.channels.channels",
"neptune.legacy.internal.channels.channels_values_sender",
"neptune.legacy.internal.execution.execution_context",
"neptune.legacy.internal.notebooks.comm",
"neptune.legacy.internal.notebooks.notebooks",
"neptune.legacy.internal.streams.channel_writer",
"neptune.legacy.internal.streams.stdstream_uploader",
"neptune.legacy.internal.threads.aborting_thread",
"neptune.legacy.internal.threads.hardware_metric_reporting_thread",
"neptune.legacy.internal.threads.neptune_thread",
"neptune.legacy.internal.threads.ping_thread",
"neptune.legacy.internal.utils.alpha_integration",
"neptune.legacy.internal.utils.deprecation",
"neptune.legacy.internal.utils.http",
"neptune.legacy.internal.utils.http_utils",
"neptune.legacy.internal.utils.image",
"neptune.legacy.internal.utils.source_code",
"neptune.legacy.internal.websockets.message",
"neptune.legacy.internal.websockets.reconnecting_websocket_factory",
"neptune.legacy.internal.websockets.websocket_message_processor",
"neptune.legacy.model",
"neptune.legacy.notebook",
"neptune.legacy.projects",
"neptune.legacy.sessions",
"neptune.logging.logger",
"neptune.management.exceptions",
"neptune.management.internal.api",
Expand Down
5 changes: 1 addition & 4 deletions src/neptune/common/storage/storage_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
Union,
)

import six

from neptune.internal.utils.logger import get_logger

_logger = get_logger()
Expand Down Expand Up @@ -164,8 +162,7 @@ def __repr__(self):
return self.to_str()


@six.add_metaclass(ABCMeta)
class ProgressIndicator(object):
class ProgressIndicator(metaclass=ABCMeta):
@abstractmethod
def progress(self, steps):
pass
Expand Down
5 changes: 2 additions & 3 deletions src/neptune/common/websockets/websocket_client_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@

import os
import ssl
import urllib.parse

from future.utils import PY3
from six.moves import urllib
from websocket import (
ABNF,
create_connection,
Expand Down Expand Up @@ -62,7 +61,7 @@ def recv(self):
while opcode != ABNF.OPCODE_TEXT:
opcode, data = self._ws_client.recv_data()

return data.decode("utf-8") if PY3 else data
return data.decode("utf-8")

@property
def connected(self):
Expand Down
69 changes: 0 additions & 69 deletions src/neptune/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,13 @@
"NeptuneProtectedPathException",
"NeptuneCannotChangeStageManually",
"OperationNotSupported",
"NeptuneLegacyProjectException",
"NeptuneMissingRequirementException",
"NeptuneLimitExceedException",
"NeptuneFieldCountLimitExceedException",
"NeptuneStorageLimitException",
"FetchAttributeNotFoundException",
"ArtifactNotFoundException",
"PlotlyIncompatibilityException",
"NeptunePossibleLegacyUsageException",
"NeptuneLegacyIncompatibilityException",
"NeptuneUnhandledArtifactSchemeException",
"NeptuneUnhandledArtifactTypeException",
"NeptuneLocalStorageAccessException",
Expand Down Expand Up @@ -772,25 +769,6 @@ def __init__(self, message: str):
super().__init__(f"Operation not supported: {message}")


class NeptuneLegacyProjectException(NeptuneException):
def __init__(self, project: QualifiedName):
message = """
{h1}
----NeptuneLegacyProjectException---------------------------------------------------------
{end}
Your project "{project}" has not been migrated to the new structure yet.
Unfortunately the neptune.new Python API is incompatible with projects using the old structure,
so please use legacy neptune Python API.
Don't worry - we are working hard on migrating all the projects and you will be able to use the neptune.new API soon.
You can find documentation for the legacy neptune Python API here:
- https://docs-legacy.neptune.ai/index.html
{correct}Need help?{end}-> https://docs.neptune.ai/getting_help
"""
super().__init__(message.format(project=project, **STYLES))


class NeptuneMissingRequirementException(NeptuneException):
def __init__(self, package_name: str, framework_name: Optional[str]):
message = """
Expand Down Expand Up @@ -955,53 +933,6 @@ def __init__(self, matplotlib_version, plotly_version, details):
)


class NeptunePossibleLegacyUsageException(NeptuneWrongInitParametersException):
def __init__(self):
message = """
{h1}
----NeptunePossibleLegacyUsageException----------------------------------------------------------------
{end}
It seems you are trying to use the legacy API, but you imported the new one.
Simply update your import statement to:
{python}import neptune{end}
You may want to check the legacy API docs:
- https://docs-legacy.neptune.ai
If you want to update your code with the new API, we prepared a handy migration guide:
- https://docs.neptune.ai/about/legacy/#migrating-to-neptunenew
You can read more about neptune.new in the release blog post:
- https://neptune.ai/blog/neptune-new
You may also want to check the following docs page:
- https://docs-legacy.neptune.ai/getting-started/integrate-neptune-into-your-codebase.html
{correct}Need help?{end}-> https://docs.neptune.ai/getting_help
"""
super().__init__(message.format(**STYLES))


class NeptuneLegacyIncompatibilityException(NeptuneException):
def __init__(self):
message = """
{h1}
----NeptuneLegacyIncompatibilityException----------------------------------------
{end}
It seems you are passing the legacy Experiment object, when a Run object is expected.
What can I do?
- Updating your code to the new Python API requires few changes, but to help you with this process we prepared a handy migration guide:
https://docs.neptune.ai/about/legacy/#migrating-to-neptunenew
- You can read more about neptune.new in the release blog post:
https://neptune.ai/blog/neptune-new
{correct}Need help?{end}-> https://docs.neptune.ai/getting_help
""" # noqa: E501
super().__init__(message.format(**STYLES))


class NeptuneUnhandledArtifactSchemeException(NeptuneException):
def __init__(self, path: str):
scheme = urlparse(path).scheme
Expand Down
10 changes: 1 addition & 9 deletions src/neptune/integrations/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__all__ = ["expect_not_an_experiment", "join_paths", "verify_type", "RunType"]
__all__ = ["join_paths", "verify_type", "RunType"]

from typing import Union

from neptune import Run
from neptune.common.experiments import LegacyExperiment as Experiment
from neptune.exceptions import NeptuneLegacyIncompatibilityException
from neptune.handler import Handler
from neptune.internal.utils import verify_type
from neptune.internal.utils.paths import join_paths


def expect_not_an_experiment(run: Run):
if isinstance(run, Experiment):
raise NeptuneLegacyIncompatibilityException()


RunType = Union[Run, Handler]
5 changes: 1 addition & 4 deletions src/neptune/internal/backends/hosted_neptune_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
MetadataContainerNotFound,
MetadataInconsistency,
NeptuneFeatureNotAvailableException,
NeptuneLegacyProjectException,
NeptuneLimitExceedException,
NeptuneObjectCreationConflict,
ProjectNotFound,
Expand Down Expand Up @@ -241,9 +240,7 @@ def get_project(self, project_id: QualifiedName) -> Project:
**DEFAULT_REQUEST_KWARGS,
).response()
project = response.result
project_version = project.version if hasattr(project, "version") else 1
if project_version < 2:
raise NeptuneLegacyProjectException(project_id)

return Project(
id=project.id,
name=project.name,
Expand Down

0 comments on commit 5509484

Please sign in to comment.