From 29e309d8af6d55370f1f7c3dde17af7115136009 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 12:38:40 +0100 Subject: [PATCH 01/33] version moved --- src/neptune/new/version.py | 11 +++++------ src/neptune/version.py | 6 ++++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/neptune/new/version.py b/src/neptune/new/version.py index 85710beb3..b15c53bfa 100644 --- a/src/neptune/new/version.py +++ b/src/neptune/new/version.py @@ -13,10 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__all__ = ["version"] +__all__ = ["version", "__version__"] -from packaging.version import parse - -from neptune.version import __version__ - -version = parse(__version__) +from neptune.version import ( + __version__, + version, +) diff --git a/src/neptune/version.py b/src/neptune/version.py index 881f5c138..2da91a9c2 100644 --- a/src/neptune/version.py +++ b/src/neptune/version.py @@ -13,8 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # +__all__ = ["version", "__version__"] + import sys +from packaging.version import parse + if sys.version_info >= (3, 8): from importlib.metadata import ( PackageNotFoundError, @@ -27,7 +31,9 @@ ) try: + # NPT-12953: Rename to `neptune` __version__ = version("neptune-client") + version = parse(__version__) except PackageNotFoundError: # package is not installed pass From 4052299989501ea95bdf3059fb2c121542ceddec Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 13:33:25 +0100 Subject: [PATCH 02/33] Utils moved to root --- src/neptune/new/utils.py | 38 +--------------------------- src/neptune/utils.py | 54 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 37 deletions(-) create mode 100644 src/neptune/utils.py diff --git a/src/neptune/new/utils.py b/src/neptune/new/utils.py index 0875e4302..76c89cbb3 100644 --- a/src/neptune/new/utils.py +++ b/src/neptune/new/utils.py @@ -15,40 +15,4 @@ # __all__ = ["stringify_unsupported"] -from typing import ( - Any, - List, - Mapping, - Tuple, - Union, -) - -from neptune.new.internal.utils.stringify_value import StringifyValue - - -def stringify_unsupported(value: Any) -> Union[StringifyValue, Mapping, List, Tuple]: - """Helper function that converts unsupported values in a collection or dictionary to strings. - Args: - value (Any): A dictionary with values or a collection - Example: - >>> import neptune.new as neptune - >>> run = neptune.init_run() - >>> complex_dict = {"tuple": ("hi", 1), "metric": 0.87} - >>> run["complex_dict"] = complex_dict - >>> # (as of 1.0.0) error - tuple is not a supported type - ... from neptune.new.utils import stringify_unsupported - >>> run["complex_dict"] = stringify_unsupported(complex_dict) - - For more information, see: - https://docs.neptune.ai/setup/neptune-client_1-0_release_changes/#no-more-implicit-casting-to-string - """ - if isinstance(value, dict): - return {k: stringify_unsupported(v) for k, v in value.items()} - - if isinstance(value, list): - return list(map(stringify_unsupported, value)) - - if isinstance(value, tuple): - return tuple(map(stringify_unsupported, value)) - - return StringifyValue(value=value) +from neptune.utils import stringify_unsupported diff --git a/src/neptune/utils.py b/src/neptune/utils.py new file mode 100644 index 000000000..0875e4302 --- /dev/null +++ b/src/neptune/utils.py @@ -0,0 +1,54 @@ +# +# Copyright (c) 2022, Neptune Labs Sp. z o.o. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__all__ = ["stringify_unsupported"] + +from typing import ( + Any, + List, + Mapping, + Tuple, + Union, +) + +from neptune.new.internal.utils.stringify_value import StringifyValue + + +def stringify_unsupported(value: Any) -> Union[StringifyValue, Mapping, List, Tuple]: + """Helper function that converts unsupported values in a collection or dictionary to strings. + Args: + value (Any): A dictionary with values or a collection + Example: + >>> import neptune.new as neptune + >>> run = neptune.init_run() + >>> complex_dict = {"tuple": ("hi", 1), "metric": 0.87} + >>> run["complex_dict"] = complex_dict + >>> # (as of 1.0.0) error - tuple is not a supported type + ... from neptune.new.utils import stringify_unsupported + >>> run["complex_dict"] = stringify_unsupported(complex_dict) + + For more information, see: + https://docs.neptune.ai/setup/neptune-client_1-0_release_changes/#no-more-implicit-casting-to-string + """ + if isinstance(value, dict): + return {k: stringify_unsupported(v) for k, v in value.items()} + + if isinstance(value, list): + return list(map(stringify_unsupported, value)) + + if isinstance(value, tuple): + return tuple(map(stringify_unsupported, value)) + + return StringifyValue(value=value) From 8e4571ec539c3b493acf68e071a0f71c4d88fc44 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 13:34:44 +0100 Subject: [PATCH 03/33] Handler moved to root --- src/neptune/handler.py | 726 +++++++++++++++++++++++++++++++++++++ src/neptune/new/handler.py | 710 +----------------------------------- 2 files changed, 727 insertions(+), 709 deletions(-) create mode 100644 src/neptune/handler.py diff --git a/src/neptune/handler.py b/src/neptune/handler.py new file mode 100644 index 000000000..ad93b8cce --- /dev/null +++ b/src/neptune/handler.py @@ -0,0 +1,726 @@ +# +# Copyright (c) 2022, Neptune Labs Sp. z o.o. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__all__ = ["Handler"] + +from functools import wraps +from typing import ( + TYPE_CHECKING, + Any, + Collection, + Dict, + Iterable, + Iterator, + List, + NewType, + Optional, + Union, +) + +from neptune.common.deprecation import warn_once + +# backwards compatibility +from neptune.common.exceptions import NeptuneException # noqa: F401 +from neptune.new.attributes import File +from neptune.new.attributes.atoms.artifact import Artifact +from neptune.new.attributes.constants import SYSTEM_STAGE_ATTRIBUTE_PATH +from neptune.new.attributes.file_set import FileSet +from neptune.new.attributes.namespace import Namespace +from neptune.new.attributes.series import FileSeries +from neptune.new.attributes.series.float_series import FloatSeries +from neptune.new.attributes.series.string_series import StringSeries +from neptune.new.attributes.sets.string_set import StringSet +from neptune.new.exceptions import ( + MissingFieldException, + NeptuneCannotChangeStageManually, + NeptuneUserApiInputException, +) +from neptune.new.internal.artifacts.types import ArtifactFileData +from neptune.new.internal.utils import ( + is_collection, + is_dict_like, + is_float, + is_float_like, + is_string, + is_string_like, + is_stringify_value, + verify_collection_type, + verify_type, +) +from neptune.new.internal.utils.paths import ( + join_paths, + parse_path, +) +from neptune.new.internal.value_to_attribute_visitor import ValueToAttributeVisitor +from neptune.new.types.atoms.file import File as FileVal +from neptune.new.types.type_casting import cast_value_for_extend +from neptune.new.types.value_copy import ValueCopy + +if TYPE_CHECKING: + from neptune.new.metadata_containers import MetadataContainer + + NeptuneObject = NewType("NeptuneObject", MetadataContainer) + + +def validate_path_not_protected(target_path: str, handler: "Handler"): + path_protection_exception = handler._PROTECTED_PATHS.get(target_path) + if path_protection_exception: + raise path_protection_exception(target_path) + + +def check_protected_paths(fun): + @wraps(fun) + def inner_fun(self: "Handler", *args, **kwargs): + validate_path_not_protected(self._path, self) + return fun(self, *args, **kwargs) + + return inner_fun + + +ExtendDictT = Union[Collection[Any], Dict[str, "ExtendDictT"]] + + +class Handler: + # paths which can't be modified by client directly + _PROTECTED_PATHS = { + SYSTEM_STAGE_ATTRIBUTE_PATH: NeptuneCannotChangeStageManually, + } + + def __init__(self, container: "NeptuneObject", path: str): + super().__init__() + self._container = container + self._path = path + + def __repr__(self): + attr = self._container.get_attribute(self._path) + formal_type = type(attr).__name__ if attr else "Unassigned" + return f'<{formal_type} field at "{self._path}">' + + def _ipython_key_completions_(self): + return self._container._get_subpath_suggestions(path_prefix=self._path) + + def __getitem__(self, path: str) -> "Handler": + return Handler(self._container, join_paths(self._path, path)) + + def __setitem__(self, key: str, value) -> None: + self[key].assign(value) + + def __getattr__(self, item: str): + run_level_methods = {"exists", "get_structure", "get_run_url", "print_structure", "stop", "sync", "wait"} + + if item in run_level_methods: + raise AttributeError( + "You're invoking an object-level method on a handler for a namespace" "inside the object.", + f""" + For example: You're trying run[{self._path}].{item}() + but you probably want run.{item}(). + + To obtain the root object of the namespace handler, you can do: + root_run = run[{self._path}].get_root_object() + root_run.{item}() + """, + ) + + return object.__getattribute__(self, item) + + def _get_attribute(self): + """Returns Attribute defined in `self._path` or throws MissingFieldException""" + attr = self._container.get_attribute(self._path) + if attr is None: + raise MissingFieldException(self._path) + return attr + + @property + def container(self) -> "MetadataContainer": + """Returns the container that the attribute is attached to""" + return self._container + + def get_root_object(self) -> "NeptuneObject": + """Returns the root-level object of a namespace handler. + + Example: + If you use it on the namespace of a run, the run object is returned. + + >>> pretraining = run["workflow/steps/pretraining"] + >>> pretraining.stop() + ... # Error: pretraining is a namespace handler object, not a run object + >>> pretraining_run = pretraining.get_root_object() + >>> pretraining_run.stop() # The root run is stopped + + For more, see the docs: + https://docs.neptune.ai/api/field_types/#get_root_object + """ + return self._container + + @check_protected_paths + def assign(self, value, wait: bool = False) -> None: + """Assigns the provided value to the field. + + Available for following field types (`Field types docs page`_): + * `Integer` + * `Float` + * `Boolean` + * `String` + + Args: + value: Value to be stored in a field. + wait (bool, optional): If `True` the client will wait to send all tracked metadata to the server. + This makes the call synchronous. + Defaults to `None`. + + Examples: + Assigning values: + + >>> import neptune.new as neptune + >>> run = neptune.init_run() + + >>> # You can both use the Python assign operator (=) + ... run['parameters/max_epochs'] = 5 + >>> # as well as directly use the .assign method + ... run['parameters/max_epochs'].assign(5) + + You can assign integers, floats, bools, strings + + >>> run['parameters/max_epochs'] = 5 + >>> run['parameters/max_lr'] = 0.4 + >>> run['parameters/early_stopping'] = True + >>> run['JIRA'] = 'NPT-952' + + You can also assign values in batch through a dict + + >>> params = {'max_epochs': 5, 'lr': 0.4} + >>> run['parameters'] = params + + .. _Field types docs page: + https://docs.neptune.ai/api-reference/field-types + """ + with self._container.lock(): + attr = self._container.get_attribute(self._path) + if attr is None: + self._container.define(self._path, value) + else: + if isinstance(value, Handler): + value = ValueCopy(value) + attr.process_assignment(value, wait) + + @check_protected_paths + def upload(self, value, wait: bool = False) -> None: + """Uploads provided file under specified field path. + + Args: + value (str or File): Path to the file to be uploaded or `File` value object. + wait (bool, optional): If `True` the client will wait to send all tracked metadata to the server. + This makes the call synchronous. + Defaults to `False`. + + Examples: + >>> import neptune.new as neptune + >>> run = neptune.init_run() + + >>> # Upload example data + ... run["dataset/data_sample"].upload("sample_data.csv") + + >>> # Both the content and the extension is stored + ... # When downloaded the filename is a combination of path and the extension + ... run["dataset/data_sample"].download() # data_sample.csv + + Explicitely create File value object + + >>> from neptune.new.types import File + >>> run["dataset/data_sample"].upload(File("sample_data.csv")) + + You may also want to check `upload docs page`_. + + .. _upload docs page: + https://docs.neptune.ai/api/field_types#upload + + """ + value = FileVal.create_from(value) + + with self._container.lock(): + attr = self._container.get_attribute(self._path) + if attr is None: + attr = File(self._container, parse_path(self._path)) + self._container.set_attribute(self._path, attr) + attr.upload(value, wait) + + @check_protected_paths + def upload_files(self, value: Union[str, Iterable[str]], wait: bool = False) -> None: + if is_collection(value): + verify_collection_type("value", value, str) + else: + verify_type("value", value, str) + + with self._container.lock(): + attr = self._container.get_attribute(self._path) + if attr is None: + attr = FileSet(self._container, parse_path(self._path)) + self._container.set_attribute(self._path, attr) + attr.upload_files(value, wait) + + @check_protected_paths + def log( + self, + value, + step: Optional[float] = None, + timestamp: Optional[float] = None, + wait: bool = False, + **kwargs, + ) -> None: + """Logs the provided value or a collection of values. + + Available for following field types (`Field types docs page`_): + * `FloatSeries` + * `StringSeries` + * `FileSeries` + + + Args: + value: Value or collection of values to be added to the field. + step (float or int, optional, default is None): Index of the log entry being appended. + Must be strictly increasing. + Defaults to `None`. + timestamp(float or int, optional): Time index of the log entry being appended in form of Unix time. + If `None` current time (`time.time()`) will be used as a timestamp. + Defaults to `None`. + wait (bool, optional): If `True` the client will wait to send all tracked metadata to the server. + This makes the call synchronous. + Defaults to `False`. + + .. _Field types docs page: + https://docs.neptune.ai/api-reference/field-types + + """ + verify_type("step", step, (int, float, type(None))) + verify_type("timestamp", timestamp, (int, float, type(None))) + + with self._container.lock(): + attr = self._container.get_attribute(self._path) + if attr is None: + if is_collection(value): + if value: + first_value = next(iter(value)) + else: + raise ValueError("Cannot deduce value type: `value` cannot be empty") + else: + first_value = value + + from_stringify_value = False + if is_stringify_value(first_value): + from_stringify_value, first_value = True, first_value.value + + if is_float(first_value): + attr = FloatSeries(self._container, parse_path(self._path)) + elif is_string(first_value): + attr = StringSeries(self._container, parse_path(self._path)) + elif FileVal.is_convertable(first_value): + attr = FileSeries(self._container, parse_path(self._path)) + elif is_float_like(first_value): + attr = FloatSeries(self._container, parse_path(self._path)) + elif is_string_like(first_value): + if not from_stringify_value: + warn_once( + message="The object you're logging will be implicitly cast to a string." + " We'll end support of this behavior in `neptune-client==1.0.0`." + " To log the object as a string, use `.log(str(object))` or" + " `.log(stringify_unsupported(collection))` for collections and dictionaries." + " For details, see https://docs.neptune.ai/setup/neptune-client_1-0_release_changes" + ) + attr = StringSeries(self._container, parse_path(self._path)) + else: + raise TypeError("Value of unsupported type {}".format(type(first_value))) + + self._container.set_attribute(self._path, attr) + attr.log(value, step=step, timestamp=timestamp, wait=wait, **kwargs) + + @check_protected_paths + def append( + self, + value: Union[dict, Any], + step: Optional[float] = None, + timestamp: Optional[float] = None, + wait: bool = False, + **kwargs, + ) -> None: + """Logs a series of values, such as a metric, by appending the provided value to the end of the series. + + Available for following series field types: + + * `FloatSeries` - series of float values + * `StringSeries` - series of strings + * `FileSeries` - series of files + + When you log the first value, the type of the value determines what type of field is created. + For more, see the field types documentation: https://docs.neptune.ai/api/field_types + + Args: + value: Value to be added to the series field. + step: Optional index of the entry being appended. Must be strictly increasing. + timestamp: Optional time index of the log entry being appended, in Unix time format. + If None, the current time (obtained with `time.time()`) is used. + wait: If True, the client sends all tracked metadata to the server before executing the call. + For details, see https://docs.neptune.ai/api/universal/#wait + + Examples: + >>> import neptune.new as neptune + >>> run = neptune.init_run() + >>> for epoch in range(n_epochs): + ... ... # Your training loop + ... run["train/epoch/loss"].append(loss) # FloatSeries + ... token = str(...) + ... run["train/tokens"].append(token) # StringSeries + ... run["train/distribution"].append(plt_histogram, step=epoch) # FileSeries + """ + verify_type("step", step, (int, float, type(None))) + verify_type("timestamp", timestamp, (int, float, type(None))) + if step is not None: + step = [step] + if timestamp is not None: + timestamp = [timestamp] + + value = ExtendUtils.validate_and_transform_to_extend_format(value) + self.extend(value, step, timestamp, wait, **kwargs) + + @check_protected_paths + def extend( + self, + values: ExtendDictT, + steps: Optional[Collection[float]] = None, + timestamps: Optional[Collection[float]] = None, + wait: bool = False, + **kwargs, + ) -> None: + """Logs a series of values by appending the provided collection of values to the end of the series. + + Available for following series field types: + + * `FloatSeries` - series of float values + * `StringSeries` - series of strings + * `FileSeries` - series of files + + When you log the first value, the type of the value determines what type of field is created. + For more, see the field types documentation: https://docs.neptune.ai/api/field_types + + Args: + values: Values to be added to the series field, as a dictionary or collection. + steps: Optional collection of indeces for the entries being appended. Must be strictly increasing. + timestamps: Optional collection of time indeces for the entries being appended, in Unix time format. + If None, the current time (obtained with `time.time()`) is used. + wait: If True, the client sends all tracked metadata to the server before executing the call. + For details, see https://docs.neptune.ai/api/universal/#wait + + Example: + The following example reads a CSV file into a pandas DataFrame and extracts the values + to create a Neptune series. + >>> import neptune.new as neptune + >>> run = neptune.init_run() + >>> for epoch in range(n_epochs): + ... df = pandas.read_csv("time_series.csv") + ... ys = df["value"] + ... ts = df["timestamp"] + ... run["data/example_series"].extend(ys, timestamps=ts) + """ + ExtendUtils.validate_values_for_extend(values, steps, timestamps) + + with self._container.lock(): + attr = self._container.get_attribute(self._path) + if attr is None: + neptune_value = cast_value_for_extend(values) + attr = ValueToAttributeVisitor(self._container, parse_path(self._path)).visit(neptune_value) + self._container.set_attribute(self._path, attr) + + attr.extend(values, steps=steps, timestamps=timestamps, wait=wait, **kwargs) + + @check_protected_paths + def add(self, values: Union[str, Iterable[str]], wait: bool = False) -> None: + """Adds the provided tag or tags to the run's tags. + + Args: + values (str or collection of str): Tag or tags to be added. + .. note:: + If you want you can use emojis in your tags eg. "Exploration 🧪" + wait (bool, optional): If `True` the client will wait to send all tracked metadata to the server first. + This makes the call synchronous. + Defaults to `False`. + + You may also want to check `add docs page`_. + + .. _add types docs page: + https://docs.neptune.ai/api/field_types#add + """ + verify_type("values", values, (str, Iterable)) + with self._container.lock(): + attr = self._container.get_attribute(self._path) + if attr is None: + attr = StringSet(self._container, parse_path(self._path)) + self._container.set_attribute(self._path, attr) + attr.add(values, wait) + + @check_protected_paths + def pop(self, path: str = None, wait: bool = False) -> None: + with self._container.lock(): + handler = self + if path: + verify_type("path", path, str) + handler = self[path] + path = join_paths(self._path, path) + # extra check: check_protected_paths decorator does not catch flow with non-null path + validate_path_not_protected(path, self) + else: + path = self._path + + attribute = self._container.get_attribute(path) + if isinstance(attribute, Namespace): + for child_path in list(attribute): + handler.pop(child_path, wait) + else: + self._container._pop_impl(parse_path(path), wait) + + @check_protected_paths + def remove(self, values: Union[str, Iterable[str]], wait: bool = False) -> None: + """Removes the provided tag or tags from the set. + + Args: + values (str or collection of str): Tag or tags to be removed. + wait (bool, optional): If `True` the client will wait to send all tracked metadata to the server first. + This makes the call synchronous. + Defaults to `False`. + + You may also want to check `remove docs page`_. + + .. _remove docs page: + https://docs.neptune.ai/api/field_types#remove + """ + return self._pass_call_to_attr(function_name="remove", values=values, wait=wait) + + @check_protected_paths + def clear(self, wait: bool = False): + """Removes all tags from the `StringSet`. + + Args: + wait (bool, optional): If `True` the client will wait to send all tracked metadata to the server first. + This makes the call synchronous. + Defaults to `False`. + + You may also want to check `clear docs page`_. + + .. _clear docs page: + https://docs.neptune.ai/api/field_types#clear + """ + return self._pass_call_to_attr(function_name="clear", wait=wait) + + def fetch(self): + """Fetches fields value or in case of a namespace fetches values of all non-File Atom fields as a dictionary. + + Available for following field types (`Field types docs page`_): + * `Integer` + * `Float` + * `Boolean` + * `String` + * `DateTime` + * `StringSet` + * `Namespace handler` + + Returns: + Value stored in the field or in case of a namespace a dictionary containing all non-Atom fields values. + + .. _Field types docs page: + https://docs.neptune.ai/api-reference/field-types + """ + return self._pass_call_to_attr(function_name="fetch") + + def fetch_last(self): + """Fetches last value stored in the series from Neptune servers. + + Available for following field types (`Field types docs page`_): + * `FloatSeries` + * `StringSeries` + + Returns: + Fetches last value stored in the series from Neptune servers. + + .. _Field types docs page: + https://docs.neptune.ai/api-reference/field-types + """ + return self._pass_call_to_attr(function_name="fetch_last") + + def fetch_values(self, include_timestamp: Optional[bool] = True): + """Fetches all values stored in the series from Neptune servers. + + Available for following field types (`Field types docs page`_): + * `FloatSeries` + * `StringSeries` + + Args: + include_timestamp (bool, optional): Whether the fetched data should include the timestamp field. + Defaults to `True`. + + Returns: + ``Pandas.DataFrame``: containing all the values and their indexes stored in the series field. + + .. _Field types docs page: + https://docs.neptune.ai/api-reference/field-types + """ + return self._pass_call_to_attr(function_name="fetch_values", include_timestamp=include_timestamp) + + @check_protected_paths + def delete_files(self, paths: Union[str, Iterable[str]], wait: bool = False) -> None: + """Delete the file or files specified by paths from the `FileSet` stored on the Neptune servers. + + Args: + paths (str or collection of str): `Path` or paths to files or folders to be deleted. + Note that these are paths relative to the FileSet itself e.g. if the `FileSet` contains + file `example.txt`, `varia/notes.txt`, `varia/data.csv` to delete whole subfolder you would pass + varia as the argument. + wait (bool, optional): If `True` the client will wait to send all tracked metadata to the server. + This makes the call synchronous. + Defaults to `None`. + + You may also want to check `delete_files docs page`_. + + .. _delete_files docs page: + https://docs.neptune.ai/api/field_types#delete_files + """ + return self._pass_call_to_attr(function_name="delete_files", paths=paths, wait=wait) + + @check_protected_paths + def download(self, destination: str = None) -> None: + """Downloads the stored file or files to the working directory or specified destination. + + Available for following field types (`Field types docs page`_): + * `File` + * `FileSeries` + * `FileSet` + * `Artifact` + + Args: + destination (str, optional): Path to where the file(s) should be downloaded. + If `None` file will be downloaded to the working directory. + If `destination` is a directory, the file will be downloaded to the specified directory with a filename + composed from field name and extension (if present). + If `destination` is a path to a file, the file will be downloaded under the specified name. + Defaults to `None`. + + .. _Field types docs page: + https://docs.neptune.ai/api-reference/field-types + """ + return self._pass_call_to_attr(function_name="download", destination=destination) + + def download_last(self, destination: str = None) -> None: + """Downloads the stored file or files to the working directory or specified destination. + + Args: + destination (str, optional): Path to where the file(s) should be downloaded. + If `None` file will be downloaded to the working directory. + If `destination` is a directory, the file will be downloaded to the specified directory with a filename + composed from field name and extension (if present). + If `destination` is a path to a file, the file will be downloaded under the specified name. + Defaults to `None`. + + You may also want to check `download_last docs page`_. + + .. _download_last docs page: + https://docs.neptune.ai/api/field_types#download_last + """ + return self._pass_call_to_attr(function_name="download_last", destination=destination) + + def fetch_hash(self) -> str: + """Fetches the hash of an artifact. + + You may also want to check `fetch_hash docs page`_. + https://docs.neptune.ai/api/field_types#fetch_hash + """ + return self._pass_call_to_attr(function_name="fetch_hash") + + def fetch_extension(self) -> str: + """Fetches the extension of a file. + + You may also want to check `fetch_extension docs page`_. + https://docs.neptune.ai/api/field_types#fetch_extension + """ + return self._pass_call_to_attr(function_name="fetch_extension") + + def fetch_files_list(self) -> List[ArtifactFileData]: + """Fetches the list of files in an artifact and their metadata. + + You may also want to check `fetch_files_list docs page`_. + https://docs.neptune.ai/api/field_types#fetch_files_list + """ + return self._pass_call_to_attr(function_name="fetch_files_list") + + def _pass_call_to_attr(self, function_name, **kwargs): + return getattr(self._get_attribute(), function_name)(**kwargs) + + @check_protected_paths + def track_files(self, path: str, destination: str = None, wait: bool = False) -> None: + """Creates an artifact tracking some files. + + You may also want to check `track_files docs page`_. + https://docs.neptune.ai/api/field_types#track_files + """ + with self._container.lock(): + attr = self._container.get_attribute(self._path) + if attr is None: + attr = Artifact(self._container, parse_path(self._path)) + self._container.set_attribute(self._path, attr) + + attr.track_files(path=path, destination=destination, wait=wait) + + def __delitem__(self, path) -> None: + self.pop(path) + + +class ExtendUtils: + @staticmethod + def validate_and_transform_to_extend_format(value): + """Preserve nested structure created by `Namespaces` and `dict_like` objects, + but replace all other values with single-element lists, + so work can be delegated to `extend` method.""" + if isinstance(value, Namespace) or is_dict_like(value): + return {k: ExtendUtils.validate_and_transform_to_extend_format(v) for k, v in value.items()} + elif is_collection(value): + raise NeptuneUserApiInputException( + "Value cannot be a collection, if you want to `append` multiple values at once use `extend` method." + ) + else: + return [value] + + @staticmethod + def validate_values_for_extend(values, steps, timestamps): + """Validates if input data is a collection or Namespace with collections leafs. + If steps or timestamps are passed, check if its length is equal to all given values.""" + collections_lengths = set(ExtendUtils.generate_leaf_collection_lengths(values)) + + if len(collections_lengths) > 1: + if steps is not None: + raise NeptuneUserApiInputException("Number of steps must be equal to number of values") + if timestamps is not None: + raise NeptuneUserApiInputException("Number of timestamps must be equal to number of values") + else: + common_collections_length = next(iter(collections_lengths)) + if steps is not None and common_collections_length != len(steps): + raise NeptuneUserApiInputException("Number of steps must be equal to number of values") + if timestamps is not None and common_collections_length != len(timestamps): + raise NeptuneUserApiInputException("Number of timestamps must be equal to number of values") + + @staticmethod + def generate_leaf_collection_lengths(values) -> Iterator[int]: + if isinstance(values, Namespace) or is_dict_like(values): + for val in values.values(): + yield from ExtendUtils.generate_leaf_collection_lengths(val) + elif is_collection(values): + yield len(values) + else: + raise NeptuneUserApiInputException("Values must be a collection or Namespace leafs must be collections") diff --git a/src/neptune/new/handler.py b/src/neptune/new/handler.py index ad93b8cce..5d29b91b6 100644 --- a/src/neptune/new/handler.py +++ b/src/neptune/new/handler.py @@ -15,712 +15,4 @@ # __all__ = ["Handler"] -from functools import wraps -from typing import ( - TYPE_CHECKING, - Any, - Collection, - Dict, - Iterable, - Iterator, - List, - NewType, - Optional, - Union, -) - -from neptune.common.deprecation import warn_once - -# backwards compatibility -from neptune.common.exceptions import NeptuneException # noqa: F401 -from neptune.new.attributes import File -from neptune.new.attributes.atoms.artifact import Artifact -from neptune.new.attributes.constants import SYSTEM_STAGE_ATTRIBUTE_PATH -from neptune.new.attributes.file_set import FileSet -from neptune.new.attributes.namespace import Namespace -from neptune.new.attributes.series import FileSeries -from neptune.new.attributes.series.float_series import FloatSeries -from neptune.new.attributes.series.string_series import StringSeries -from neptune.new.attributes.sets.string_set import StringSet -from neptune.new.exceptions import ( - MissingFieldException, - NeptuneCannotChangeStageManually, - NeptuneUserApiInputException, -) -from neptune.new.internal.artifacts.types import ArtifactFileData -from neptune.new.internal.utils import ( - is_collection, - is_dict_like, - is_float, - is_float_like, - is_string, - is_string_like, - is_stringify_value, - verify_collection_type, - verify_type, -) -from neptune.new.internal.utils.paths import ( - join_paths, - parse_path, -) -from neptune.new.internal.value_to_attribute_visitor import ValueToAttributeVisitor -from neptune.new.types.atoms.file import File as FileVal -from neptune.new.types.type_casting import cast_value_for_extend -from neptune.new.types.value_copy import ValueCopy - -if TYPE_CHECKING: - from neptune.new.metadata_containers import MetadataContainer - - NeptuneObject = NewType("NeptuneObject", MetadataContainer) - - -def validate_path_not_protected(target_path: str, handler: "Handler"): - path_protection_exception = handler._PROTECTED_PATHS.get(target_path) - if path_protection_exception: - raise path_protection_exception(target_path) - - -def check_protected_paths(fun): - @wraps(fun) - def inner_fun(self: "Handler", *args, **kwargs): - validate_path_not_protected(self._path, self) - return fun(self, *args, **kwargs) - - return inner_fun - - -ExtendDictT = Union[Collection[Any], Dict[str, "ExtendDictT"]] - - -class Handler: - # paths which can't be modified by client directly - _PROTECTED_PATHS = { - SYSTEM_STAGE_ATTRIBUTE_PATH: NeptuneCannotChangeStageManually, - } - - def __init__(self, container: "NeptuneObject", path: str): - super().__init__() - self._container = container - self._path = path - - def __repr__(self): - attr = self._container.get_attribute(self._path) - formal_type = type(attr).__name__ if attr else "Unassigned" - return f'<{formal_type} field at "{self._path}">' - - def _ipython_key_completions_(self): - return self._container._get_subpath_suggestions(path_prefix=self._path) - - def __getitem__(self, path: str) -> "Handler": - return Handler(self._container, join_paths(self._path, path)) - - def __setitem__(self, key: str, value) -> None: - self[key].assign(value) - - def __getattr__(self, item: str): - run_level_methods = {"exists", "get_structure", "get_run_url", "print_structure", "stop", "sync", "wait"} - - if item in run_level_methods: - raise AttributeError( - "You're invoking an object-level method on a handler for a namespace" "inside the object.", - f""" - For example: You're trying run[{self._path}].{item}() - but you probably want run.{item}(). - - To obtain the root object of the namespace handler, you can do: - root_run = run[{self._path}].get_root_object() - root_run.{item}() - """, - ) - - return object.__getattribute__(self, item) - - def _get_attribute(self): - """Returns Attribute defined in `self._path` or throws MissingFieldException""" - attr = self._container.get_attribute(self._path) - if attr is None: - raise MissingFieldException(self._path) - return attr - - @property - def container(self) -> "MetadataContainer": - """Returns the container that the attribute is attached to""" - return self._container - - def get_root_object(self) -> "NeptuneObject": - """Returns the root-level object of a namespace handler. - - Example: - If you use it on the namespace of a run, the run object is returned. - - >>> pretraining = run["workflow/steps/pretraining"] - >>> pretraining.stop() - ... # Error: pretraining is a namespace handler object, not a run object - >>> pretraining_run = pretraining.get_root_object() - >>> pretraining_run.stop() # The root run is stopped - - For more, see the docs: - https://docs.neptune.ai/api/field_types/#get_root_object - """ - return self._container - - @check_protected_paths - def assign(self, value, wait: bool = False) -> None: - """Assigns the provided value to the field. - - Available for following field types (`Field types docs page`_): - * `Integer` - * `Float` - * `Boolean` - * `String` - - Args: - value: Value to be stored in a field. - wait (bool, optional): If `True` the client will wait to send all tracked metadata to the server. - This makes the call synchronous. - Defaults to `None`. - - Examples: - Assigning values: - - >>> import neptune.new as neptune - >>> run = neptune.init_run() - - >>> # You can both use the Python assign operator (=) - ... run['parameters/max_epochs'] = 5 - >>> # as well as directly use the .assign method - ... run['parameters/max_epochs'].assign(5) - - You can assign integers, floats, bools, strings - - >>> run['parameters/max_epochs'] = 5 - >>> run['parameters/max_lr'] = 0.4 - >>> run['parameters/early_stopping'] = True - >>> run['JIRA'] = 'NPT-952' - - You can also assign values in batch through a dict - - >>> params = {'max_epochs': 5, 'lr': 0.4} - >>> run['parameters'] = params - - .. _Field types docs page: - https://docs.neptune.ai/api-reference/field-types - """ - with self._container.lock(): - attr = self._container.get_attribute(self._path) - if attr is None: - self._container.define(self._path, value) - else: - if isinstance(value, Handler): - value = ValueCopy(value) - attr.process_assignment(value, wait) - - @check_protected_paths - def upload(self, value, wait: bool = False) -> None: - """Uploads provided file under specified field path. - - Args: - value (str or File): Path to the file to be uploaded or `File` value object. - wait (bool, optional): If `True` the client will wait to send all tracked metadata to the server. - This makes the call synchronous. - Defaults to `False`. - - Examples: - >>> import neptune.new as neptune - >>> run = neptune.init_run() - - >>> # Upload example data - ... run["dataset/data_sample"].upload("sample_data.csv") - - >>> # Both the content and the extension is stored - ... # When downloaded the filename is a combination of path and the extension - ... run["dataset/data_sample"].download() # data_sample.csv - - Explicitely create File value object - - >>> from neptune.new.types import File - >>> run["dataset/data_sample"].upload(File("sample_data.csv")) - - You may also want to check `upload docs page`_. - - .. _upload docs page: - https://docs.neptune.ai/api/field_types#upload - - """ - value = FileVal.create_from(value) - - with self._container.lock(): - attr = self._container.get_attribute(self._path) - if attr is None: - attr = File(self._container, parse_path(self._path)) - self._container.set_attribute(self._path, attr) - attr.upload(value, wait) - - @check_protected_paths - def upload_files(self, value: Union[str, Iterable[str]], wait: bool = False) -> None: - if is_collection(value): - verify_collection_type("value", value, str) - else: - verify_type("value", value, str) - - with self._container.lock(): - attr = self._container.get_attribute(self._path) - if attr is None: - attr = FileSet(self._container, parse_path(self._path)) - self._container.set_attribute(self._path, attr) - attr.upload_files(value, wait) - - @check_protected_paths - def log( - self, - value, - step: Optional[float] = None, - timestamp: Optional[float] = None, - wait: bool = False, - **kwargs, - ) -> None: - """Logs the provided value or a collection of values. - - Available for following field types (`Field types docs page`_): - * `FloatSeries` - * `StringSeries` - * `FileSeries` - - - Args: - value: Value or collection of values to be added to the field. - step (float or int, optional, default is None): Index of the log entry being appended. - Must be strictly increasing. - Defaults to `None`. - timestamp(float or int, optional): Time index of the log entry being appended in form of Unix time. - If `None` current time (`time.time()`) will be used as a timestamp. - Defaults to `None`. - wait (bool, optional): If `True` the client will wait to send all tracked metadata to the server. - This makes the call synchronous. - Defaults to `False`. - - .. _Field types docs page: - https://docs.neptune.ai/api-reference/field-types - - """ - verify_type("step", step, (int, float, type(None))) - verify_type("timestamp", timestamp, (int, float, type(None))) - - with self._container.lock(): - attr = self._container.get_attribute(self._path) - if attr is None: - if is_collection(value): - if value: - first_value = next(iter(value)) - else: - raise ValueError("Cannot deduce value type: `value` cannot be empty") - else: - first_value = value - - from_stringify_value = False - if is_stringify_value(first_value): - from_stringify_value, first_value = True, first_value.value - - if is_float(first_value): - attr = FloatSeries(self._container, parse_path(self._path)) - elif is_string(first_value): - attr = StringSeries(self._container, parse_path(self._path)) - elif FileVal.is_convertable(first_value): - attr = FileSeries(self._container, parse_path(self._path)) - elif is_float_like(first_value): - attr = FloatSeries(self._container, parse_path(self._path)) - elif is_string_like(first_value): - if not from_stringify_value: - warn_once( - message="The object you're logging will be implicitly cast to a string." - " We'll end support of this behavior in `neptune-client==1.0.0`." - " To log the object as a string, use `.log(str(object))` or" - " `.log(stringify_unsupported(collection))` for collections and dictionaries." - " For details, see https://docs.neptune.ai/setup/neptune-client_1-0_release_changes" - ) - attr = StringSeries(self._container, parse_path(self._path)) - else: - raise TypeError("Value of unsupported type {}".format(type(first_value))) - - self._container.set_attribute(self._path, attr) - attr.log(value, step=step, timestamp=timestamp, wait=wait, **kwargs) - - @check_protected_paths - def append( - self, - value: Union[dict, Any], - step: Optional[float] = None, - timestamp: Optional[float] = None, - wait: bool = False, - **kwargs, - ) -> None: - """Logs a series of values, such as a metric, by appending the provided value to the end of the series. - - Available for following series field types: - - * `FloatSeries` - series of float values - * `StringSeries` - series of strings - * `FileSeries` - series of files - - When you log the first value, the type of the value determines what type of field is created. - For more, see the field types documentation: https://docs.neptune.ai/api/field_types - - Args: - value: Value to be added to the series field. - step: Optional index of the entry being appended. Must be strictly increasing. - timestamp: Optional time index of the log entry being appended, in Unix time format. - If None, the current time (obtained with `time.time()`) is used. - wait: If True, the client sends all tracked metadata to the server before executing the call. - For details, see https://docs.neptune.ai/api/universal/#wait - - Examples: - >>> import neptune.new as neptune - >>> run = neptune.init_run() - >>> for epoch in range(n_epochs): - ... ... # Your training loop - ... run["train/epoch/loss"].append(loss) # FloatSeries - ... token = str(...) - ... run["train/tokens"].append(token) # StringSeries - ... run["train/distribution"].append(plt_histogram, step=epoch) # FileSeries - """ - verify_type("step", step, (int, float, type(None))) - verify_type("timestamp", timestamp, (int, float, type(None))) - if step is not None: - step = [step] - if timestamp is not None: - timestamp = [timestamp] - - value = ExtendUtils.validate_and_transform_to_extend_format(value) - self.extend(value, step, timestamp, wait, **kwargs) - - @check_protected_paths - def extend( - self, - values: ExtendDictT, - steps: Optional[Collection[float]] = None, - timestamps: Optional[Collection[float]] = None, - wait: bool = False, - **kwargs, - ) -> None: - """Logs a series of values by appending the provided collection of values to the end of the series. - - Available for following series field types: - - * `FloatSeries` - series of float values - * `StringSeries` - series of strings - * `FileSeries` - series of files - - When you log the first value, the type of the value determines what type of field is created. - For more, see the field types documentation: https://docs.neptune.ai/api/field_types - - Args: - values: Values to be added to the series field, as a dictionary or collection. - steps: Optional collection of indeces for the entries being appended. Must be strictly increasing. - timestamps: Optional collection of time indeces for the entries being appended, in Unix time format. - If None, the current time (obtained with `time.time()`) is used. - wait: If True, the client sends all tracked metadata to the server before executing the call. - For details, see https://docs.neptune.ai/api/universal/#wait - - Example: - The following example reads a CSV file into a pandas DataFrame and extracts the values - to create a Neptune series. - >>> import neptune.new as neptune - >>> run = neptune.init_run() - >>> for epoch in range(n_epochs): - ... df = pandas.read_csv("time_series.csv") - ... ys = df["value"] - ... ts = df["timestamp"] - ... run["data/example_series"].extend(ys, timestamps=ts) - """ - ExtendUtils.validate_values_for_extend(values, steps, timestamps) - - with self._container.lock(): - attr = self._container.get_attribute(self._path) - if attr is None: - neptune_value = cast_value_for_extend(values) - attr = ValueToAttributeVisitor(self._container, parse_path(self._path)).visit(neptune_value) - self._container.set_attribute(self._path, attr) - - attr.extend(values, steps=steps, timestamps=timestamps, wait=wait, **kwargs) - - @check_protected_paths - def add(self, values: Union[str, Iterable[str]], wait: bool = False) -> None: - """Adds the provided tag or tags to the run's tags. - - Args: - values (str or collection of str): Tag or tags to be added. - .. note:: - If you want you can use emojis in your tags eg. "Exploration 🧪" - wait (bool, optional): If `True` the client will wait to send all tracked metadata to the server first. - This makes the call synchronous. - Defaults to `False`. - - You may also want to check `add docs page`_. - - .. _add types docs page: - https://docs.neptune.ai/api/field_types#add - """ - verify_type("values", values, (str, Iterable)) - with self._container.lock(): - attr = self._container.get_attribute(self._path) - if attr is None: - attr = StringSet(self._container, parse_path(self._path)) - self._container.set_attribute(self._path, attr) - attr.add(values, wait) - - @check_protected_paths - def pop(self, path: str = None, wait: bool = False) -> None: - with self._container.lock(): - handler = self - if path: - verify_type("path", path, str) - handler = self[path] - path = join_paths(self._path, path) - # extra check: check_protected_paths decorator does not catch flow with non-null path - validate_path_not_protected(path, self) - else: - path = self._path - - attribute = self._container.get_attribute(path) - if isinstance(attribute, Namespace): - for child_path in list(attribute): - handler.pop(child_path, wait) - else: - self._container._pop_impl(parse_path(path), wait) - - @check_protected_paths - def remove(self, values: Union[str, Iterable[str]], wait: bool = False) -> None: - """Removes the provided tag or tags from the set. - - Args: - values (str or collection of str): Tag or tags to be removed. - wait (bool, optional): If `True` the client will wait to send all tracked metadata to the server first. - This makes the call synchronous. - Defaults to `False`. - - You may also want to check `remove docs page`_. - - .. _remove docs page: - https://docs.neptune.ai/api/field_types#remove - """ - return self._pass_call_to_attr(function_name="remove", values=values, wait=wait) - - @check_protected_paths - def clear(self, wait: bool = False): - """Removes all tags from the `StringSet`. - - Args: - wait (bool, optional): If `True` the client will wait to send all tracked metadata to the server first. - This makes the call synchronous. - Defaults to `False`. - - You may also want to check `clear docs page`_. - - .. _clear docs page: - https://docs.neptune.ai/api/field_types#clear - """ - return self._pass_call_to_attr(function_name="clear", wait=wait) - - def fetch(self): - """Fetches fields value or in case of a namespace fetches values of all non-File Atom fields as a dictionary. - - Available for following field types (`Field types docs page`_): - * `Integer` - * `Float` - * `Boolean` - * `String` - * `DateTime` - * `StringSet` - * `Namespace handler` - - Returns: - Value stored in the field or in case of a namespace a dictionary containing all non-Atom fields values. - - .. _Field types docs page: - https://docs.neptune.ai/api-reference/field-types - """ - return self._pass_call_to_attr(function_name="fetch") - - def fetch_last(self): - """Fetches last value stored in the series from Neptune servers. - - Available for following field types (`Field types docs page`_): - * `FloatSeries` - * `StringSeries` - - Returns: - Fetches last value stored in the series from Neptune servers. - - .. _Field types docs page: - https://docs.neptune.ai/api-reference/field-types - """ - return self._pass_call_to_attr(function_name="fetch_last") - - def fetch_values(self, include_timestamp: Optional[bool] = True): - """Fetches all values stored in the series from Neptune servers. - - Available for following field types (`Field types docs page`_): - * `FloatSeries` - * `StringSeries` - - Args: - include_timestamp (bool, optional): Whether the fetched data should include the timestamp field. - Defaults to `True`. - - Returns: - ``Pandas.DataFrame``: containing all the values and their indexes stored in the series field. - - .. _Field types docs page: - https://docs.neptune.ai/api-reference/field-types - """ - return self._pass_call_to_attr(function_name="fetch_values", include_timestamp=include_timestamp) - - @check_protected_paths - def delete_files(self, paths: Union[str, Iterable[str]], wait: bool = False) -> None: - """Delete the file or files specified by paths from the `FileSet` stored on the Neptune servers. - - Args: - paths (str or collection of str): `Path` or paths to files or folders to be deleted. - Note that these are paths relative to the FileSet itself e.g. if the `FileSet` contains - file `example.txt`, `varia/notes.txt`, `varia/data.csv` to delete whole subfolder you would pass - varia as the argument. - wait (bool, optional): If `True` the client will wait to send all tracked metadata to the server. - This makes the call synchronous. - Defaults to `None`. - - You may also want to check `delete_files docs page`_. - - .. _delete_files docs page: - https://docs.neptune.ai/api/field_types#delete_files - """ - return self._pass_call_to_attr(function_name="delete_files", paths=paths, wait=wait) - - @check_protected_paths - def download(self, destination: str = None) -> None: - """Downloads the stored file or files to the working directory or specified destination. - - Available for following field types (`Field types docs page`_): - * `File` - * `FileSeries` - * `FileSet` - * `Artifact` - - Args: - destination (str, optional): Path to where the file(s) should be downloaded. - If `None` file will be downloaded to the working directory. - If `destination` is a directory, the file will be downloaded to the specified directory with a filename - composed from field name and extension (if present). - If `destination` is a path to a file, the file will be downloaded under the specified name. - Defaults to `None`. - - .. _Field types docs page: - https://docs.neptune.ai/api-reference/field-types - """ - return self._pass_call_to_attr(function_name="download", destination=destination) - - def download_last(self, destination: str = None) -> None: - """Downloads the stored file or files to the working directory or specified destination. - - Args: - destination (str, optional): Path to where the file(s) should be downloaded. - If `None` file will be downloaded to the working directory. - If `destination` is a directory, the file will be downloaded to the specified directory with a filename - composed from field name and extension (if present). - If `destination` is a path to a file, the file will be downloaded under the specified name. - Defaults to `None`. - - You may also want to check `download_last docs page`_. - - .. _download_last docs page: - https://docs.neptune.ai/api/field_types#download_last - """ - return self._pass_call_to_attr(function_name="download_last", destination=destination) - - def fetch_hash(self) -> str: - """Fetches the hash of an artifact. - - You may also want to check `fetch_hash docs page`_. - https://docs.neptune.ai/api/field_types#fetch_hash - """ - return self._pass_call_to_attr(function_name="fetch_hash") - - def fetch_extension(self) -> str: - """Fetches the extension of a file. - - You may also want to check `fetch_extension docs page`_. - https://docs.neptune.ai/api/field_types#fetch_extension - """ - return self._pass_call_to_attr(function_name="fetch_extension") - - def fetch_files_list(self) -> List[ArtifactFileData]: - """Fetches the list of files in an artifact and their metadata. - - You may also want to check `fetch_files_list docs page`_. - https://docs.neptune.ai/api/field_types#fetch_files_list - """ - return self._pass_call_to_attr(function_name="fetch_files_list") - - def _pass_call_to_attr(self, function_name, **kwargs): - return getattr(self._get_attribute(), function_name)(**kwargs) - - @check_protected_paths - def track_files(self, path: str, destination: str = None, wait: bool = False) -> None: - """Creates an artifact tracking some files. - - You may also want to check `track_files docs page`_. - https://docs.neptune.ai/api/field_types#track_files - """ - with self._container.lock(): - attr = self._container.get_attribute(self._path) - if attr is None: - attr = Artifact(self._container, parse_path(self._path)) - self._container.set_attribute(self._path, attr) - - attr.track_files(path=path, destination=destination, wait=wait) - - def __delitem__(self, path) -> None: - self.pop(path) - - -class ExtendUtils: - @staticmethod - def validate_and_transform_to_extend_format(value): - """Preserve nested structure created by `Namespaces` and `dict_like` objects, - but replace all other values with single-element lists, - so work can be delegated to `extend` method.""" - if isinstance(value, Namespace) or is_dict_like(value): - return {k: ExtendUtils.validate_and_transform_to_extend_format(v) for k, v in value.items()} - elif is_collection(value): - raise NeptuneUserApiInputException( - "Value cannot be a collection, if you want to `append` multiple values at once use `extend` method." - ) - else: - return [value] - - @staticmethod - def validate_values_for_extend(values, steps, timestamps): - """Validates if input data is a collection or Namespace with collections leafs. - If steps or timestamps are passed, check if its length is equal to all given values.""" - collections_lengths = set(ExtendUtils.generate_leaf_collection_lengths(values)) - - if len(collections_lengths) > 1: - if steps is not None: - raise NeptuneUserApiInputException("Number of steps must be equal to number of values") - if timestamps is not None: - raise NeptuneUserApiInputException("Number of timestamps must be equal to number of values") - else: - common_collections_length = next(iter(collections_lengths)) - if steps is not None and common_collections_length != len(steps): - raise NeptuneUserApiInputException("Number of steps must be equal to number of values") - if timestamps is not None and common_collections_length != len(timestamps): - raise NeptuneUserApiInputException("Number of timestamps must be equal to number of values") - - @staticmethod - def generate_leaf_collection_lengths(values) -> Iterator[int]: - if isinstance(values, Namespace) or is_dict_like(values): - for val in values.values(): - yield from ExtendUtils.generate_leaf_collection_lengths(val) - elif is_collection(values): - yield len(values) - else: - raise NeptuneUserApiInputException("Values must be a collection or Namespace leafs must be collections") +from neptune.handler import Handler From 3b8df3a732a51bfe6ed5fd65070d5398c8b7f129 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 13:40:47 +0100 Subject: [PATCH 04/33] Exceptions moved to root module --- src/neptune/exceptions.py | 1198 +++++++++++++++++++++++++++++++++ src/neptune/new/exceptions.py | 1160 ++----------------------------- 2 files changed, 1264 insertions(+), 1094 deletions(-) create mode 100644 src/neptune/exceptions.py diff --git a/src/neptune/exceptions.py b/src/neptune/exceptions.py new file mode 100644 index 000000000..3e65e575f --- /dev/null +++ b/src/neptune/exceptions.py @@ -0,0 +1,1198 @@ +# +# Copyright (c) 2022, Neptune Labs Sp. z o.o. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__all__ = [ + "InternalClientError", + "NeptuneException", + "NeptuneInvalidApiTokenException", + "NeptuneApiException", + "MetadataInconsistency", + "MissingFieldException", + "TypeDoesNotSupportAttributeException", + "MalformedOperation", + "FileNotFound", + "FileUploadError", + "FileSetUploadError", + "ClientHttpError", + "MetadataContainerNotFound", + "ProjectNotFound", + "RunNotFound", + "ModelNotFound", + "ModelVersionNotFound", + "ExceptionWithProjectsWorkspacesListing", + "ContainerUUIDNotFound", + "RunUUIDNotFound", + "ProjectNotFoundWithSuggestions", + "AmbiguousProjectName", + "NeptuneMissingProjectNameException", + "InactiveContainerException", + "InactiveRunException", + "InactiveModelException", + "InactiveModelVersionException", + "InactiveProjectException", + "NeptuneMissingApiTokenException", + "CannotSynchronizeOfflineRunsWithoutProject", + "NeedExistingExperimentForReadOnlyMode", + "NeedExistingRunForReadOnlyMode", + "NeedExistingModelForReadOnlyMode", + "NeedExistingModelVersionForReadOnlyMode", + "NeptuneParametersCollision", + "NeptuneWrongInitParametersException", + "NeptuneRunResumeAndCustomIdCollision", + "NeptuneClientUpgradeRequiredError", + "NeptuneMissingRequiredInitParameter", + "CannotResolveHostname", + "NeptuneSSLVerificationError", + "NeptuneConnectionLostException", + "InternalServerError", + "Unauthorized", + "Forbidden", + "NeptuneOfflineModeException", + "NeptuneOfflineModeFetchException", + "NeptuneOfflineModeChangeStageException", + "NeptuneProtectedPathException", + "NeptuneCannotChangeStageManually", + "OperationNotSupported", + "NeptuneLegacyProjectException", + "NeptuneUninitializedException", + "NeptuneIntegrationNotInstalledException", + "NeptuneLimitExceedException", + "NeptuneFieldCountLimitExceedException", + "NeptuneStorageLimitException", + "FetchAttributeNotFoundException", + "ArtifactNotFoundException", + "PlotlyIncompatibilityException", + "NeptunePossibleLegacyUsageException", + "NeptuneLegacyIncompatibilityException", + "NeptuneUnhandledArtifactSchemeException", + "NeptuneUnhandledArtifactTypeException", + "NeptuneLocalStorageAccessException", + "NeptuneRemoteStorageCredentialsException", + "NeptuneRemoteStorageAccessException", + "ArtifactUploadingError", + "NeptuneUnsupportedArtifactFunctionalityException", + "NeptuneEmptyLocationException", + "NeptuneFeatureNotAvailableException", + "NeptuneObjectCreationConflict", + "NeptuneModelKeyAlreadyExistsError", + "NeptuneSynchronizationAlreadyStoppedException", + "StreamAlreadyUsedException", +] + +from typing import ( + List, + Optional, + Union, +) +from urllib.parse import urlparse + +from packaging.version import Version + +from neptune.common.envs import API_TOKEN_ENV_NAME + +# Backward compatibility import +from neptune.common.exceptions import ( + STYLES, + ClientHttpError, + Forbidden, + InternalClientError, + InternalServerError, + NeptuneApiException, + NeptuneConnectionLostException, + NeptuneException, + NeptuneInvalidApiTokenException, + NeptuneSSLVerificationError, + Unauthorized, +) +from neptune.new import envs +from neptune.new.envs import CUSTOM_RUN_ID_ENV_NAME +from neptune.new.internal.backends.api_model import ( + Project, + Workspace, +) +from neptune.new.internal.container_type import ContainerType +from neptune.new.internal.id_formats import QualifiedName +from neptune.new.internal.utils import replace_patch_version + + +class MetadataInconsistency(NeptuneException): + pass + + +class MissingFieldException(NeptuneException, AttributeError, KeyError): + """Raised when get-like action is called on `Handler`, instead of on `Attribute`.""" + + def __init__(self, field_path): + message = """ +{h1} +----MissingFieldException------------------------------------------------------- +{end} +The field "{field_path}" was not found. + +There are two possible reasons: + - There is a typo in a path. Double-check your code for typos. + - You are fetching a field that another process created, but the local representation is not synchronized. + If you are sending metadata from multiple processes at the same time, synchronize the local representation before fetching values: + {python}run.sync(){end} + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" # noqa: E501 + self._msg = message.format(field_path=field_path, **STYLES) + super().__init__(self._msg) + + def __str__(self): + # required because of overriden `__str__` in `KeyError` + return self._msg + + +class TypeDoesNotSupportAttributeException(NeptuneException, AttributeError): + def __init__(self, type_, attribute): + message = """ +{h1} +----TypeDoesNotSupportAttributeException---------------------------------------- +{end} +{type} has no attribute {attribute}. + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + self._msg = message.format(type=type_, attribute=attribute, **STYLES) + super().__init__(self._msg) + + def __str__(self): + # required because of overriden `__str__` in `KeyError` + return self._msg + + +class MalformedOperation(NeptuneException): + pass + + +class FileNotFound(NeptuneException): + def __init__(self, file: str): + super().__init__("File not found: {}".format(file)) + + +class FileUploadError(NeptuneException): + def __init__(self, filename: str, msg: str): + super().__init__("Cannot upload file {}: {}".format(filename, msg)) + + +class FileSetUploadError(NeptuneException): + def __init__(self, globs: List[str], msg: str): + super().__init__("Cannot upload file set {}: {}".format(globs, msg)) + + +class MetadataContainerNotFound(NeptuneException): + container_id: str + container_type: ContainerType + + def __init__(self, container_id: str, container_type: Optional[ContainerType]): + self.container_id = container_id + self.container_type = container_type + container_type_str = container_type.value.capitalize() if container_type else "object" + super().__init__("{} {} not found.".format(container_type_str, container_id)) + + @classmethod + def of_container_type(cls, container_type: Optional[ContainerType], container_id: str): + if container_type is None: + return MetadataContainerNotFound(container_id=container_id, container_type=None) + elif container_type == ContainerType.PROJECT: + return ProjectNotFound(project_id=container_id) + elif container_type == ContainerType.RUN: + return RunNotFound(run_id=container_id) + elif container_type == ContainerType.MODEL: + return ModelNotFound(model_id=container_id) + elif container_type == ContainerType.MODEL_VERSION: + return ModelVersionNotFound(model_version_id=container_id) + else: + raise InternalClientError(f"Unexpected ContainerType: {container_type}") + + +class ProjectNotFound(MetadataContainerNotFound): + def __init__(self, project_id: str): + super().__init__(container_id=project_id, container_type=ContainerType.PROJECT) + + +class RunNotFound(MetadataContainerNotFound): + def __init__(self, run_id: str): + super().__init__(container_id=run_id, container_type=ContainerType.RUN) + + +class ModelNotFound(MetadataContainerNotFound): + def __init__(self, model_id: str): + super().__init__(container_id=model_id, container_type=ContainerType.MODEL) + + +class ModelVersionNotFound(MetadataContainerNotFound): + def __init__(self, model_version_id: str): + super().__init__(container_id=model_version_id, container_type=ContainerType.MODEL_VERSION) + + +class ExceptionWithProjectsWorkspacesListing(NeptuneException): + def __init__( + self, + message: str, + available_projects: List[Project] = (), + available_workspaces: List[Workspace] = (), + **kwargs, + ): + available_projects_message = """ +Did you mean any of these? +{projects} +""" + + available_workspaces_message = """ +You can check all of your projects on the Projects page: +{workspaces_urls} +""" + + projects_formated_list = "\n".join( + map( + lambda project: f" - {project.workspace}/{project.name}", + available_projects, + ) + ) + + workspaces_formated_list = "\n".join( + map( + lambda workspace: f" - https://app.neptune.ai/{workspace.name}/-/projects", + available_workspaces, + ) + ) + + super().__init__( + message.format( + available_projects_message=available_projects_message.format(projects=projects_formated_list) + if available_projects + else "", + available_workspaces_message=available_workspaces_message.format( + workspaces_urls=workspaces_formated_list + ) + if available_workspaces + else "", + **STYLES, + **kwargs, + ) + ) + + +class ContainerUUIDNotFound(NeptuneException): + container_id: str + container_type: ContainerType + + def __init__(self, container_id: str, container_type: ContainerType): + self.container_id = container_id + self.container_type = container_type + super().__init__( + "{} with ID {} not found. It may have been deleted. " + "You can use the 'neptune clear' command to delete junk objects from local storage.".format( + container_type.value.capitalize(), container_id + ) + ) + + +# for backward compatibility +RunUUIDNotFound = ContainerUUIDNotFound + + +class ProjectNotFoundWithSuggestions(ExceptionWithProjectsWorkspacesListing, ProjectNotFound): + def __init__( + self, + project_id: QualifiedName, + available_projects: List[Project] = (), + available_workspaces: List[Workspace] = (), + ): + message = """ +{h1} +----NeptuneProjectNotFoundException------------------------------------ +{end} +We couldn't find project {fail}"{project}"{end}. +{available_projects_message}{available_workspaces_message} +You may want to check the following docs page: + - https://docs.neptune.ai/setup/creating_project/ + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__( + message=message, + available_projects=available_projects, + available_workspaces=available_workspaces, + project=project_id, + ) + + +class AmbiguousProjectName(ExceptionWithProjectsWorkspacesListing): + def __init__(self, project_id: str, available_projects: List[Project] = ()): + message = """ +{h1} +----NeptuneProjectNameCollisionException------------------------------------ +{end} +Cannot resolve project {fail}"{project}"{end}. Name is ambiguous. +{available_projects_message} +You may also want to check the following docs pages: + - https://docs.neptune.ai/setup/creating_project/ + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__(message=message, available_projects=available_projects, project=project_id) + + +class NeptuneMissingProjectNameException(ExceptionWithProjectsWorkspacesListing): + def __init__( + self, + available_projects: List[Project] = (), + available_workspaces: List[Workspace] = (), + ): + message = """ +{h1} +----NeptuneMissingProjectNameException---------------------------------------- +{end} +The Neptune client couldn't find your project name. +{available_projects_message}{available_workspaces_message} +There are two options two add it: + - specify it in your code + - set an environment variable in your operating system. + +{h2}CODE{end} +Pass it to the {bold}init(){end} method via the {bold}project{end} argument: + {python}neptune.init_run(project='WORKSPACE_NAME/PROJECT_NAME'){end} + +{h2}ENVIRONMENT VARIABLE{end} +or export or set an environment variable depending on your operating system: + + {correct}Linux/Unix{end} + In your terminal run: + {bash}export {env_project}=WORKSPACE_NAME/PROJECT_NAME{end} + + {correct}Windows{end} + In your CMD run: + {bash}set {env_project}=WORKSPACE_NAME/PROJECT_NAME{end} + +and skip the {bold}project{end} argument of the {bold}init(){end} method: + {python}neptune.init_run(){end} + +You may also want to check the following docs pages: + - https://docs.neptune.ai/setup/creating_project/ + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__( + message=message, + available_projects=available_projects, + available_workspaces=available_workspaces, + env_project=envs.PROJECT_ENV_NAME, + ) + + +class InactiveContainerException(NeptuneException): + resume_info: str + + def __init__(self, container_type: ContainerType, label: str): + message = """ +{h1} +----{cls}---------------------------------------- +{end} +It seems you are trying to log metadata to (or fetch it from) a {container_type} that was stopped ({label}). + +Here's what you can do:{resume_info} + +You may also want to check the following docs pages: + - https://docs.neptune.ai/logging/to_existing_object/ + - https://docs.neptune.ai/usage/querying_metadata/ + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__( + message.format( + cls=self.__class__.__name__, + label=label, + container_type=container_type.value, + resume_info=self.resume_info, + **STYLES, + ) + ) + + +class InactiveRunException(InactiveContainerException): + resume_info = """ + - Resume the run to continue logging to it: + https://docs.neptune.ai/logging/to_existing_object/ + - Don't invoke `stop()` on a run that you want to access. If you want to stop monitoring only, + you can resume a run in read-only mode: + https://docs.neptune.ai/api/connection_modes/#read-only-mode""" + + def __init__(self, label: str): + super().__init__(label=label, container_type=ContainerType.RUN) + + +class InactiveModelException(InactiveContainerException): + resume_info = """ + - Resume the model to continue logging to it: + https://docs.neptune.ai/api/neptune/#init_model + - Don't invoke `stop()` on a model that you want to access. If you want to stop monitoring only, + you can resume a model in read-only mode: + https://docs.neptune.ai/api/connection_modes/#read-only-mode""" + + def __init__(self, label: str): + super().__init__(label=label, container_type=ContainerType.MODEL) + + +class InactiveModelVersionException(InactiveContainerException): + resume_info = """ + - Resume the model version to continue logging to it: + https://docs.neptune.ai/api/neptune/#init_model_version + - Don't invoke `stop()` on a model version that you want to access. If you want to stop monitoring only, + you can resume a model version in read-only mode: + https://docs.neptune.ai/api/connection_modes/#read-only-mode""" + + def __init__(self, label: str): + super().__init__(label=label, container_type=ContainerType.MODEL_VERSION) + + +class InactiveProjectException(InactiveContainerException): + resume_info = """ + - Resume the connection to the project to continue logging to it: + https://docs.neptune.ai/api/neptune/#init_project + - Don't invoke `stop()` on a project that you want to access.""" + + def __init__(self, label: str): + super().__init__(label=label, container_type=ContainerType.PROJECT) + + +class NeptuneMissingApiTokenException(NeptuneException): + def __init__(self): + message = """ +{h1} +----NeptuneMissingApiTokenException------------------------------------------- +{end} +The Neptune client couldn't find your API token. + +You can get it here: + - https://app.neptune.ai/get_my_api_token + +There are two options to add it: + - specify it in your code + - set an environment variable in your operating system. + +{h2}CODE{end} +Pass the token to the {bold}init(){end} method via the {bold}api_token{end} argument: + {python}neptune.init_run(project='WORKSPACE_NAME/PROJECT_NAME', api_token='YOUR_API_TOKEN'){end} + +{h2}ENVIRONMENT VARIABLE{end} {correct}(Recommended option){end} +or export or set an environment variable depending on your operating system: + + {correct}Linux/Unix{end} + In your terminal run: + {bash}export {env_api_token}="YOUR_API_TOKEN"{end} + + {correct}Windows{end} + In your CMD run: + {bash}set {env_api_token}="YOUR_API_TOKEN"{end} + +and skip the {bold}api_token{end} argument of the {bold}init(){end} method: + {python}neptune.init_run(project='WORKSPACE_NAME/PROJECT_NAME'){end} + +You may also want to check the following docs pages: + - https://docs.neptune.ai/setup/setting_api_token/ + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__(message.format(env_api_token=API_TOKEN_ENV_NAME, **STYLES)) + + +class CannotSynchronizeOfflineRunsWithoutProject(NeptuneException): + def __init__(self): + super().__init__("Cannot synchronize offline runs without a project.") + + +class NeedExistingExperimentForReadOnlyMode(NeptuneException): + container_type: ContainerType + callback_name: str + + def __init__(self, container_type: ContainerType, callback_name: str): + message = """ +{h1} +----{class_name}----------------------------------------- +{end} +Read-only mode can be used only with an existing {container_type}. + +The {python}{container_type}{end} parameter of {python}{callback_name}{end} must be provided and reference +an existing run when using {python}mode="read-only"{end}. + +You may also want to check the following docs pages: + - https://docs.neptune.ai/logging/to_existing_object/ + - https://docs.neptune.ai/api/connection_modes/#read-only-mode + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + self.container_type = container_type + self.callback_name = callback_name + super().__init__( + message.format( + class_name=type(self).__name__, + container_type=self.container_type.value, + callback_name=self.callback_name, + **STYLES, + ) + ) + + +class NeedExistingRunForReadOnlyMode(NeedExistingExperimentForReadOnlyMode): + def __init__(self): + super().__init__(container_type=ContainerType.RUN, callback_name="neptune.init_run") + + +class NeedExistingModelForReadOnlyMode(NeedExistingExperimentForReadOnlyMode): + def __init__(self): + super().__init__(container_type=ContainerType.MODEL, callback_name="neptune.init_model") + + +class NeedExistingModelVersionForReadOnlyMode(NeedExistingExperimentForReadOnlyMode): + def __init__(self): + super().__init__( + container_type=ContainerType.MODEL_VERSION, + callback_name="neptune.init_model_version", + ) + + +class NeptuneParametersCollision(NeptuneException): + def __init__(self, parameter1, parameter2, method_name): + self.parameter1 = parameter1 + self.parameter2 = parameter2 + self.method_name = method_name + message = """ +{h1} +----NeptuneParametersCollision----------------------------------------- +{end} +The {python}{parameter1}{end} and {python}{parameter2}{end} parameters of the {python}{method_name}(){end} method are mutually exclusive. + +You may also want to check the following docs page: + - https://docs.neptune.ai/api/universal/#initialization-methods + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" # noqa: E501 + super().__init__( + message.format( + parameter1=parameter1, + parameter2=parameter2, + method_name=method_name, + **STYLES, + ) + ) + + +class NeptuneWrongInitParametersException(NeptuneException): + pass + + +class NeptuneRunResumeAndCustomIdCollision(NeptuneWrongInitParametersException): + def __init__(self): + message = """ +{h1} +----NeptuneRunResumeAndCustomIdCollision----------------------------------------- +{end} +It's not possible to use {python}custom_run_id{end} while resuming a run. + +The {python}run{end} and {python}custom_run_id{end} parameters of the {python}init_run(){end} method are mutually exclusive. +Make sure you have no {bash}{custom_id_env}{end} environment variable set +and no value is explicitly passed to the `custom_run_id` argument when you are resuming a run. + +You may also want to check the following docs page: + - https://docs.neptune.ai/logging/to_existing_object/ + - https://docs.neptune.ai/logging/custom_run_id/ + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" # noqa: E501 + super().__init__(message.format(custom_id_env=CUSTOM_RUN_ID_ENV_NAME, **STYLES)) + + +class NeptuneClientUpgradeRequiredError(NeptuneException): + def __init__( + self, + version: Union[Version, str], + min_version: Optional[Union[Version, str]] = None, + max_version: Optional[Union[Version, str]] = None, + ): + current_version = str(version) + required_version = "==" + replace_patch_version(str(max_version)) if max_version else ">=" + str(min_version) + message = """ +{h1} +----NeptuneClientUpgradeRequiredError------------------------------------------------------------- +{end} +Your version of the Neptune client library ({current_version}) is no longer supported by the Neptune + server. The minimum required version is {required_version}. + +In order to update the Neptune client library, run the following command in your terminal: + {bash}pip install -U neptune-client{end} +Or if you are using Conda, run the following instead: + {bash}conda update -c conda-forge neptune-client{end} + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__( + message.format( + current_version=current_version, + required_version=required_version, + **STYLES, + ) + ) + + +class NeptuneMissingRequiredInitParameter(NeptuneWrongInitParametersException): + def __init__( + self, + called_function: str, + parameter_name: str, + ): + message = """ +{h1} +----NeptuneMissingRequiredInitParameter--------------------------------------- +{end} +{python}neptune.{called_function}(){end} invocation was missing {python}{parameter_name}{end}. +If you want to create a new object using {python}{called_function}{end}, {python}{parameter_name}{end} is required: +https://docs.neptune.ai/api/neptune#{called_function} + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__( + message.format( + called_function=called_function, + parameter_name=parameter_name, + **STYLES, + ) + ) + + +class CannotResolveHostname(NeptuneException): + def __init__(self, host): + message = """ +{h1} +----CannotResolveHostname----------------------------------------------------------------------- +{end} +The Neptune client library was not able to resolve hostname {underline}{host}{end}. + +What should I do? + - Check if your computer is connected to the internet. + - Check if your computer is supposed to be using a proxy to access the internet. + If so, you may want to use the {python}proxies{end} parameter of the {python}init(){end} method. + See https://docs.neptune.ai/api/universal/#proxies + and https://requests.readthedocs.io/en/latest/user/advanced/#proxies + - Check the status of Neptune services: https://status.neptune.ai/ + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__(message.format(host=host, **STYLES)) + + +class NeptuneOfflineModeException(NeptuneException): + pass + + +class NeptuneOfflineModeFetchException(NeptuneOfflineModeException): + def __init__(self): + message = """ +{h1} +----NeptuneOfflineModeFetchException--------------------------------------------------- +{end} +It seems you are trying to fetch data from the server while working in offline mode. +You need to work in a non-offline connection mode to fetch data from the server. + +You can set the connection mode when creating a new run: + {python}run = neptune.init_run(mode="async"){end} + +You may also want to check the following docs page: + - https://docs.neptune.ai/api/connection_modes + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__(message.format(**STYLES)) + + +class NeptuneOfflineModeChangeStageException(NeptuneOfflineModeException): + def __init__(self): + message = """ +{h1} +----NeptuneOfflineModeChangeStageException--------------------------------------- +{end} +You cannot change the stage of the model version while in offline mode. +""" + super().__init__(message.format(**STYLES)) + + +class NeptuneProtectedPathException(NeptuneException): + extra_info = "" + + def __init__(self, path: str): + message = """ +{h1} +----NeptuneProtectedPathException---------------------------------------------- +{end} +Field {path} cannot be changed directly. +{extra_info} + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + self._path = path + super().__init__( + message.format( + path=path, + extra_info=self.extra_info.format(**STYLES), + **STYLES, + ) + ) + + +class NeptuneCannotChangeStageManually(NeptuneProtectedPathException): + extra_info = """ +If you want to change the stage of the model version, +use the {python}.change_stage(){end} method: + {python}model_version.change_stage("staging"){end}""" + + +class OperationNotSupported(NeptuneException): + 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 NeptuneUninitializedException(NeptuneException): + def __init__(self): + message = """ +{h1} +----NeptuneUninitializedException---------------------------------------------------- +{end} +You must initialize the Neptune client library before you can access `get_last_run`. + +Looks like you forgot to add: + {python}neptune.init_run(project='WORKSPACE_NAME/PROJECT_NAME', api_token='YOUR_API_TOKEN'){end} + +before you ran: + {python}neptune.get_last_run(){end} + +You may also want to check the following docs page: + - https://docs.neptune.ai/api/neptune/#get_last_run + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__(message.format(**STYLES)) + + +class NeptuneIntegrationNotInstalledException(NeptuneException): + def __init__(self, integration_package_name, framework_name): + message = """ +{h1} +----NeptuneIntegrationNotInstalledException----------------------------------------- +{end} +Looks like integration {integration_package_name} wasn't installed. +To install, run: + {bash}pip install {integration_package_name}{end} +Or: + {bash}pip install "neptune-client[{framework_name}]"{end} + +You may also want to check the following docs page: + - https://docs.neptune.ai/integrations + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__( + message.format( + integration_package_name=integration_package_name, + framework_name=framework_name, + **STYLES, + ) + ) + + +class NeptuneLimitExceedException(NeptuneException): + def __init__(self, reason: str): + message = """ +{h1} +----NeptuneLimitExceedException--------------------------------------------------------------------------------------- +{end} +{reason} + +It's not possible to upload new data, but you can still fetch and delete data. +If you are using asynchronous (default) connection mode, Neptune automatically switched to offline mode +and your data is being stored safely on the disk. You can upload it later using the Neptune Command Line Interface tool: + {bash}neptune sync -p project_name{end} +What should I do? + - In case of storage limitations, go to your projects and remove runs or model metadata you don't need + - ... or update your subscription plan here: https://app.neptune.ai/-/subscription +You may also want to check the following docs page: + - https://docs.neptune.ai/api/connection_modes/ +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__(message.format(**STYLES, reason=reason)) + + +class NeptuneFieldCountLimitExceedException(NeptuneException): + def __init__(self, limit: int, container_type: str, identifier: str): + message = """ +{h1} +----NeptuneFieldCountLimitExceedException--------------------------------------------------------------------------------------- +{end} +There are too many fields (more than {limit}) in the {identifier} {container_type}. +We have stopped the synchronization to the Neptune server and stored the data locally. + +To continue uploading the metadata: + + 1. Delete some excess fields from {identifier}. + + You can delete fields or namespaces with the "del" command. + For example, to delete the "training/checkpoints" namespace: + + {python}del run["training/checkpoints"]{end} + + 2. Once you're done, synchronize the data manually with the following command: + + {bash}neptune sync -p project_name{end} + +For more details, see https://docs.neptune.ai/usage/best_practices +""" # noqa: E501 + super().__init__( + message.format( + **STYLES, + limit=limit, + container_type=container_type, + identifier=identifier, + ) + ) + + +class NeptuneStorageLimitException(NeptuneException): + def __init__(self): + message = """ +{h1} +----NeptuneStorageLimitException--------------------------------------------------------------------------------------- +{end} +You exceeded the storage limit of the workspace. It's not possible to upload new data, but you can still fetch and delete data. +If you are using asynchronous (default) connection mode, Neptune automatically switched to offline mode +and your data is being stored safely on the disk. You can upload it later using the Neptune Command Line Interface tool: + {bash}neptune sync -p project_name{end} +What should I do? + - Go to your projects and remove runs or model metadata you don't need + - ... or update your subscription plan here: https://app.neptune.ai/-/subscription +You may also want to check the following docs page: + - https://docs.neptune.ai/api/connection_modes +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" # noqa: E501 + super().__init__(message.format(**STYLES)) + + +class FetchAttributeNotFoundException(MetadataInconsistency): + def __init__(self, attribute_path: str): + message = """ +{h1} +----MetadataInconsistency---------------------------------------------------------------------- +{end} +The field {python}{attribute_path}{end} was not found. + +Remember that in the asynchronous (default) connection mode, data is synchronized +with the Neptune servers in the background. The data may have not reached +the servers before it was fetched. Before fetching the data, you can force +wait for all the requests sent by invoking: + + {python}run.wait(){end} + +Remember that each use of {python}wait{end} introduces a delay in code execution. + +You may also want to check the following docs page: + - https://docs.neptune.ai/api/connection_modes + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help.html +""" + super().__init__(message.format(attribute_path=attribute_path, **STYLES)) + + +class ArtifactNotFoundException(MetadataInconsistency): + def __init__(self, artifact_hash: str): + message = """ +{h1} +----MetadataInconsistency---------------------------------------------------------------------- +{end} +Artifact with hash {python}{artifact_hash}{end} was not found. + +Remember that in the asynchronous (default) connection mode, data is synchronized +with the Neptune servers in the background. The data may have not reached +the servers before it was fetched. Before fetching the data, you can force +wait for all the requests sent by invoking: + + {python}run.wait(){end} + +Remember that each use of {python}wait{end} introduces a delay in code execution. + +You may also want to check the following docs page: + - https://docs.neptune.ai/api/connection_modes + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help.html +""" + super().__init__(message.format(artifact_hash=artifact_hash, **STYLES)) + + +class PlotlyIncompatibilityException(Exception): + def __init__(self, matplotlib_version, plotly_version, details): + super().__init__( + "Unable to convert plotly figure to matplotlib format. " + "Your matplotlib ({}) and plotlib ({}) versions are not compatible. " + "{}".format(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 + message = """ +{h1} +----NeptuneUnhandledArtifactProtocolException------------------------------------ +{end} +You have used a Neptune Artifact to track a file with a scheme unhandled by this client ({scheme}). +Problematic path: {path} + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__(message.format(scheme=scheme, path=path, **STYLES)) + + +class NeptuneUnhandledArtifactTypeException(NeptuneException): + def __init__(self, type_str: str): + message = """ +{h1} +----NeptuneUnhandledArtifactTypeException---------------------------------------- +{end} +A Neptune Artifact you're listing is tracking a file type unhandled by this client ({type_str}). + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__(message.format(type_str=type_str, **STYLES)) + + +class NeptuneLocalStorageAccessException(NeptuneException): + def __init__(self, path, expected_description): + message = """ +{h1} +----NeptuneLocalStorageAccessException------------------------------------- +{end} +Neptune had a problem processing "{path}". It expects it to be {expected_description}. + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__(message.format(path=path, expected_description=expected_description, **STYLES)) + + +class NeptuneRemoteStorageCredentialsException(NeptuneException): + def __init__(self): + message = """ +{h1} +----NeptuneRemoteStorageCredentialsException------------------------------------- +{end} +Neptune could not find suitable credentials for remote storage of a Neptune Artifact you're listing. + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__(message.format(**STYLES)) + + +class NeptuneRemoteStorageAccessException(NeptuneException): + def __init__(self, location: str): + message = """ +{h1} +----NeptuneRemoteStorageAccessException------------------------------------------ +{end} +Neptune could not access an object ({location}) from remote storage of a Neptune Artifact you're listing. + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__(message.format(location=location, **STYLES)) + + +class ArtifactUploadingError(NeptuneException): + def __init__(self, msg: str): + super().__init__("Cannot upload artifact: {}".format(msg)) + + +class NeptuneUnsupportedArtifactFunctionalityException(NeptuneException): + def __init__(self, functionality_info: str): + message = """ +{h1} +----NeptuneUnsupportedArtifactFunctionality------------------------------------- +{end} +It seems you are using Neptune Artifacts functionality that is currently not supported. + +{functionality_info} + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__(message.format(functionality_info=functionality_info, **STYLES)) + + +class NeptuneEmptyLocationException(NeptuneException): + def __init__(self, location: str, namespace: str): + message = """ +{h1} +----NeptuneEmptyLocationException---------------------------------------------- +{end} +Neptune could not find files in the requested location ({location}) during the creation of an Artifact in "{namespace}". + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__(message.format(location=location, namespace=namespace, **STYLES)) + + +class NeptuneFeatureNotAvailableException(NeptuneException): + def __init__(self, missing_feature): + message = """ +{h1} +----NeptuneFeatureNotAvailableException---------------------------------------------- +{end} +The following feature is not yet supported by the Neptune instance you are using: +{missing_feature} + +An update of the Neptune instance is required in order to use it. Please contact your local Neptune administrator +or Neptune support directly (support@neptune.ai) about the upcoming updates. + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + self.message = message.format(missing_feature=missing_feature, **STYLES) + super().__init__(message) + + +class NeptuneObjectCreationConflict(NeptuneException): + pass + + +class NeptuneModelKeyAlreadyExistsError(NeptuneObjectCreationConflict): + def __init__(self, model_key, models_tab_url): + message = """ +{h1} +----NeptuneModelKeyAlreadyExistsError--------------------------------------------------- +{end} +A model with the provided key ({model_key}) already exists in this project. A model key has to be unique +within the project. + +You can check all of your models in the project on the Models page: +{models_tab_url} + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__(message.format(model_key=model_key, models_tab_url=models_tab_url, **STYLES)) + + +class NeptuneSynchronizationAlreadyStoppedException(NeptuneException): + def __init__(self): + message = """ +{h1} +----NeptuneSynchronizationAlreadyStopped--------------------------------------------------- +{end} +The synchronization thread had stopped before Neptune could finish uploading the logged metadata. +Your data is stored locally, but you'll need to finish the synchronization manually. +To synchronize with the Neptune servers, enter the following on your command line: + + {bash}neptune sync{end} + +For details, see https://docs.neptune.ai/api/neptune_sync/ + +If the synchronization fails, you may want to check your connection and ensure that you're +within limits by going to your Neptune project settings -> Usage. +If the issue persists, our support is happy to help. + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__(message.format(**STYLES)) + + +class StreamAlreadyUsedException(NeptuneException): + def __init__(self): + message = """ +{h1} +----StreamAlreadyUsedException--------------------------------------------------- +{end} +A File object created with File.from_stream() has already been logged. +You can only log content from the same stream once. + +For more, see https://docs.neptune.ai/api/field_types/#from_stream + +{correct}Need help?{end}-> https://docs.neptune.ai/getting_help +""" + super().__init__(message.format(**STYLES)) + + +class NeptuneUserApiInputException(NeptuneException): + def __init__(self, message): + super().__init__(message) diff --git a/src/neptune/new/exceptions.py b/src/neptune/new/exceptions.py index 3e65e575f..a348ac648 100644 --- a/src/neptune/new/exceptions.py +++ b/src/neptune/new/exceptions.py @@ -91,1108 +91,80 @@ "StreamAlreadyUsedException", ] -from typing import ( - List, - Optional, - Union, -) -from urllib.parse import urlparse - -from packaging.version import Version - -from neptune.common.envs import API_TOKEN_ENV_NAME - -# Backward compatibility import -from neptune.common.exceptions import ( - STYLES, +from neptune.exceptions import ( + AmbiguousProjectName, + ArtifactNotFoundException, + ArtifactUploadingError, + CannotResolveHostname, + CannotSynchronizeOfflineRunsWithoutProject, ClientHttpError, + ContainerUUIDNotFound, + ExceptionWithProjectsWorkspacesListing, + FetchAttributeNotFoundException, + FileNotFound, + FileSetUploadError, + FileUploadError, Forbidden, + InactiveContainerException, + InactiveModelException, + InactiveModelVersionException, + InactiveProjectException, + InactiveRunException, InternalClientError, InternalServerError, + MalformedOperation, + MetadataContainerNotFound, + MetadataInconsistency, + MissingFieldException, + ModelNotFound, + ModelVersionNotFound, + NeedExistingExperimentForReadOnlyMode, + NeedExistingModelForReadOnlyMode, + NeedExistingModelVersionForReadOnlyMode, + NeedExistingRunForReadOnlyMode, NeptuneApiException, + NeptuneCannotChangeStageManually, + NeptuneClientUpgradeRequiredError, NeptuneConnectionLostException, + NeptuneEmptyLocationException, NeptuneException, + NeptuneFeatureNotAvailableException, + NeptuneFieldCountLimitExceedException, + NeptuneIntegrationNotInstalledException, NeptuneInvalidApiTokenException, + NeptuneLegacyIncompatibilityException, + NeptuneLegacyProjectException, + NeptuneLimitExceedException, + NeptuneLocalStorageAccessException, + NeptuneMissingApiTokenException, + NeptuneMissingProjectNameException, + NeptuneMissingRequiredInitParameter, + NeptuneModelKeyAlreadyExistsError, + NeptuneObjectCreationConflict, + NeptuneOfflineModeChangeStageException, + NeptuneOfflineModeException, + NeptuneOfflineModeFetchException, + NeptuneParametersCollision, + NeptunePossibleLegacyUsageException, + NeptuneProtectedPathException, + NeptuneRemoteStorageAccessException, + NeptuneRemoteStorageCredentialsException, + NeptuneRunResumeAndCustomIdCollision, NeptuneSSLVerificationError, + NeptuneStorageLimitException, + NeptuneSynchronizationAlreadyStoppedException, + NeptuneUnhandledArtifactSchemeException, + NeptuneUnhandledArtifactTypeException, + NeptuneUninitializedException, + NeptuneUnsupportedArtifactFunctionalityException, + NeptuneWrongInitParametersException, + OperationNotSupported, + PlotlyIncompatibilityException, + ProjectNotFound, + ProjectNotFoundWithSuggestions, + RunNotFound, + RunUUIDNotFound, + StreamAlreadyUsedException, + TypeDoesNotSupportAttributeException, Unauthorized, ) -from neptune.new import envs -from neptune.new.envs import CUSTOM_RUN_ID_ENV_NAME -from neptune.new.internal.backends.api_model import ( - Project, - Workspace, -) -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.id_formats import QualifiedName -from neptune.new.internal.utils import replace_patch_version - - -class MetadataInconsistency(NeptuneException): - pass - - -class MissingFieldException(NeptuneException, AttributeError, KeyError): - """Raised when get-like action is called on `Handler`, instead of on `Attribute`.""" - - def __init__(self, field_path): - message = """ -{h1} -----MissingFieldException------------------------------------------------------- -{end} -The field "{field_path}" was not found. - -There are two possible reasons: - - There is a typo in a path. Double-check your code for typos. - - You are fetching a field that another process created, but the local representation is not synchronized. - If you are sending metadata from multiple processes at the same time, synchronize the local representation before fetching values: - {python}run.sync(){end} - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" # noqa: E501 - self._msg = message.format(field_path=field_path, **STYLES) - super().__init__(self._msg) - - def __str__(self): - # required because of overriden `__str__` in `KeyError` - return self._msg - - -class TypeDoesNotSupportAttributeException(NeptuneException, AttributeError): - def __init__(self, type_, attribute): - message = """ -{h1} -----TypeDoesNotSupportAttributeException---------------------------------------- -{end} -{type} has no attribute {attribute}. - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - self._msg = message.format(type=type_, attribute=attribute, **STYLES) - super().__init__(self._msg) - - def __str__(self): - # required because of overriden `__str__` in `KeyError` - return self._msg - - -class MalformedOperation(NeptuneException): - pass - - -class FileNotFound(NeptuneException): - def __init__(self, file: str): - super().__init__("File not found: {}".format(file)) - - -class FileUploadError(NeptuneException): - def __init__(self, filename: str, msg: str): - super().__init__("Cannot upload file {}: {}".format(filename, msg)) - - -class FileSetUploadError(NeptuneException): - def __init__(self, globs: List[str], msg: str): - super().__init__("Cannot upload file set {}: {}".format(globs, msg)) - - -class MetadataContainerNotFound(NeptuneException): - container_id: str - container_type: ContainerType - - def __init__(self, container_id: str, container_type: Optional[ContainerType]): - self.container_id = container_id - self.container_type = container_type - container_type_str = container_type.value.capitalize() if container_type else "object" - super().__init__("{} {} not found.".format(container_type_str, container_id)) - - @classmethod - def of_container_type(cls, container_type: Optional[ContainerType], container_id: str): - if container_type is None: - return MetadataContainerNotFound(container_id=container_id, container_type=None) - elif container_type == ContainerType.PROJECT: - return ProjectNotFound(project_id=container_id) - elif container_type == ContainerType.RUN: - return RunNotFound(run_id=container_id) - elif container_type == ContainerType.MODEL: - return ModelNotFound(model_id=container_id) - elif container_type == ContainerType.MODEL_VERSION: - return ModelVersionNotFound(model_version_id=container_id) - else: - raise InternalClientError(f"Unexpected ContainerType: {container_type}") - - -class ProjectNotFound(MetadataContainerNotFound): - def __init__(self, project_id: str): - super().__init__(container_id=project_id, container_type=ContainerType.PROJECT) - - -class RunNotFound(MetadataContainerNotFound): - def __init__(self, run_id: str): - super().__init__(container_id=run_id, container_type=ContainerType.RUN) - - -class ModelNotFound(MetadataContainerNotFound): - def __init__(self, model_id: str): - super().__init__(container_id=model_id, container_type=ContainerType.MODEL) - - -class ModelVersionNotFound(MetadataContainerNotFound): - def __init__(self, model_version_id: str): - super().__init__(container_id=model_version_id, container_type=ContainerType.MODEL_VERSION) - - -class ExceptionWithProjectsWorkspacesListing(NeptuneException): - def __init__( - self, - message: str, - available_projects: List[Project] = (), - available_workspaces: List[Workspace] = (), - **kwargs, - ): - available_projects_message = """ -Did you mean any of these? -{projects} -""" - - available_workspaces_message = """ -You can check all of your projects on the Projects page: -{workspaces_urls} -""" - - projects_formated_list = "\n".join( - map( - lambda project: f" - {project.workspace}/{project.name}", - available_projects, - ) - ) - - workspaces_formated_list = "\n".join( - map( - lambda workspace: f" - https://app.neptune.ai/{workspace.name}/-/projects", - available_workspaces, - ) - ) - - super().__init__( - message.format( - available_projects_message=available_projects_message.format(projects=projects_formated_list) - if available_projects - else "", - available_workspaces_message=available_workspaces_message.format( - workspaces_urls=workspaces_formated_list - ) - if available_workspaces - else "", - **STYLES, - **kwargs, - ) - ) - - -class ContainerUUIDNotFound(NeptuneException): - container_id: str - container_type: ContainerType - - def __init__(self, container_id: str, container_type: ContainerType): - self.container_id = container_id - self.container_type = container_type - super().__init__( - "{} with ID {} not found. It may have been deleted. " - "You can use the 'neptune clear' command to delete junk objects from local storage.".format( - container_type.value.capitalize(), container_id - ) - ) - - -# for backward compatibility -RunUUIDNotFound = ContainerUUIDNotFound - - -class ProjectNotFoundWithSuggestions(ExceptionWithProjectsWorkspacesListing, ProjectNotFound): - def __init__( - self, - project_id: QualifiedName, - available_projects: List[Project] = (), - available_workspaces: List[Workspace] = (), - ): - message = """ -{h1} -----NeptuneProjectNotFoundException------------------------------------ -{end} -We couldn't find project {fail}"{project}"{end}. -{available_projects_message}{available_workspaces_message} -You may want to check the following docs page: - - https://docs.neptune.ai/setup/creating_project/ - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__( - message=message, - available_projects=available_projects, - available_workspaces=available_workspaces, - project=project_id, - ) - - -class AmbiguousProjectName(ExceptionWithProjectsWorkspacesListing): - def __init__(self, project_id: str, available_projects: List[Project] = ()): - message = """ -{h1} -----NeptuneProjectNameCollisionException------------------------------------ -{end} -Cannot resolve project {fail}"{project}"{end}. Name is ambiguous. -{available_projects_message} -You may also want to check the following docs pages: - - https://docs.neptune.ai/setup/creating_project/ - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__(message=message, available_projects=available_projects, project=project_id) - - -class NeptuneMissingProjectNameException(ExceptionWithProjectsWorkspacesListing): - def __init__( - self, - available_projects: List[Project] = (), - available_workspaces: List[Workspace] = (), - ): - message = """ -{h1} -----NeptuneMissingProjectNameException---------------------------------------- -{end} -The Neptune client couldn't find your project name. -{available_projects_message}{available_workspaces_message} -There are two options two add it: - - specify it in your code - - set an environment variable in your operating system. - -{h2}CODE{end} -Pass it to the {bold}init(){end} method via the {bold}project{end} argument: - {python}neptune.init_run(project='WORKSPACE_NAME/PROJECT_NAME'){end} - -{h2}ENVIRONMENT VARIABLE{end} -or export or set an environment variable depending on your operating system: - - {correct}Linux/Unix{end} - In your terminal run: - {bash}export {env_project}=WORKSPACE_NAME/PROJECT_NAME{end} - - {correct}Windows{end} - In your CMD run: - {bash}set {env_project}=WORKSPACE_NAME/PROJECT_NAME{end} - -and skip the {bold}project{end} argument of the {bold}init(){end} method: - {python}neptune.init_run(){end} - -You may also want to check the following docs pages: - - https://docs.neptune.ai/setup/creating_project/ - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__( - message=message, - available_projects=available_projects, - available_workspaces=available_workspaces, - env_project=envs.PROJECT_ENV_NAME, - ) - - -class InactiveContainerException(NeptuneException): - resume_info: str - - def __init__(self, container_type: ContainerType, label: str): - message = """ -{h1} -----{cls}---------------------------------------- -{end} -It seems you are trying to log metadata to (or fetch it from) a {container_type} that was stopped ({label}). - -Here's what you can do:{resume_info} - -You may also want to check the following docs pages: - - https://docs.neptune.ai/logging/to_existing_object/ - - https://docs.neptune.ai/usage/querying_metadata/ - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__( - message.format( - cls=self.__class__.__name__, - label=label, - container_type=container_type.value, - resume_info=self.resume_info, - **STYLES, - ) - ) - - -class InactiveRunException(InactiveContainerException): - resume_info = """ - - Resume the run to continue logging to it: - https://docs.neptune.ai/logging/to_existing_object/ - - Don't invoke `stop()` on a run that you want to access. If you want to stop monitoring only, - you can resume a run in read-only mode: - https://docs.neptune.ai/api/connection_modes/#read-only-mode""" - - def __init__(self, label: str): - super().__init__(label=label, container_type=ContainerType.RUN) - - -class InactiveModelException(InactiveContainerException): - resume_info = """ - - Resume the model to continue logging to it: - https://docs.neptune.ai/api/neptune/#init_model - - Don't invoke `stop()` on a model that you want to access. If you want to stop monitoring only, - you can resume a model in read-only mode: - https://docs.neptune.ai/api/connection_modes/#read-only-mode""" - - def __init__(self, label: str): - super().__init__(label=label, container_type=ContainerType.MODEL) - - -class InactiveModelVersionException(InactiveContainerException): - resume_info = """ - - Resume the model version to continue logging to it: - https://docs.neptune.ai/api/neptune/#init_model_version - - Don't invoke `stop()` on a model version that you want to access. If you want to stop monitoring only, - you can resume a model version in read-only mode: - https://docs.neptune.ai/api/connection_modes/#read-only-mode""" - - def __init__(self, label: str): - super().__init__(label=label, container_type=ContainerType.MODEL_VERSION) - - -class InactiveProjectException(InactiveContainerException): - resume_info = """ - - Resume the connection to the project to continue logging to it: - https://docs.neptune.ai/api/neptune/#init_project - - Don't invoke `stop()` on a project that you want to access.""" - - def __init__(self, label: str): - super().__init__(label=label, container_type=ContainerType.PROJECT) - - -class NeptuneMissingApiTokenException(NeptuneException): - def __init__(self): - message = """ -{h1} -----NeptuneMissingApiTokenException------------------------------------------- -{end} -The Neptune client couldn't find your API token. - -You can get it here: - - https://app.neptune.ai/get_my_api_token - -There are two options to add it: - - specify it in your code - - set an environment variable in your operating system. - -{h2}CODE{end} -Pass the token to the {bold}init(){end} method via the {bold}api_token{end} argument: - {python}neptune.init_run(project='WORKSPACE_NAME/PROJECT_NAME', api_token='YOUR_API_TOKEN'){end} - -{h2}ENVIRONMENT VARIABLE{end} {correct}(Recommended option){end} -or export or set an environment variable depending on your operating system: - - {correct}Linux/Unix{end} - In your terminal run: - {bash}export {env_api_token}="YOUR_API_TOKEN"{end} - - {correct}Windows{end} - In your CMD run: - {bash}set {env_api_token}="YOUR_API_TOKEN"{end} - -and skip the {bold}api_token{end} argument of the {bold}init(){end} method: - {python}neptune.init_run(project='WORKSPACE_NAME/PROJECT_NAME'){end} - -You may also want to check the following docs pages: - - https://docs.neptune.ai/setup/setting_api_token/ - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__(message.format(env_api_token=API_TOKEN_ENV_NAME, **STYLES)) - - -class CannotSynchronizeOfflineRunsWithoutProject(NeptuneException): - def __init__(self): - super().__init__("Cannot synchronize offline runs without a project.") - - -class NeedExistingExperimentForReadOnlyMode(NeptuneException): - container_type: ContainerType - callback_name: str - - def __init__(self, container_type: ContainerType, callback_name: str): - message = """ -{h1} -----{class_name}----------------------------------------- -{end} -Read-only mode can be used only with an existing {container_type}. - -The {python}{container_type}{end} parameter of {python}{callback_name}{end} must be provided and reference -an existing run when using {python}mode="read-only"{end}. - -You may also want to check the following docs pages: - - https://docs.neptune.ai/logging/to_existing_object/ - - https://docs.neptune.ai/api/connection_modes/#read-only-mode - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - self.container_type = container_type - self.callback_name = callback_name - super().__init__( - message.format( - class_name=type(self).__name__, - container_type=self.container_type.value, - callback_name=self.callback_name, - **STYLES, - ) - ) - - -class NeedExistingRunForReadOnlyMode(NeedExistingExperimentForReadOnlyMode): - def __init__(self): - super().__init__(container_type=ContainerType.RUN, callback_name="neptune.init_run") - - -class NeedExistingModelForReadOnlyMode(NeedExistingExperimentForReadOnlyMode): - def __init__(self): - super().__init__(container_type=ContainerType.MODEL, callback_name="neptune.init_model") - - -class NeedExistingModelVersionForReadOnlyMode(NeedExistingExperimentForReadOnlyMode): - def __init__(self): - super().__init__( - container_type=ContainerType.MODEL_VERSION, - callback_name="neptune.init_model_version", - ) - - -class NeptuneParametersCollision(NeptuneException): - def __init__(self, parameter1, parameter2, method_name): - self.parameter1 = parameter1 - self.parameter2 = parameter2 - self.method_name = method_name - message = """ -{h1} -----NeptuneParametersCollision----------------------------------------- -{end} -The {python}{parameter1}{end} and {python}{parameter2}{end} parameters of the {python}{method_name}(){end} method are mutually exclusive. - -You may also want to check the following docs page: - - https://docs.neptune.ai/api/universal/#initialization-methods - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" # noqa: E501 - super().__init__( - message.format( - parameter1=parameter1, - parameter2=parameter2, - method_name=method_name, - **STYLES, - ) - ) - - -class NeptuneWrongInitParametersException(NeptuneException): - pass - - -class NeptuneRunResumeAndCustomIdCollision(NeptuneWrongInitParametersException): - def __init__(self): - message = """ -{h1} -----NeptuneRunResumeAndCustomIdCollision----------------------------------------- -{end} -It's not possible to use {python}custom_run_id{end} while resuming a run. - -The {python}run{end} and {python}custom_run_id{end} parameters of the {python}init_run(){end} method are mutually exclusive. -Make sure you have no {bash}{custom_id_env}{end} environment variable set -and no value is explicitly passed to the `custom_run_id` argument when you are resuming a run. - -You may also want to check the following docs page: - - https://docs.neptune.ai/logging/to_existing_object/ - - https://docs.neptune.ai/logging/custom_run_id/ - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" # noqa: E501 - super().__init__(message.format(custom_id_env=CUSTOM_RUN_ID_ENV_NAME, **STYLES)) - - -class NeptuneClientUpgradeRequiredError(NeptuneException): - def __init__( - self, - version: Union[Version, str], - min_version: Optional[Union[Version, str]] = None, - max_version: Optional[Union[Version, str]] = None, - ): - current_version = str(version) - required_version = "==" + replace_patch_version(str(max_version)) if max_version else ">=" + str(min_version) - message = """ -{h1} -----NeptuneClientUpgradeRequiredError------------------------------------------------------------- -{end} -Your version of the Neptune client library ({current_version}) is no longer supported by the Neptune - server. The minimum required version is {required_version}. - -In order to update the Neptune client library, run the following command in your terminal: - {bash}pip install -U neptune-client{end} -Or if you are using Conda, run the following instead: - {bash}conda update -c conda-forge neptune-client{end} - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__( - message.format( - current_version=current_version, - required_version=required_version, - **STYLES, - ) - ) - - -class NeptuneMissingRequiredInitParameter(NeptuneWrongInitParametersException): - def __init__( - self, - called_function: str, - parameter_name: str, - ): - message = """ -{h1} -----NeptuneMissingRequiredInitParameter--------------------------------------- -{end} -{python}neptune.{called_function}(){end} invocation was missing {python}{parameter_name}{end}. -If you want to create a new object using {python}{called_function}{end}, {python}{parameter_name}{end} is required: -https://docs.neptune.ai/api/neptune#{called_function} - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__( - message.format( - called_function=called_function, - parameter_name=parameter_name, - **STYLES, - ) - ) - - -class CannotResolveHostname(NeptuneException): - def __init__(self, host): - message = """ -{h1} -----CannotResolveHostname----------------------------------------------------------------------- -{end} -The Neptune client library was not able to resolve hostname {underline}{host}{end}. - -What should I do? - - Check if your computer is connected to the internet. - - Check if your computer is supposed to be using a proxy to access the internet. - If so, you may want to use the {python}proxies{end} parameter of the {python}init(){end} method. - See https://docs.neptune.ai/api/universal/#proxies - and https://requests.readthedocs.io/en/latest/user/advanced/#proxies - - Check the status of Neptune services: https://status.neptune.ai/ - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__(message.format(host=host, **STYLES)) - - -class NeptuneOfflineModeException(NeptuneException): - pass - - -class NeptuneOfflineModeFetchException(NeptuneOfflineModeException): - def __init__(self): - message = """ -{h1} -----NeptuneOfflineModeFetchException--------------------------------------------------- -{end} -It seems you are trying to fetch data from the server while working in offline mode. -You need to work in a non-offline connection mode to fetch data from the server. - -You can set the connection mode when creating a new run: - {python}run = neptune.init_run(mode="async"){end} - -You may also want to check the following docs page: - - https://docs.neptune.ai/api/connection_modes - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__(message.format(**STYLES)) - - -class NeptuneOfflineModeChangeStageException(NeptuneOfflineModeException): - def __init__(self): - message = """ -{h1} -----NeptuneOfflineModeChangeStageException--------------------------------------- -{end} -You cannot change the stage of the model version while in offline mode. -""" - super().__init__(message.format(**STYLES)) - - -class NeptuneProtectedPathException(NeptuneException): - extra_info = "" - - def __init__(self, path: str): - message = """ -{h1} -----NeptuneProtectedPathException---------------------------------------------- -{end} -Field {path} cannot be changed directly. -{extra_info} - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - self._path = path - super().__init__( - message.format( - path=path, - extra_info=self.extra_info.format(**STYLES), - **STYLES, - ) - ) - - -class NeptuneCannotChangeStageManually(NeptuneProtectedPathException): - extra_info = """ -If you want to change the stage of the model version, -use the {python}.change_stage(){end} method: - {python}model_version.change_stage("staging"){end}""" - - -class OperationNotSupported(NeptuneException): - 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 NeptuneUninitializedException(NeptuneException): - def __init__(self): - message = """ -{h1} -----NeptuneUninitializedException---------------------------------------------------- -{end} -You must initialize the Neptune client library before you can access `get_last_run`. - -Looks like you forgot to add: - {python}neptune.init_run(project='WORKSPACE_NAME/PROJECT_NAME', api_token='YOUR_API_TOKEN'){end} - -before you ran: - {python}neptune.get_last_run(){end} - -You may also want to check the following docs page: - - https://docs.neptune.ai/api/neptune/#get_last_run - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__(message.format(**STYLES)) - - -class NeptuneIntegrationNotInstalledException(NeptuneException): - def __init__(self, integration_package_name, framework_name): - message = """ -{h1} -----NeptuneIntegrationNotInstalledException----------------------------------------- -{end} -Looks like integration {integration_package_name} wasn't installed. -To install, run: - {bash}pip install {integration_package_name}{end} -Or: - {bash}pip install "neptune-client[{framework_name}]"{end} - -You may also want to check the following docs page: - - https://docs.neptune.ai/integrations - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__( - message.format( - integration_package_name=integration_package_name, - framework_name=framework_name, - **STYLES, - ) - ) - - -class NeptuneLimitExceedException(NeptuneException): - def __init__(self, reason: str): - message = """ -{h1} -----NeptuneLimitExceedException--------------------------------------------------------------------------------------- -{end} -{reason} - -It's not possible to upload new data, but you can still fetch and delete data. -If you are using asynchronous (default) connection mode, Neptune automatically switched to offline mode -and your data is being stored safely on the disk. You can upload it later using the Neptune Command Line Interface tool: - {bash}neptune sync -p project_name{end} -What should I do? - - In case of storage limitations, go to your projects and remove runs or model metadata you don't need - - ... or update your subscription plan here: https://app.neptune.ai/-/subscription -You may also want to check the following docs page: - - https://docs.neptune.ai/api/connection_modes/ -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__(message.format(**STYLES, reason=reason)) - - -class NeptuneFieldCountLimitExceedException(NeptuneException): - def __init__(self, limit: int, container_type: str, identifier: str): - message = """ -{h1} -----NeptuneFieldCountLimitExceedException--------------------------------------------------------------------------------------- -{end} -There are too many fields (more than {limit}) in the {identifier} {container_type}. -We have stopped the synchronization to the Neptune server and stored the data locally. - -To continue uploading the metadata: - - 1. Delete some excess fields from {identifier}. - - You can delete fields or namespaces with the "del" command. - For example, to delete the "training/checkpoints" namespace: - - {python}del run["training/checkpoints"]{end} - - 2. Once you're done, synchronize the data manually with the following command: - - {bash}neptune sync -p project_name{end} - -For more details, see https://docs.neptune.ai/usage/best_practices -""" # noqa: E501 - super().__init__( - message.format( - **STYLES, - limit=limit, - container_type=container_type, - identifier=identifier, - ) - ) - - -class NeptuneStorageLimitException(NeptuneException): - def __init__(self): - message = """ -{h1} -----NeptuneStorageLimitException--------------------------------------------------------------------------------------- -{end} -You exceeded the storage limit of the workspace. It's not possible to upload new data, but you can still fetch and delete data. -If you are using asynchronous (default) connection mode, Neptune automatically switched to offline mode -and your data is being stored safely on the disk. You can upload it later using the Neptune Command Line Interface tool: - {bash}neptune sync -p project_name{end} -What should I do? - - Go to your projects and remove runs or model metadata you don't need - - ... or update your subscription plan here: https://app.neptune.ai/-/subscription -You may also want to check the following docs page: - - https://docs.neptune.ai/api/connection_modes -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" # noqa: E501 - super().__init__(message.format(**STYLES)) - - -class FetchAttributeNotFoundException(MetadataInconsistency): - def __init__(self, attribute_path: str): - message = """ -{h1} -----MetadataInconsistency---------------------------------------------------------------------- -{end} -The field {python}{attribute_path}{end} was not found. - -Remember that in the asynchronous (default) connection mode, data is synchronized -with the Neptune servers in the background. The data may have not reached -the servers before it was fetched. Before fetching the data, you can force -wait for all the requests sent by invoking: - - {python}run.wait(){end} - -Remember that each use of {python}wait{end} introduces a delay in code execution. - -You may also want to check the following docs page: - - https://docs.neptune.ai/api/connection_modes - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help.html -""" - super().__init__(message.format(attribute_path=attribute_path, **STYLES)) - - -class ArtifactNotFoundException(MetadataInconsistency): - def __init__(self, artifact_hash: str): - message = """ -{h1} -----MetadataInconsistency---------------------------------------------------------------------- -{end} -Artifact with hash {python}{artifact_hash}{end} was not found. - -Remember that in the asynchronous (default) connection mode, data is synchronized -with the Neptune servers in the background. The data may have not reached -the servers before it was fetched. Before fetching the data, you can force -wait for all the requests sent by invoking: - - {python}run.wait(){end} - -Remember that each use of {python}wait{end} introduces a delay in code execution. - -You may also want to check the following docs page: - - https://docs.neptune.ai/api/connection_modes - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help.html -""" - super().__init__(message.format(artifact_hash=artifact_hash, **STYLES)) - - -class PlotlyIncompatibilityException(Exception): - def __init__(self, matplotlib_version, plotly_version, details): - super().__init__( - "Unable to convert plotly figure to matplotlib format. " - "Your matplotlib ({}) and plotlib ({}) versions are not compatible. " - "{}".format(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 - message = """ -{h1} -----NeptuneUnhandledArtifactProtocolException------------------------------------ -{end} -You have used a Neptune Artifact to track a file with a scheme unhandled by this client ({scheme}). -Problematic path: {path} - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__(message.format(scheme=scheme, path=path, **STYLES)) - - -class NeptuneUnhandledArtifactTypeException(NeptuneException): - def __init__(self, type_str: str): - message = """ -{h1} -----NeptuneUnhandledArtifactTypeException---------------------------------------- -{end} -A Neptune Artifact you're listing is tracking a file type unhandled by this client ({type_str}). - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__(message.format(type_str=type_str, **STYLES)) - - -class NeptuneLocalStorageAccessException(NeptuneException): - def __init__(self, path, expected_description): - message = """ -{h1} -----NeptuneLocalStorageAccessException------------------------------------- -{end} -Neptune had a problem processing "{path}". It expects it to be {expected_description}. - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__(message.format(path=path, expected_description=expected_description, **STYLES)) - - -class NeptuneRemoteStorageCredentialsException(NeptuneException): - def __init__(self): - message = """ -{h1} -----NeptuneRemoteStorageCredentialsException------------------------------------- -{end} -Neptune could not find suitable credentials for remote storage of a Neptune Artifact you're listing. - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__(message.format(**STYLES)) - - -class NeptuneRemoteStorageAccessException(NeptuneException): - def __init__(self, location: str): - message = """ -{h1} -----NeptuneRemoteStorageAccessException------------------------------------------ -{end} -Neptune could not access an object ({location}) from remote storage of a Neptune Artifact you're listing. - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__(message.format(location=location, **STYLES)) - - -class ArtifactUploadingError(NeptuneException): - def __init__(self, msg: str): - super().__init__("Cannot upload artifact: {}".format(msg)) - - -class NeptuneUnsupportedArtifactFunctionalityException(NeptuneException): - def __init__(self, functionality_info: str): - message = """ -{h1} -----NeptuneUnsupportedArtifactFunctionality------------------------------------- -{end} -It seems you are using Neptune Artifacts functionality that is currently not supported. - -{functionality_info} - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__(message.format(functionality_info=functionality_info, **STYLES)) - - -class NeptuneEmptyLocationException(NeptuneException): - def __init__(self, location: str, namespace: str): - message = """ -{h1} -----NeptuneEmptyLocationException---------------------------------------------- -{end} -Neptune could not find files in the requested location ({location}) during the creation of an Artifact in "{namespace}". - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__(message.format(location=location, namespace=namespace, **STYLES)) - - -class NeptuneFeatureNotAvailableException(NeptuneException): - def __init__(self, missing_feature): - message = """ -{h1} -----NeptuneFeatureNotAvailableException---------------------------------------------- -{end} -The following feature is not yet supported by the Neptune instance you are using: -{missing_feature} - -An update of the Neptune instance is required in order to use it. Please contact your local Neptune administrator -or Neptune support directly (support@neptune.ai) about the upcoming updates. - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - self.message = message.format(missing_feature=missing_feature, **STYLES) - super().__init__(message) - - -class NeptuneObjectCreationConflict(NeptuneException): - pass - - -class NeptuneModelKeyAlreadyExistsError(NeptuneObjectCreationConflict): - def __init__(self, model_key, models_tab_url): - message = """ -{h1} -----NeptuneModelKeyAlreadyExistsError--------------------------------------------------- -{end} -A model with the provided key ({model_key}) already exists in this project. A model key has to be unique -within the project. - -You can check all of your models in the project on the Models page: -{models_tab_url} - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__(message.format(model_key=model_key, models_tab_url=models_tab_url, **STYLES)) - - -class NeptuneSynchronizationAlreadyStoppedException(NeptuneException): - def __init__(self): - message = """ -{h1} -----NeptuneSynchronizationAlreadyStopped--------------------------------------------------- -{end} -The synchronization thread had stopped before Neptune could finish uploading the logged metadata. -Your data is stored locally, but you'll need to finish the synchronization manually. -To synchronize with the Neptune servers, enter the following on your command line: - - {bash}neptune sync{end} - -For details, see https://docs.neptune.ai/api/neptune_sync/ - -If the synchronization fails, you may want to check your connection and ensure that you're -within limits by going to your Neptune project settings -> Usage. -If the issue persists, our support is happy to help. - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__(message.format(**STYLES)) - - -class StreamAlreadyUsedException(NeptuneException): - def __init__(self): - message = """ -{h1} -----StreamAlreadyUsedException--------------------------------------------------- -{end} -A File object created with File.from_stream() has already been logged. -You can only log content from the same stream once. - -For more, see https://docs.neptune.ai/api/field_types/#from_stream - -{correct}Need help?{end}-> https://docs.neptune.ai/getting_help -""" - super().__init__(message.format(**STYLES)) - - -class NeptuneUserApiInputException(NeptuneException): - def __init__(self, message): - super().__init__(message) From 09b2119a52447ee40029bb1ab2f5373300517178 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 14:04:41 +0100 Subject: [PATCH 05/33] Tests fixed --- src/neptune/exceptions.py | 1 + src/neptune/new/exceptions.py | 2 + tests/unit/neptune/new/test_imports.py | 364 +++---------------------- 3 files changed, 46 insertions(+), 321 deletions(-) diff --git a/src/neptune/exceptions.py b/src/neptune/exceptions.py index 3e65e575f..e41b366c2 100644 --- a/src/neptune/exceptions.py +++ b/src/neptune/exceptions.py @@ -89,6 +89,7 @@ "NeptuneModelKeyAlreadyExistsError", "NeptuneSynchronizationAlreadyStoppedException", "StreamAlreadyUsedException", + "NeptuneUserApiInputException", ] from typing import ( diff --git a/src/neptune/new/exceptions.py b/src/neptune/new/exceptions.py index a348ac648..216f7f770 100644 --- a/src/neptune/new/exceptions.py +++ b/src/neptune/new/exceptions.py @@ -89,6 +89,7 @@ "NeptuneModelKeyAlreadyExistsError", "NeptuneSynchronizationAlreadyStoppedException", "StreamAlreadyUsedException", + "NeptuneUserApiInputException", ] from neptune.exceptions import ( @@ -157,6 +158,7 @@ NeptuneUnhandledArtifactTypeException, NeptuneUninitializedException, NeptuneUnsupportedArtifactFunctionalityException, + NeptuneUserApiInputException, NeptuneWrongInitParametersException, OperationNotSupported, PlotlyIncompatibilityException, diff --git a/tests/unit/neptune/new/test_imports.py b/tests/unit/neptune/new/test_imports.py index 6f032c87e..8bda8fe45 100644 --- a/tests/unit/neptune/new/test_imports.py +++ b/tests/unit/neptune/new/test_imports.py @@ -34,184 +34,31 @@ UserNotExistsOrWithoutAccess, WorkspaceNotFound, ) -from neptune.new.attributes.atoms.artifact import ( - Artifact, - ArtifactDriver, - ArtifactDriversMap, - ArtifactFileData, - ArtifactVal, - AssignArtifact, - Atom, - OptionalFeatures, - TrackFilesToArtifact, -) -from neptune.new.attributes.atoms.atom import ( - Atom, - Attribute, -) -from neptune.new.attributes.atoms.boolean import ( - AssignBool, - Boolean, - BooleanVal, -) -from neptune.new.attributes.atoms.datetime import ( - AssignDatetime, - Datetime, - DatetimeVal, - datetime, -) -from neptune.new.attributes.atoms.file import ( - Atom, - File, - FileVal, - UploadFile, -) -from neptune.new.attributes.atoms.float import ( - AssignFloat, - Float, - FloatVal, -) -from neptune.new.attributes.atoms.git_ref import ( - Atom, - GitRef, -) -from neptune.new.attributes.atoms.integer import ( - AssignInt, - Integer, - IntegerVal, -) -from neptune.new.attributes.atoms.notebook_ref import ( - Atom, - NotebookRef, -) -from neptune.new.attributes.atoms.run_state import ( - Atom, - RunState, -) -from neptune.new.attributes.atoms.string import ( - AssignString, - String, - StringVal, -) -from neptune.new.attributes.attribute import ( - Attribute, - List, - NeptuneBackend, - Operation, -) -from neptune.new.attributes.file_set import ( - Attribute, - DeleteFiles, - FileSet, - FileSetVal, - Iterable, - UploadFileSet, -) +from neptune.new.attributes.atoms.artifact import Artifact +from neptune.new.attributes.atoms.atom import Atom +from neptune.new.attributes.atoms.boolean import Boolean +from neptune.new.attributes.atoms.datetime import Datetime +from neptune.new.attributes.atoms.file import File +from neptune.new.attributes.atoms.float import Float +from neptune.new.attributes.atoms.git_ref import GitRef +from neptune.new.attributes.atoms.integer import Integer +from neptune.new.attributes.atoms.notebook_ref import NotebookRef +from neptune.new.attributes.atoms.run_state import RunState +from neptune.new.attributes.atoms.string import String +from neptune.new.attributes.attribute import Attribute +from neptune.new.attributes.file_set import FileSet from neptune.new.attributes.namespace import ( - Attribute, - Dict, - Iterator, - List, - Mapping, - MutableMapping, Namespace, NamespaceBuilder, - NamespaceVal, - NoValue, - RunStructure, -) -from neptune.new.attributes.series.fetchable_series import ( - Dict, - FetchableSeries, - FloatSeriesValues, - Generic, - StringSeriesValues, - TypeVar, - datetime, -) -from neptune.new.attributes.series.file_series import ( - ClearImageLog, - Data, - File, - FileNotFound, - FileSeries, - FileSeriesVal, - ImageValue, - Iterable, - LogImages, - Operation, - OperationNotSupported, - Series, - Val, -) -from neptune.new.attributes.series.float_series import ( - ClearFloatLog, - ConfigFloatSeries, - FetchableSeries, - FloatSeries, - FloatSeriesVal, - FloatSeriesValues, - Iterable, - LogFloats, - Operation, - Series, - Val, -) -from neptune.new.attributes.series.series import ( - Attribute, - Generic, - Iterable, - Series, - SeriesVal, - TypeVar, -) -from neptune.new.attributes.series.string_series import ( - ClearStringLog, - Data, - FetchableSeries, - Iterable, - List, - LogStrings, - Operation, - Series, - StringSeries, - StringSeriesVal, - StringSeriesValues, - Val, -) -from neptune.new.attributes.sets.set import ( - Attribute, - Set, -) -from neptune.new.attributes.sets.string_set import ( - AddStrings, - ClearStringSet, - Iterable, - RemoveStrings, - Set, - StringSet, - StringSetVal, -) -from neptune.new.attributes.utils import ( - Artifact, - AttributeType, - Boolean, - Datetime, - File, - FileSeries, - FileSet, - Float, - FloatSeries, - GitRef, - Integer, - InternalClientError, - List, - NotebookRef, - RunState, - String, - StringSeries, - StringSet, ) +from neptune.new.attributes.series.fetchable_series import FetchableSeries +from neptune.new.attributes.series.file_series import FileSeries +from neptune.new.attributes.series.float_series import FloatSeries +from neptune.new.attributes.series.series import Series +from neptune.new.attributes.series.string_series import StringSeries +from neptune.new.attributes.sets.set import Set +from neptune.new.attributes.sets.string_set import StringSet +from neptune.new.attributes.utils import create_attribute_from_type from neptune.new.exceptions import ( AmbiguousProjectName, ArtifactNotFoundException, @@ -228,7 +75,6 @@ InactiveRunException, InternalClientError, InternalServerError, - List, MalformedOperation, MetadataInconsistency, MissingFieldException, @@ -260,33 +106,13 @@ NeptuneUnsupportedArtifactFunctionalityException, OperationNotSupported, PlotlyIncompatibilityException, - Project, ProjectNotFound, RunNotFound, RunUUIDNotFound, Unauthorized, - Version, - Workspace, -) -from neptune.new.handler import ( - Artifact, - ArtifactFileData, - File, - FileSeries, - FileSet, - FileVal, - FloatSeries, - Handler, - NeptuneException, - StringSeries, - StringSet, -) -from neptune.new.integrations.python_logger import ( - Logger, - NeptuneHandler, - Run, - RunState, ) +from neptune.new.handler import Handler +from neptune.new.integrations.python_logger import NeptuneHandler from neptune.new.logging.logger import Logger from neptune.new.project import Project from neptune.new.run import ( @@ -330,130 +156,26 @@ ProjectNotFound, RunNotFound, ) -from neptune.new.types.atoms.artifact import ( - Artifact, - Atom, - FileHasher, - TypeVar, -) -from neptune.new.types.atoms.atom import ( - Atom, - TypeVar, - Value, -) -from neptune.new.types.atoms.boolean import ( - Atom, - Boolean, - TypeVar, -) -from neptune.new.types.atoms.datetime import ( - Atom, - Datetime, - TypeVar, - datetime, -) -from neptune.new.types.atoms.file import ( - Atom, - File, - IOBase, - TypeVar, -) -from neptune.new.types.atoms.float import ( - Atom, - Float, - TypeVar, -) -from neptune.new.types.atoms.git_ref import ( - Atom, - GitRef, - List, - TypeVar, - datetime, -) -from neptune.new.types.atoms.integer import ( - Atom, - Integer, - TypeVar, -) -from neptune.new.types.atoms.string import ( - Atom, - String, - TypeVar, -) -from neptune.new.types.file_set import ( - FileSet, - Iterable, - List, - TypeVar, - Value, -) -from neptune.new.types.namespace import ( - Namespace, - TypeVar, - Value, -) -from neptune.new.types.series.file_series import ( - File, - FileSeries, - List, - Series, - TypeVar, -) -from neptune.new.types.series.float_series import ( - FloatSeries, - Series, - TypeVar, -) -from neptune.new.types.series.series import ( - Series, - TypeVar, - Value, -) -from neptune.new.types.series.series_value import ( - Generic, - SeriesValue, - TypeVar, -) -from neptune.new.types.series.string_series import ( - Series, - StringSeries, - TypeVar, -) -from neptune.new.types.sets.set import ( - Set, - TypeVar, - Value, -) -from neptune.new.types.sets.string_set import ( - Iterable, - Set, - StringSet, - TypeVar, -) -from neptune.new.types.value import ( - TypeVar, - Value, -) -from neptune.new.types.value_visitor import ( - Artifact, - Boolean, - Datetime, - File, - FileSeries, - FileSet, - Float, - FloatSeries, - Generic, - GitRef, - Integer, - Namespace, - String, - StringSeries, - StringSet, - TypeVar, - Value, - ValueVisitor, -) +from neptune.new.types.atoms.artifact import Artifact +from neptune.new.types.atoms.atom import Atom +from neptune.new.types.atoms.boolean import Boolean +from neptune.new.types.atoms.datetime import Datetime +from neptune.new.types.atoms.file import File +from neptune.new.types.atoms.float import Float +from neptune.new.types.atoms.git_ref import GitRef +from neptune.new.types.atoms.integer import Integer +from neptune.new.types.atoms.string import String +from neptune.new.types.file_set import FileSet +from neptune.new.types.namespace import Namespace +from neptune.new.types.series.file_series import FileSeries +from neptune.new.types.series.float_series import FloatSeries +from neptune.new.types.series.series import Series +from neptune.new.types.series.series_value import SeriesValue +from neptune.new.types.series.string_series import StringSeries +from neptune.new.types.sets.set import Set +from neptune.new.types.sets.string_set import StringSet +from neptune.new.types.value import Value +from neptune.new.types.value_visitor import ValueVisitor class TestImports(unittest.TestCase): From c36d58dc1c3f6714fc756a3a3048822a86830c83 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 14:34:07 +0100 Subject: [PATCH 06/33] Moved init --- src/neptune/__init__.py | 116 +++++++++++++++++++++++++++++++++++- src/neptune/new/__init__.py | 90 +++++++--------------------- 2 files changed, 136 insertions(+), 70 deletions(-) diff --git a/src/neptune/__init__.py b/src/neptune/__init__.py index 4c8ff7f58..2a55ee2d6 100644 --- a/src/neptune/__init__.py +++ b/src/neptune/__init__.py @@ -13,10 +13,122 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__all__ = ["__version__"] +__all__ = [ + "types", + "ANONYMOUS", + "ANONYMOUS_API_TOKEN", + "NeptunePossibleLegacyUsageException", + "NeptuneUninitializedException", + "get_project", + "init", + "init_model", + "init_model_version", + "init_project", + "init_run", + "Run", + "__version__", + "create_experiment", + "get_experiment", + "append_tag", + "append_tags", + "remove_tag", + "set_property", + "remove_property", + "send_metric", + "log_metric", + "send_text", + "log_text", + "send_image", + "log_image", + "send_artifact", + "delete_artifacts", + "log_artifact", + "stop", + "get_last_run", +] + +from typing import Optional from neptune.common.patches import apply_patches -from neptune.version import __version__ +from neptune.new import types +from neptune.new.constants import ( + ANONYMOUS, + ANONYMOUS_API_TOKEN, +) +from neptune.new.exceptions import ( + NeptunePossibleLegacyUsageException, + NeptuneUninitializedException, +) +from neptune.new.internal.init import ( + get_project, + init, + init_model, + init_model_version, + init_project, + init_run, +) +from neptune.new.internal.utils.deprecation import deprecated +from neptune.new.metadata_containers import Run +from neptune.version import version + + +def _raise_legacy_client_expected(*args, **kwargs): + raise NeptunePossibleLegacyUsageException() + + +create_experiment = ( + get_experiment +) = ( + append_tag +) = ( + append_tags +) = ( + remove_tag +) = ( + set_property +) = ( + remove_property +) = ( + send_metric +) = ( + log_metric +) = ( + send_text +) = ( + log_text +) = send_image = log_image = send_artifact = delete_artifacts = log_artifact = stop = _raise_legacy_client_expected + + +@deprecated() +def get_last_run() -> Optional[Run]: + """Returns last created Run object. + + Returns: + ``Run``: object last created by neptune global object. + + Examples: + >>> import neptune.new as neptune + + >>> # Crate a new tracked run + ... neptune.init_run(name='A new approach', source_files='**/*.py') + ... # Oops! We didn't capture the reference to the Run object + + >>> # Not a problem! We've got you covered. + ... run = neptune.get_last_run() + + You may also want to check `get_last_run docs page`_. + + .. _get_last_run docs page: + https://docs.neptune.ai/api/neptune/#get_last_run + """ + last_run = Run.last_run + if last_run is None: + raise NeptuneUninitializedException() + return last_run + + +__version__ = str(version) + # Apply patches of external libraries apply_patches() diff --git a/src/neptune/new/__init__.py b/src/neptune/new/__init__.py index 5a4417014..61c274601 100644 --- a/src/neptune/new/__init__.py +++ b/src/neptune/new/__init__.py @@ -57,82 +57,36 @@ "get_last_run", ] -from typing import Optional - -from neptune.new import types -from neptune.new.constants import ( +from neptune import ( ANONYMOUS, ANONYMOUS_API_TOKEN, -) -from neptune.new.exceptions import ( NeptunePossibleLegacyUsageException, NeptuneUninitializedException, -) -from neptune.new.internal.init import ( + Run, + __version__, + append_tag, + append_tags, + create_experiment, + delete_artifacts, + get_experiment, + get_last_run, get_project, init, init_model, init_model_version, init_project, init_run, + log_artifact, + log_image, + log_metric, + log_text, + remove_property, + remove_tag, + send_artifact, + send_image, + send_metric, + send_text, + set_property, + stop, + types, ) -from neptune.new.internal.utils.deprecation import deprecated -from neptune.new.metadata_containers import Run -from neptune.new.version import version - -__version__ = str(version) - - -def _raise_legacy_client_expected(*args, **kwargs): - raise NeptunePossibleLegacyUsageException() - - -create_experiment = ( - get_experiment -) = ( - append_tag -) = ( - append_tags -) = ( - remove_tag -) = ( - set_property -) = ( - remove_property -) = ( - send_metric -) = ( - log_metric -) = ( - send_text -) = ( - log_text -) = send_image = log_image = send_artifact = delete_artifacts = log_artifact = stop = _raise_legacy_client_expected - - -@deprecated() -def get_last_run() -> Optional[Run]: - """Returns last created Run object. - - Returns: - ``Run``: object last created by neptune global object. - - Examples: - >>> import neptune.new as neptune - - >>> # Crate a new tracked run - ... neptune.init_run(name='A new approach', source_files='**/*.py') - ... # Oops! We didn't capture the reference to the Run object - - >>> # Not a problem! We've got you covered. - ... run = neptune.get_last_run() - - You may also want to check `get_last_run docs page`_. - - .. _get_last_run docs page: - https://docs.neptune.ai/api/neptune/#get_last_run - """ - last_run = Run.last_run - if last_run is None: - raise NeptuneUninitializedException() - return last_run From f204f920706708540f7e0e3ee5b540e588c75b10 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 14:36:19 +0100 Subject: [PATCH 07/33] Moved envs --- src/neptune/envs.py | 56 +++++++++++++++++++++++++++++++++++++++++ src/neptune/new/envs.py | 34 ++++++++----------------- 2 files changed, 67 insertions(+), 23 deletions(-) create mode 100644 src/neptune/envs.py diff --git a/src/neptune/envs.py b/src/neptune/envs.py new file mode 100644 index 000000000..2180732ce --- /dev/null +++ b/src/neptune/envs.py @@ -0,0 +1,56 @@ +# +# Copyright (c) 2022, Neptune Labs Sp. z o.o. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__all__ = [ + "API_TOKEN_ENV_NAME", + "CONNECTION_MODE", + "PROJECT_ENV_NAME", + "CUSTOM_RUN_ID_ENV_NAME", + "MONITORING_NAMESPACE", + "NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE", + "NEPTUNE_NOTEBOOK_ID", + "NEPTUNE_NOTEBOOK_PATH", + "NEPTUNE_RETRIES_TIMEOUT_ENV", + "NEPTUNE_SYNC_BATCH_TIMEOUT_ENV", + "NEPTUNE_SUBPROCESS_KILL_TIMEOUT", + "NEPTUNE_FETCH_TABLE_STEP_SIZE", +] + +from neptune.common.envs import ( + API_TOKEN_ENV_NAME, + NEPTUNE_RETRIES_TIMEOUT_ENV, +) + +CONNECTION_MODE = "NEPTUNE_MODE" + +PROJECT_ENV_NAME = "NEPTUNE_PROJECT" + +CUSTOM_RUN_ID_ENV_NAME = "NEPTUNE_CUSTOM_RUN_ID" + +MONITORING_NAMESPACE = "NEPTUNE_MONITORING_NAMESPACE" + +NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE = "NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE" + +NEPTUNE_NOTEBOOK_ID = "NEPTUNE_NOTEBOOK_ID" + +NEPTUNE_NOTEBOOK_PATH = "NEPTUNE_NOTEBOOK_PATH" + +NEPTUNE_SYNC_BATCH_TIMEOUT_ENV = "NEPTUNE_SYNC_BATCH_TIMEOUT" + +NEPTUNE_SUBPROCESS_KILL_TIMEOUT = "NEPTUNE_SUBPROCESS_KILL_TIMEOUT" + +NEPTUNE_FETCH_TABLE_STEP_SIZE = "NEPTUNE_FETCH_TABLE_STEP_SIZE" + +S3_ENDPOINT_URL = "S3_ENDPOINT_URL" diff --git a/src/neptune/new/envs.py b/src/neptune/new/envs.py index 2180732ce..d90e54871 100644 --- a/src/neptune/new/envs.py +++ b/src/neptune/new/envs.py @@ -28,29 +28,17 @@ "NEPTUNE_FETCH_TABLE_STEP_SIZE", ] -from neptune.common.envs import ( +from neptune.envs import ( API_TOKEN_ENV_NAME, + CONNECTION_MODE, + CUSTOM_RUN_ID_ENV_NAME, + MONITORING_NAMESPACE, + NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE, + NEPTUNE_FETCH_TABLE_STEP_SIZE, + NEPTUNE_NOTEBOOK_ID, + NEPTUNE_NOTEBOOK_PATH, NEPTUNE_RETRIES_TIMEOUT_ENV, + NEPTUNE_SUBPROCESS_KILL_TIMEOUT, + NEPTUNE_SYNC_BATCH_TIMEOUT_ENV, + PROJECT_ENV_NAME, ) - -CONNECTION_MODE = "NEPTUNE_MODE" - -PROJECT_ENV_NAME = "NEPTUNE_PROJECT" - -CUSTOM_RUN_ID_ENV_NAME = "NEPTUNE_CUSTOM_RUN_ID" - -MONITORING_NAMESPACE = "NEPTUNE_MONITORING_NAMESPACE" - -NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE = "NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE" - -NEPTUNE_NOTEBOOK_ID = "NEPTUNE_NOTEBOOK_ID" - -NEPTUNE_NOTEBOOK_PATH = "NEPTUNE_NOTEBOOK_PATH" - -NEPTUNE_SYNC_BATCH_TIMEOUT_ENV = "NEPTUNE_SYNC_BATCH_TIMEOUT" - -NEPTUNE_SUBPROCESS_KILL_TIMEOUT = "NEPTUNE_SUBPROCESS_KILL_TIMEOUT" - -NEPTUNE_FETCH_TABLE_STEP_SIZE = "NEPTUNE_FETCH_TABLE_STEP_SIZE" - -S3_ENDPOINT_URL = "S3_ENDPOINT_URL" From caa433bae46a6f73c4970e99008f2a6a449742a2 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 14:37:28 +0100 Subject: [PATCH 08/33] Constants moved --- src/neptune/constants.py | 44 ++++++++++++++++++++++++++++++++++++ src/neptune/new/constants.py | 24 ++++++++------------ 2 files changed, 53 insertions(+), 15 deletions(-) create mode 100644 src/neptune/constants.py diff --git a/src/neptune/constants.py b/src/neptune/constants.py new file mode 100644 index 000000000..bd761ac05 --- /dev/null +++ b/src/neptune/constants.py @@ -0,0 +1,44 @@ +# +# Copyright (c) 2022, Neptune Labs Sp. z o.o. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__all__ = [ + "ANONYMOUS", + "ANONYMOUS_API_TOKEN", + "NEPTUNE_DATA_DIRECTORY", + "NEPTUNE_RUNS_DIRECTORY", + "OFFLINE_DIRECTORY", + "ASYNC_DIRECTORY", + "SYNC_DIRECTORY", + "OFFLINE_NAME_PREFIX", +] + +"""Constants used by Neptune""" + +ANONYMOUS = "ANONYMOUS" + +ANONYMOUS_API_TOKEN = ( + "eyJhcGlfYWRkcmVzcyI6Imh0dHBzOi8vYXBwLm5lcHR1bmUuYWkiLCJhcGlfdXJsIjoiaHR0cHM6Ly9hcHAubmVwdHVuZS" + "5haSIsImFwaV9rZXkiOiJiNzA2YmM4Zi03NmY5LTRjMmUtOTM5ZC00YmEwMzZmOTMyZTQifQo=" +) + +NEPTUNE_DATA_DIRECTORY = ".neptune" +# backwards compat +NEPTUNE_RUNS_DIRECTORY = NEPTUNE_DATA_DIRECTORY + +OFFLINE_DIRECTORY = "offline" +ASYNC_DIRECTORY = "async" +SYNC_DIRECTORY = "sync" + +OFFLINE_NAME_PREFIX = "offline/" diff --git a/src/neptune/new/constants.py b/src/neptune/new/constants.py index bd761ac05..f0ff25ae8 100644 --- a/src/neptune/new/constants.py +++ b/src/neptune/new/constants.py @@ -26,19 +26,13 @@ """Constants used by Neptune""" -ANONYMOUS = "ANONYMOUS" - -ANONYMOUS_API_TOKEN = ( - "eyJhcGlfYWRkcmVzcyI6Imh0dHBzOi8vYXBwLm5lcHR1bmUuYWkiLCJhcGlfdXJsIjoiaHR0cHM6Ly9hcHAubmVwdHVuZS" - "5haSIsImFwaV9rZXkiOiJiNzA2YmM4Zi03NmY5LTRjMmUtOTM5ZC00YmEwMzZmOTMyZTQifQo=" +from neptune.constants import ( + ANONYMOUS, + ANONYMOUS_API_TOKEN, + ASYNC_DIRECTORY, + NEPTUNE_DATA_DIRECTORY, + NEPTUNE_RUNS_DIRECTORY, + OFFLINE_DIRECTORY, + OFFLINE_NAME_PREFIX, + SYNC_DIRECTORY, ) - -NEPTUNE_DATA_DIRECTORY = ".neptune" -# backwards compat -NEPTUNE_RUNS_DIRECTORY = NEPTUNE_DATA_DIRECTORY - -OFFLINE_DIRECTORY = "offline" -ASYNC_DIRECTORY = "async" -SYNC_DIRECTORY = "sync" - -OFFLINE_NAME_PREFIX = "offline/" From f89b2cbc2f80300fee62a2f11736ae4e3e74cc2a Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 14:38:22 +0100 Subject: [PATCH 09/33] Year bumped --- src/neptune/__init__.py | 2 +- src/neptune/constants.py | 2 +- src/neptune/envs.py | 2 +- src/neptune/exceptions.py | 2 +- src/neptune/handler.py | 2 +- src/neptune/utils.py | 2 +- src/neptune/version.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/neptune/__init__.py b/src/neptune/__init__.py index 2a55ee2d6..2f5e7715c 100644 --- a/src/neptune/__init__.py +++ b/src/neptune/__init__.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, Neptune Labs Sp. z o.o. +# Copyright (c) 2023, Neptune Labs Sp. z o.o. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/neptune/constants.py b/src/neptune/constants.py index bd761ac05..7cf30d85a 100644 --- a/src/neptune/constants.py +++ b/src/neptune/constants.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, Neptune Labs Sp. z o.o. +# Copyright (c) 2023, Neptune Labs Sp. z o.o. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/neptune/envs.py b/src/neptune/envs.py index 2180732ce..db437f173 100644 --- a/src/neptune/envs.py +++ b/src/neptune/envs.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, Neptune Labs Sp. z o.o. +# Copyright (c) 2023, Neptune Labs Sp. z o.o. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/neptune/exceptions.py b/src/neptune/exceptions.py index e41b366c2..5ada35fc7 100644 --- a/src/neptune/exceptions.py +++ b/src/neptune/exceptions.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, Neptune Labs Sp. z o.o. +# Copyright (c) 2023, Neptune Labs Sp. z o.o. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/neptune/handler.py b/src/neptune/handler.py index ad93b8cce..041124ee7 100644 --- a/src/neptune/handler.py +++ b/src/neptune/handler.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, Neptune Labs Sp. z o.o. +# Copyright (c) 2023, Neptune Labs Sp. z o.o. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/neptune/utils.py b/src/neptune/utils.py index 0875e4302..2d7bb31a1 100644 --- a/src/neptune/utils.py +++ b/src/neptune/utils.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, Neptune Labs Sp. z o.o. +# Copyright (c) 2023, Neptune Labs Sp. z o.o. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/neptune/version.py b/src/neptune/version.py index 2da91a9c2..c4d4d20f4 100644 --- a/src/neptune/version.py +++ b/src/neptune/version.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, Neptune Labs Sp. z o.o. +# Copyright (c) 2023, Neptune Labs Sp. z o.o. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From 7930eacbcecbde9c00789aa48a929465e8bd1f62 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 14:47:46 +0100 Subject: [PATCH 10/33] init fixed --- src/neptune/__init__.py | 55 ++----------------------------------- src/neptune/new/__init__.py | 51 ++++++++++++++++++++-------------- 2 files changed, 33 insertions(+), 73 deletions(-) diff --git a/src/neptune/__init__.py b/src/neptune/__init__.py index 2f5e7715c..db5cc2c5a 100644 --- a/src/neptune/__init__.py +++ b/src/neptune/__init__.py @@ -14,11 +14,8 @@ # limitations under the License. # __all__ = [ - "types", "ANONYMOUS", "ANONYMOUS_API_TOKEN", - "NeptunePossibleLegacyUsageException", - "NeptuneUninitializedException", "get_project", "init", "init_model", @@ -27,38 +24,17 @@ "init_run", "Run", "__version__", - "create_experiment", - "get_experiment", - "append_tag", - "append_tags", - "remove_tag", - "set_property", - "remove_property", - "send_metric", - "log_metric", - "send_text", - "log_text", - "send_image", - "log_image", - "send_artifact", - "delete_artifacts", - "log_artifact", - "stop", "get_last_run", ] from typing import Optional from neptune.common.patches import apply_patches -from neptune.new import types -from neptune.new.constants import ( +from neptune.constants import ( ANONYMOUS, ANONYMOUS_API_TOKEN, ) -from neptune.new.exceptions import ( - NeptunePossibleLegacyUsageException, - NeptuneUninitializedException, -) +from neptune.exceptions import NeptuneUninitializedException from neptune.new.internal.init import ( get_project, init, @@ -72,33 +48,6 @@ from neptune.version import version -def _raise_legacy_client_expected(*args, **kwargs): - raise NeptunePossibleLegacyUsageException() - - -create_experiment = ( - get_experiment -) = ( - append_tag -) = ( - append_tags -) = ( - remove_tag -) = ( - set_property -) = ( - remove_property -) = ( - send_metric -) = ( - log_metric -) = ( - send_text -) = ( - log_text -) = send_image = log_image = send_artifact = delete_artifacts = log_artifact = stop = _raise_legacy_client_expected - - @deprecated() def get_last_run() -> Optional[Run]: """Returns last created Run object. diff --git a/src/neptune/new/__init__.py b/src/neptune/new/__init__.py index 61c274601..963446311 100644 --- a/src/neptune/new/__init__.py +++ b/src/neptune/new/__init__.py @@ -60,15 +60,8 @@ from neptune import ( ANONYMOUS, ANONYMOUS_API_TOKEN, - NeptunePossibleLegacyUsageException, - NeptuneUninitializedException, Run, __version__, - append_tag, - append_tags, - create_experiment, - delete_artifacts, - get_experiment, get_last_run, get_project, init, @@ -76,17 +69,35 @@ init_model_version, init_project, init_run, - log_artifact, - log_image, - log_metric, - log_text, - remove_property, - remove_tag, - send_artifact, - send_image, - send_metric, - send_text, - set_property, - stop, - types, ) +from neptune.exceptions import ( + NeptunePossibleLegacyUsageException, + NeptuneUninitializedException, +) + + +def _raise_legacy_client_expected(*args, **kwargs): + raise NeptunePossibleLegacyUsageException() + + +create_experiment = ( + get_experiment +) = ( + append_tag +) = ( + append_tags +) = ( + remove_tag +) = ( + set_property +) = ( + remove_property +) = ( + send_metric +) = ( + log_metric +) = ( + send_text +) = ( + log_text +) = send_image = log_image = send_artifact = delete_artifacts = log_artifact = stop = _raise_legacy_client_expected From 8dd709011fc96198f83c8ad6405038e73e42f46f Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 14:53:23 +0100 Subject: [PATCH 11/33] minimal legacy rename --- .../hosted_api_clients/hosted_alpha_leaderboard_api_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neptune/legacy/internal/api_clients/hosted_api_clients/hosted_alpha_leaderboard_api_client.py b/src/neptune/legacy/internal/api_clients/hosted_api_clients/hosted_alpha_leaderboard_api_client.py index 08499e549..61f266558 100644 --- a/src/neptune/legacy/internal/api_clients/hosted_api_clients/hosted_alpha_leaderboard_api_client.py +++ b/src/neptune/legacy/internal/api_clients/hosted_api_clients/hosted_alpha_leaderboard_api_client.py @@ -36,6 +36,7 @@ import six from bravado.exception import HTTPNotFound +import neptune.exceptions as alpha_exceptions from neptune.common import exceptions as common_exceptions from neptune.common.exceptions import ClientHttpError from neptune.common.storage.storage_utils import normalize_file_name @@ -84,7 +85,6 @@ LeaderboardEntry, ) from neptune.legacy.notebook import Notebook -from neptune.new import exceptions as alpha_exceptions from neptune.new.attributes import constants as alpha_consts from neptune.new.attributes.constants import ( MONITORING_TRACEBACK_ATTRIBUTE_PATH, From 9847f9ad7a84704df39451c55580f9444c0b8ccf Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 14:54:52 +0100 Subject: [PATCH 12/33] docstrings for legacy client updated --- src/neptune/legacy/__init__.py | 6 +++--- src/neptune/legacy/projects.py | 2 +- src/neptune/legacy/sessions.py | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/neptune/legacy/__init__.py b/src/neptune/legacy/__init__.py index 2749f1a68..dd7c680a8 100644 --- a/src/neptune/legacy/__init__.py +++ b/src/neptune/legacy/__init__.py @@ -148,7 +148,7 @@ def init(project_qualified_name=None, api_token=None, proxies=None, backend=None .. code :: python3 - from neptune import HostedNeptuneBackendApiClient + from neptune.legacy import HostedNeptuneBackendApiClient neptune.init(backend=HostedNeptuneBackendApiClient(proxies=...)) backend (:class:`~neptune.ApiClient`, optional, default is ``None``): @@ -159,7 +159,7 @@ def init(project_qualified_name=None, api_token=None, proxies=None, backend=None .. code :: python3 - from neptune import HostedNeptuneBackendApiClient + from neptune.legacy import HostedNeptuneBackendApiClient neptune.init(backend=HostedNeptuneBackendApiClient(...)) Passing an instance of :class:`~neptune.OfflineApiClient` makes your code run without communicating @@ -167,7 +167,7 @@ def init(project_qualified_name=None, api_token=None, proxies=None, backend=None .. code :: python3 - from neptune import OfflineApiClient + from neptune.legacy import OfflineApiClient neptune.init(backend=OfflineApiClient()) .. note:: diff --git a/src/neptune/legacy/projects.py b/src/neptune/legacy/projects.py index 747638c3f..6f80811bd 100644 --- a/src/neptune/legacy/projects.py +++ b/src/neptune/legacy/projects.py @@ -328,7 +328,7 @@ def create_experiment( then no information about git is displayed in experiment details in Neptune web application. hostname (:obj:`str`, optional, default is ``None``): - If ``None``, neptune automatically get `hostname` information. + If ``None``, neptune.legacy automatically get `hostname` information. User can also set `hostname` directly by passing :obj:`str`. Returns: diff --git a/src/neptune/legacy/sessions.py b/src/neptune/legacy/sessions.py index 61fec68b0..e936c4ec9 100644 --- a/src/neptune/legacy/sessions.py +++ b/src/neptune/legacy/sessions.py @@ -39,7 +39,7 @@ class Session(object): .. code :: python3 - from neptune import Session, HostedNeptuneBackendApiClient + from neptune.legacy import Session, HostedNeptuneBackendApiClient session = Session(backend=HostedNeptuneBackendApiClient(...)) Passing an instance of :class:`~neptune.OfflineApiClient` makes your code run without communicating @@ -47,7 +47,7 @@ class Session(object): .. code :: python3 - from neptune import Session, OfflineApiClient + from neptune.legacy import Session, OfflineApiClient session = Session(backend=OfflineApiClient()) api_token (:obj:`str`, optional, default is ``None``): @@ -60,7 +60,7 @@ class Session(object): .. code :: python3 - from neptune import Session + from neptune.legacy import Session session = Session.with_default_backend(api_token='...') proxies (:obj:`str`, optional, default is ``None``): @@ -75,7 +75,7 @@ class Session(object): .. code :: python3 - from neptune import Session, HostedNeptuneBackendApiClient + from neptune.legacy import Session, HostedNeptuneBackendApiClient session = Session(backend=HostedNeptuneBackendApiClient(proxies=...)) Examples: @@ -84,21 +84,21 @@ class Session(object): .. code:: python3 - from neptune import Session + from neptune.legacy import Session session = Session.with_default_backend() Create session and pass ``api_token`` .. code:: python3 - from neptune import Session + from neptune.legacy import Session session = Session.with_default_backend(api_token='...') Create an offline session .. code:: python3 - from neptune import Session, OfflineApiClient + from neptune.legacy import Session, OfflineApiClient session = Session(backend=OfflineApiClient()) """ @@ -135,7 +135,7 @@ def with_default_backend(cls, api_token=None, proxies=None): .. code :: python3 - from neptune import Session + from neptune.legacy import Session session = Session.with_default_backend() """ From 0317997f6e7c51f9c7d13064bde7d7fbe1c86a83 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 15:05:40 +0100 Subject: [PATCH 13/33] Imports up-to-date --- src/neptune/new/attributes/attribute.py | 2 +- src/neptune/new/attributes/series/file_series.py | 4 ++-- src/neptune/new/cli/clear.py | 2 +- src/neptune/new/cli/commands.py | 10 +++++----- src/neptune/new/cli/container_manager.py | 10 +++++----- src/neptune/new/cli/path_option.py | 4 ++-- src/neptune/new/cli/status.py | 4 ++-- src/neptune/new/cli/sync.py | 14 +++++++------- src/neptune/new/cli/utils.py | 6 +++--- src/neptune/new/integrations/aws/__init__.py | 2 +- .../new/integrations/detectron2/__init__.py | 2 +- src/neptune/new/integrations/fastai/__init__.py | 2 +- src/neptune/new/integrations/kedro/__init__.py | 2 +- src/neptune/new/integrations/lightgbm/__init__.py | 2 +- src/neptune/new/integrations/optuna/__init__.py | 2 +- src/neptune/new/integrations/prophet/__init__.py | 2 +- src/neptune/new/integrations/python_logger.py | 4 ++-- .../new/integrations/pytorch_lightning/__init__.py | 2 +- src/neptune/new/integrations/sacred/__init__.py | 2 +- src/neptune/new/integrations/sklearn/__init__.py | 2 +- .../new/integrations/tensorflow_keras/__init__.py | 2 +- .../new/integrations/transformers/__init__.py | 2 +- src/neptune/new/integrations/utils.py | 6 +++--- src/neptune/new/integrations/xgboost/__init__.py | 2 +- .../new/internal/artifacts/drivers/local.py | 2 +- src/neptune/new/internal/artifacts/drivers/s3.py | 2 +- src/neptune/new/internal/artifacts/types.py | 2 +- .../backends/hosted_artifact_operations.py | 2 +- src/neptune/new/internal/backends/hosted_client.py | 4 ++-- .../internal/backends/hosted_file_operations.py | 2 +- .../internal/backends/hosted_neptune_backend.py | 8 ++++---- .../new/internal/backends/neptune_backend_mock.py | 2 +- .../internal/backends/offline_neptune_backend.py | 2 +- .../internal/backends/operations_preprocessor.py | 2 +- .../new/internal/backends/project_name_lookup.py | 4 ++-- .../internal/backends/swagger_client_wrapper.py | 2 +- src/neptune/new/internal/backends/utils.py | 4 ++-- src/neptune/new/internal/container_structure.py | 2 +- src/neptune/new/internal/credentials.py | 8 ++++---- src/neptune/new/internal/disk_queue.py | 2 +- src/neptune/new/internal/init/model.py | 6 +++--- src/neptune/new/internal/init/model_version.py | 6 +++--- src/neptune/new/internal/init/project.py | 4 ++-- src/neptune/new/internal/init/run.py | 8 ++++---- src/neptune/new/internal/operation.py | 2 +- .../async_operation_processor.py | 4 ++-- .../offline_operation_processor.py | 2 +- .../operation_processors/operation_storage.py | 2 +- .../sync_operation_processor.py | 2 +- src/neptune/new/internal/types/file_types.py | 2 +- src/neptune/new/internal/utils/deprecation.py | 2 +- src/neptune/new/internal/utils/images.py | 2 +- src/neptune/new/internal/utils/process_killer.py | 2 +- src/neptune/new/internal/utils/s3.py | 2 +- src/neptune/new/internal/utils/source_code.py | 2 +- .../new/internal/value_to_attribute_visitor.py | 2 +- .../new/metadata_containers/metadata_container.py | 12 ++++++------ .../metadata_containers_table.py | 2 +- .../new/metadata_containers/model_version.py | 2 +- src/neptune/new/types/type_casting.py | 2 +- 60 files changed, 105 insertions(+), 105 deletions(-) diff --git a/src/neptune/new/attributes/attribute.py b/src/neptune/new/attributes/attribute.py index e6a48fdb0..267f79b37 100644 --- a/src/neptune/new/attributes/attribute.py +++ b/src/neptune/new/attributes/attribute.py @@ -20,7 +20,7 @@ List, ) -from neptune.new.exceptions import TypeDoesNotSupportAttributeException +from neptune.exceptions import TypeDoesNotSupportAttributeException from neptune.new.internal.backends.neptune_backend import NeptuneBackend from neptune.new.internal.operation import Operation from neptune.new.types.value_copy import ValueCopy diff --git a/src/neptune/new/attributes/series/file_series.py b/src/neptune/new/attributes/series/file_series.py index dbb881a17..077230222 100644 --- a/src/neptune/new/attributes/series/file_series.py +++ b/src/neptune/new/attributes/series/file_series.py @@ -24,11 +24,11 @@ Optional, ) -from neptune.new.attributes.series.series import Series -from neptune.new.exceptions import ( +from neptune.exceptions import ( FileNotFound, OperationNotSupported, ) +from neptune.new.attributes.series.series import Series from neptune.new.internal.operation import ( ClearImageLog, ImageValue, diff --git a/src/neptune/new/cli/clear.py b/src/neptune/new/cli/clear.py index 4073b9231..f74e41706 100644 --- a/src/neptune/new/cli/clear.py +++ b/src/neptune/new/cli/clear.py @@ -22,11 +22,11 @@ import click +from neptune.constants import SYNC_DIRECTORY from neptune.new.cli.abstract_backend_runner import AbstractBackendRunner from neptune.new.cli.container_manager import ContainersManager from neptune.new.cli.status import StatusRunner from neptune.new.cli.utils import get_offline_dirs -from neptune.new.constants import SYNC_DIRECTORY from neptune.new.internal.backends.api_model import ApiExperiment from neptune.new.internal.id_formats import UniqueId from neptune.new.internal.utils.logger import logger diff --git a/src/neptune/new/cli/commands.py b/src/neptune/new/cli/commands.py index c902572a0..a9e3c65ce 100644 --- a/src/neptune/new/cli/commands.py +++ b/src/neptune/new/cli/commands.py @@ -25,15 +25,15 @@ import click from neptune.common.exceptions import NeptuneException # noqa: F401 -from neptune.new.cli.clear import ClearRunner -from neptune.new.cli.path_option import path_option -from neptune.new.cli.status import StatusRunner -from neptune.new.cli.sync import SyncRunner -from neptune.new.exceptions import ( # noqa: F401 +from neptune.exceptions import ( # noqa: F401 CannotSynchronizeOfflineRunsWithoutProject, ProjectNotFound, RunNotFound, ) +from neptune.new.cli.clear import ClearRunner +from neptune.new.cli.path_option import path_option +from neptune.new.cli.status import StatusRunner +from neptune.new.cli.sync import SyncRunner from neptune.new.internal.backends.api_model import ( # noqa: F401 ApiExperiment, Project, diff --git a/src/neptune/new/cli/container_manager.py b/src/neptune/new/cli/container_manager.py index 14dc1b40f..651b34c61 100644 --- a/src/neptune/new/cli/container_manager.py +++ b/src/neptune/new/cli/container_manager.py @@ -23,16 +23,16 @@ Tuple, ) +from neptune.constants import ( + ASYNC_DIRECTORY, + OFFLINE_DIRECTORY, + SYNC_DIRECTORY, +) from neptune.new.cli.utils import ( get_metadata_container, is_container_synced_and_remove_junk, iterate_containers, ) -from neptune.new.constants import ( - ASYNC_DIRECTORY, - OFFLINE_DIRECTORY, - SYNC_DIRECTORY, -) from neptune.new.internal.backends.api_model import ApiExperiment from neptune.new.internal.backends.neptune_backend import NeptuneBackend from neptune.new.internal.id_formats import UniqueId diff --git a/src/neptune/new/cli/path_option.py b/src/neptune/new/cli/path_option.py index 6d5ff93a4..7599005e3 100644 --- a/src/neptune/new/cli/path_option.py +++ b/src/neptune/new/cli/path_option.py @@ -21,8 +21,8 @@ import click from neptune.common.exceptions import NeptuneException # noqa: F401 -from neptune.new.constants import NEPTUNE_DATA_DIRECTORY -from neptune.new.exceptions import ( # noqa: F401 +from neptune.constants import NEPTUNE_DATA_DIRECTORY +from neptune.exceptions import ( # noqa: F401 CannotSynchronizeOfflineRunsWithoutProject, ProjectNotFound, RunNotFound, diff --git a/src/neptune/new/cli/status.py b/src/neptune/new/cli/status.py index 770c29ad1..fd055edfc 100644 --- a/src/neptune/new/cli/status.py +++ b/src/neptune/new/cli/status.py @@ -24,14 +24,14 @@ Sequence, ) +from neptune.constants import OFFLINE_NAME_PREFIX +from neptune.envs import PROJECT_ENV_NAME from neptune.new.cli.abstract_backend_runner import AbstractBackendRunner from neptune.new.cli.container_manager import ContainersManager from neptune.new.cli.utils import ( get_offline_dirs, get_qualified_name, ) -from neptune.new.constants import OFFLINE_NAME_PREFIX -from neptune.new.envs import PROJECT_ENV_NAME from neptune.new.internal.backends.api_model import ApiExperiment from neptune.new.internal.utils.logger import logger diff --git a/src/neptune/new/cli/sync.py b/src/neptune/new/cli/sync.py index 000dd591c..0ff44146e 100644 --- a/src/neptune/new/cli/sync.py +++ b/src/neptune/new/cli/sync.py @@ -29,6 +29,13 @@ ) from neptune.common.exceptions import NeptuneConnectionLostException +from neptune.constants import ( + ASYNC_DIRECTORY, + OFFLINE_DIRECTORY, + OFFLINE_NAME_PREFIX, +) +from neptune.envs import NEPTUNE_SYNC_BATCH_TIMEOUT_ENV +from neptune.exceptions import CannotSynchronizeOfflineRunsWithoutProject from neptune.new.cli.abstract_backend_runner import AbstractBackendRunner from neptune.new.cli.utils import ( get_metadata_container, @@ -39,13 +46,6 @@ iterate_containers, split_dir_name, ) -from neptune.new.constants import ( - ASYNC_DIRECTORY, - OFFLINE_DIRECTORY, - OFFLINE_NAME_PREFIX, -) -from neptune.new.envs import NEPTUNE_SYNC_BATCH_TIMEOUT_ENV -from neptune.new.exceptions import CannotSynchronizeOfflineRunsWithoutProject from neptune.new.internal.backends.api_model import ( ApiExperiment, Project, diff --git a/src/neptune/new/cli/utils.py b/src/neptune/new/cli/utils.py index 8b5a564c8..59edfcfd8 100644 --- a/src/neptune/new/cli/utils.py +++ b/src/neptune/new/cli/utils.py @@ -38,9 +38,9 @@ ) from neptune.common.exceptions import NeptuneException -from neptune.new.constants import OFFLINE_DIRECTORY -from neptune.new.envs import PROJECT_ENV_NAME -from neptune.new.exceptions import ( +from neptune.constants import OFFLINE_DIRECTORY +from neptune.envs import PROJECT_ENV_NAME +from neptune.exceptions import ( MetadataContainerNotFound, ProjectNotFound, ) diff --git a/src/neptune/new/integrations/aws/__init__.py b/src/neptune/new/integrations/aws/__init__.py index 6389c0aa5..289404d1e 100644 --- a/src/neptune/new/integrations/aws/__init__.py +++ b/src/neptune/new/integrations/aws/__init__.py @@ -18,7 +18,7 @@ from neptune_aws.impl import * # noqa: F401,F403 except ModuleNotFoundError as e: if e.name == "neptune_aws": - from neptune.new.exceptions import NeptuneIntegrationNotInstalledException + from neptune.exceptions import NeptuneIntegrationNotInstalledException raise NeptuneIntegrationNotInstalledException( integration_package_name="neptune-aws", framework_name="aws" diff --git a/src/neptune/new/integrations/detectron2/__init__.py b/src/neptune/new/integrations/detectron2/__init__.py index 663cab02d..ac081b1c9 100644 --- a/src/neptune/new/integrations/detectron2/__init__.py +++ b/src/neptune/new/integrations/detectron2/__init__.py @@ -18,7 +18,7 @@ from neptune_detectron2.impl import * # noqa: F401,F403 except ModuleNotFoundError as e: if e.name == "neptune_detectron2": - from neptune.new.exceptions import NeptuneIntegrationNotInstalledException + from neptune.exceptions import NeptuneIntegrationNotInstalledException raise NeptuneIntegrationNotInstalledException( integration_package_name="neptune-detectron2", diff --git a/src/neptune/new/integrations/fastai/__init__.py b/src/neptune/new/integrations/fastai/__init__.py index 306f79bce..8847d2056 100644 --- a/src/neptune/new/integrations/fastai/__init__.py +++ b/src/neptune/new/integrations/fastai/__init__.py @@ -18,7 +18,7 @@ from neptune_fastai.impl import * # noqa: F401,F403 except ModuleNotFoundError as e: if e.name == "neptune_fastai": - from neptune.new.exceptions import NeptuneIntegrationNotInstalledException + from neptune.exceptions import NeptuneIntegrationNotInstalledException raise NeptuneIntegrationNotInstalledException( integration_package_name="neptune-fastai", framework_name="fastai" diff --git a/src/neptune/new/integrations/kedro/__init__.py b/src/neptune/new/integrations/kedro/__init__.py index ff0ed9cbf..2599d80fb 100644 --- a/src/neptune/new/integrations/kedro/__init__.py +++ b/src/neptune/new/integrations/kedro/__init__.py @@ -18,7 +18,7 @@ from kedro_neptune import * # noqa: F401,F403 except ModuleNotFoundError as e: if e.name == "kedro_neptune": - from neptune.new.exceptions import NeptuneIntegrationNotInstalledException + from neptune.exceptions import NeptuneIntegrationNotInstalledException raise NeptuneIntegrationNotInstalledException( integration_package_name="kedro-neptune", framework_name="kedro" diff --git a/src/neptune/new/integrations/lightgbm/__init__.py b/src/neptune/new/integrations/lightgbm/__init__.py index d6db6926e..83a36ea62 100644 --- a/src/neptune/new/integrations/lightgbm/__init__.py +++ b/src/neptune/new/integrations/lightgbm/__init__.py @@ -18,7 +18,7 @@ from neptune_lightgbm.impl import * # noqa: F401,F403 except ModuleNotFoundError as e: if e.name == "neptune_lightgbm": - from neptune.new.exceptions import NeptuneIntegrationNotInstalledException + from neptune.exceptions import NeptuneIntegrationNotInstalledException raise NeptuneIntegrationNotInstalledException( integration_package_name="neptune-lightgbm", framework_name="lightgbm" diff --git a/src/neptune/new/integrations/optuna/__init__.py b/src/neptune/new/integrations/optuna/__init__.py index d6d86cee8..105f12fb1 100644 --- a/src/neptune/new/integrations/optuna/__init__.py +++ b/src/neptune/new/integrations/optuna/__init__.py @@ -18,7 +18,7 @@ from neptune_optuna.impl import * # noqa: F401,F403 except ModuleNotFoundError as e: if e.name == "neptune_optuna": - from neptune.new.exceptions import NeptuneIntegrationNotInstalledException + from neptune.exceptions import NeptuneIntegrationNotInstalledException raise NeptuneIntegrationNotInstalledException( integration_package_name="neptune-optuna", framework_name="optuna" diff --git a/src/neptune/new/integrations/prophet/__init__.py b/src/neptune/new/integrations/prophet/__init__.py index 51ed1b18e..6553f86dc 100644 --- a/src/neptune/new/integrations/prophet/__init__.py +++ b/src/neptune/new/integrations/prophet/__init__.py @@ -18,7 +18,7 @@ from neptune_prophet.impl import * # noqa: F401,F403 except ModuleNotFoundError as e: if e.name == "neptune_prophet": - from neptune.new.exceptions import NeptuneIntegrationNotInstalledException + from neptune.exceptions import NeptuneIntegrationNotInstalledException raise NeptuneIntegrationNotInstalledException( integration_package_name="neptune-prophet", framework_name="prophet" diff --git a/src/neptune/new/integrations/python_logger.py b/src/neptune/new/integrations/python_logger.py index 389dc469b..7cf532a53 100644 --- a/src/neptune/new/integrations/python_logger.py +++ b/src/neptune/new/integrations/python_logger.py @@ -18,11 +18,11 @@ import logging import threading -from neptune.new import Run +from neptune import Run from neptune.new.internal.utils import verify_type from neptune.new.logging import Logger from neptune.new.run import RunState -from neptune.new.version import version as neptune_client_version +from neptune.version import version as neptune_client_version INTEGRATION_VERSION_KEY = "source_code/integrations/neptune-python-logger" diff --git a/src/neptune/new/integrations/pytorch_lightning/__init__.py b/src/neptune/new/integrations/pytorch_lightning/__init__.py index b0d476261..483916fc1 100644 --- a/src/neptune/new/integrations/pytorch_lightning/__init__.py +++ b/src/neptune/new/integrations/pytorch_lightning/__init__.py @@ -19,7 +19,7 @@ from pytorch_lightning.loggers import NeptuneLogger except ModuleNotFoundError as e: if e.name == "pytorch_lightning": - from neptune.new.exceptions import NeptuneIntegrationNotInstalledException + from neptune.exceptions import NeptuneIntegrationNotInstalledException raise NeptuneIntegrationNotInstalledException( integration_package_name="pytorch-lightning", diff --git a/src/neptune/new/integrations/sacred/__init__.py b/src/neptune/new/integrations/sacred/__init__.py index a2c4ecce3..8bdded037 100644 --- a/src/neptune/new/integrations/sacred/__init__.py +++ b/src/neptune/new/integrations/sacred/__init__.py @@ -18,7 +18,7 @@ from neptune_sacred.impl import * # noqa: F401,F403 except ModuleNotFoundError as e: if e.name == "neptune_sacred": - from neptune.new.exceptions import NeptuneIntegrationNotInstalledException + from neptune.exceptions import NeptuneIntegrationNotInstalledException raise NeptuneIntegrationNotInstalledException( integration_package_name="neptune-sacred", framework_name="sacred" diff --git a/src/neptune/new/integrations/sklearn/__init__.py b/src/neptune/new/integrations/sklearn/__init__.py index e1352017c..af0f62a1b 100644 --- a/src/neptune/new/integrations/sklearn/__init__.py +++ b/src/neptune/new/integrations/sklearn/__init__.py @@ -18,7 +18,7 @@ from neptune_sklearn.impl import * # noqa: F401,F403 except ModuleNotFoundError as e: if e.name == "neptune_sklearn": - from neptune.new.exceptions import NeptuneIntegrationNotInstalledException + from neptune.exceptions import NeptuneIntegrationNotInstalledException raise NeptuneIntegrationNotInstalledException( integration_package_name="neptune-sklearn", framework_name="sklearn" diff --git a/src/neptune/new/integrations/tensorflow_keras/__init__.py b/src/neptune/new/integrations/tensorflow_keras/__init__.py index 4cb56c8ae..e18c74744 100644 --- a/src/neptune/new/integrations/tensorflow_keras/__init__.py +++ b/src/neptune/new/integrations/tensorflow_keras/__init__.py @@ -18,7 +18,7 @@ from neptune_tensorflow_keras.impl import * # noqa: F401,F403 except ModuleNotFoundError as e: if e.name == "neptune_tensorflow_keras": - from neptune.new.exceptions import NeptuneIntegrationNotInstalledException + from neptune.exceptions import NeptuneIntegrationNotInstalledException raise NeptuneIntegrationNotInstalledException( integration_package_name="neptune-tensorflow-keras", diff --git a/src/neptune/new/integrations/transformers/__init__.py b/src/neptune/new/integrations/transformers/__init__.py index f65e1854b..e580d5902 100644 --- a/src/neptune/new/integrations/transformers/__init__.py +++ b/src/neptune/new/integrations/transformers/__init__.py @@ -20,7 +20,7 @@ from transformers.integrations import NeptuneCallback except ModuleNotFoundError as e: if e.name == "transformers": - from neptune.new.exceptions import NeptuneIntegrationNotInstalledException + from neptune.exceptions import NeptuneIntegrationNotInstalledException raise NeptuneIntegrationNotInstalledException( integration_package_name="transformers", diff --git a/src/neptune/new/integrations/utils.py b/src/neptune/new/integrations/utils.py index e7c0ce95d..0745def73 100644 --- a/src/neptune/new/integrations/utils.py +++ b/src/neptune/new/integrations/utils.py @@ -17,10 +17,10 @@ from typing import Union +from neptune import Run from neptune.common.experiments import LegacyExperiment as Experiment -from neptune.new import Run -from neptune.new.exceptions import NeptuneLegacyIncompatibilityException -from neptune.new.handler import Handler +from neptune.exceptions import NeptuneLegacyIncompatibilityException +from neptune.handler import Handler from neptune.new.internal.utils import verify_type from neptune.new.internal.utils.paths import join_paths diff --git a/src/neptune/new/integrations/xgboost/__init__.py b/src/neptune/new/integrations/xgboost/__init__.py index fbc114e2c..153891b46 100644 --- a/src/neptune/new/integrations/xgboost/__init__.py +++ b/src/neptune/new/integrations/xgboost/__init__.py @@ -18,7 +18,7 @@ from neptune_xgboost.impl import * # noqa: F401,F403 except ModuleNotFoundError as e: if e.name == "neptune_xgboost": - from neptune.new.exceptions import NeptuneIntegrationNotInstalledException + from neptune.exceptions import NeptuneIntegrationNotInstalledException raise NeptuneIntegrationNotInstalledException( integration_package_name="neptune-xgboost", framework_name="xgboost" diff --git a/src/neptune/new/internal/artifacts/drivers/local.py b/src/neptune/new/internal/artifacts/drivers/local.py index 9cd9ef807..69c32124e 100644 --- a/src/neptune/new/internal/artifacts/drivers/local.py +++ b/src/neptune/new/internal/artifacts/drivers/local.py @@ -21,7 +21,7 @@ from datetime import datetime from urllib.parse import urlparse -from neptune.new.exceptions import ( +from neptune.exceptions import ( NeptuneLocalStorageAccessException, NeptuneUnsupportedArtifactFunctionalityException, ) diff --git a/src/neptune/new/internal/artifacts/drivers/s3.py b/src/neptune/new/internal/artifacts/drivers/s3.py index 415f3cca0..9b2a289a4 100644 --- a/src/neptune/new/internal/artifacts/drivers/s3.py +++ b/src/neptune/new/internal/artifacts/drivers/s3.py @@ -22,7 +22,7 @@ from botocore.exceptions import NoCredentialsError -from neptune.new.exceptions import ( +from neptune.exceptions import ( NeptuneRemoteStorageAccessException, NeptuneRemoteStorageCredentialsException, NeptuneUnsupportedArtifactFunctionalityException, diff --git a/src/neptune/new/internal/artifacts/types.py b/src/neptune/new/internal/artifacts/types.py index 65cd40e1d..273c78af1 100644 --- a/src/neptune/new/internal/artifacts/types.py +++ b/src/neptune/new/internal/artifacts/types.py @@ -21,7 +21,7 @@ import typing from dataclasses import dataclass -from neptune.new.exceptions import ( +from neptune.exceptions import ( NeptuneUnhandledArtifactSchemeException, NeptuneUnhandledArtifactTypeException, ) diff --git a/src/neptune/new/internal/backends/hosted_artifact_operations.py b/src/neptune/new/internal/backends/hosted_artifact_operations.py index 03914f6a2..a09f24c53 100644 --- a/src/neptune/new/internal/backends/hosted_artifact_operations.py +++ b/src/neptune/new/internal/backends/hosted_artifact_operations.py @@ -26,7 +26,7 @@ from bravado.exception import HTTPNotFound from neptune.common.backends.utils import with_api_exceptions_handler -from neptune.new.exceptions import ( +from neptune.exceptions import ( ArtifactNotFoundException, ArtifactUploadingError, NeptuneEmptyLocationException, diff --git a/src/neptune/new/internal/backends/hosted_client.py b/src/neptune/new/internal/backends/hosted_client.py index ca7b99f65..8e63b2289 100644 --- a/src/neptune/new/internal/backends/hosted_client.py +++ b/src/neptune/new/internal/backends/hosted_client.py @@ -32,7 +32,7 @@ from neptune.common.backends.utils import with_api_exceptions_handler from neptune.common.oauth import NeptuneAuthenticator -from neptune.new.exceptions import NeptuneClientUpgradeRequiredError +from neptune.exceptions import NeptuneClientUpgradeRequiredError from neptune.new.internal.backends.api_model import ClientConfig from neptune.new.internal.backends.swagger_client_wrapper import SwaggerClientWrapper from neptune.new.internal.backends.utils import ( @@ -45,7 +45,7 @@ verify_host_resolution, ) from neptune.new.internal.credentials import Credentials -from neptune.new.version import version as neptune_client_version +from neptune.version import version as neptune_client_version BACKEND_SWAGGER_PATH = "/api/backend/swagger.json" LEADERBOARD_SWAGGER_PATH = "/api/leaderboard/swagger.json" diff --git a/src/neptune/new/internal/backends/hosted_file_operations.py b/src/neptune/new/internal/backends/hosted_file_operations.py index ee36d7e27..10687c228 100644 --- a/src/neptune/new/internal/backends/hosted_file_operations.py +++ b/src/neptune/new/internal/backends/hosted_file_operations.py @@ -67,7 +67,7 @@ scan_unique_upload_entries, split_upload_files, ) -from neptune.new.exceptions import ( +from neptune.exceptions import ( FileUploadError, MetadataInconsistency, NeptuneLimitExceedException, diff --git a/src/neptune/new/internal/backends/hosted_neptune_backend.py b/src/neptune/new/internal/backends/hosted_neptune_backend.py index 4b72602d7..31453663c 100644 --- a/src/neptune/new/internal/backends/hosted_neptune_backend.py +++ b/src/neptune/new/internal/backends/hosted_neptune_backend.py @@ -45,9 +45,8 @@ NeptuneException, ) from neptune.common.patterns import PROJECT_QUALIFIED_NAME_PATTERN -from neptune.management.exceptions import ObjectNotFound -from neptune.new.envs import NEPTUNE_FETCH_TABLE_STEP_SIZE -from neptune.new.exceptions import ( +from neptune.envs import NEPTUNE_FETCH_TABLE_STEP_SIZE +from neptune.exceptions import ( AmbiguousProjectName, ArtifactNotFoundException, ContainerUUIDNotFound, @@ -61,6 +60,7 @@ ProjectNotFound, ProjectNotFoundWithSuggestions, ) +from neptune.management.exceptions import ObjectNotFound from neptune.new.internal.artifacts.types import ArtifactFileData from neptune.new.internal.backends.api_model import ( ApiExperiment, @@ -135,7 +135,7 @@ from neptune.new.internal.utils.paths import path_to_str from neptune.new.internal.websockets.websockets_factory import WebsocketsFactory from neptune.new.types.atoms import GitRef -from neptune.new.version import version as neptune_client_version +from neptune.version import version as neptune_client_version if TYPE_CHECKING: from bravado.requests_client import RequestsClient diff --git a/src/neptune/new/internal/backends/neptune_backend_mock.py b/src/neptune/new/internal/backends/neptune_backend_mock.py index 5e63d6879..dd734ea7b 100644 --- a/src/neptune/new/internal/backends/neptune_backend_mock.py +++ b/src/neptune/new/internal/backends/neptune_backend_mock.py @@ -37,7 +37,7 @@ InternalClientError, NeptuneException, ) -from neptune.new.exceptions import ( +from neptune.exceptions import ( ContainerUUIDNotFound, MetadataInconsistency, ModelVersionNotFound, diff --git a/src/neptune/new/internal/backends/offline_neptune_backend.py b/src/neptune/new/internal/backends/offline_neptune_backend.py index a80b75dbf..30fe2758d 100644 --- a/src/neptune/new/internal/backends/offline_neptune_backend.py +++ b/src/neptune/new/internal/backends/offline_neptune_backend.py @@ -17,7 +17,7 @@ from typing import List -from neptune.new.exceptions import NeptuneOfflineModeFetchException +from neptune.exceptions import NeptuneOfflineModeFetchException from neptune.new.internal.artifacts.types import ArtifactFileData from neptune.new.internal.backends.api_model import ( ArtifactAttribute, diff --git a/src/neptune/new/internal/backends/operations_preprocessor.py b/src/neptune/new/internal/backends/operations_preprocessor.py index 667532ef4..03d914aea 100644 --- a/src/neptune/new/internal/backends/operations_preprocessor.py +++ b/src/neptune/new/internal/backends/operations_preprocessor.py @@ -25,7 +25,7 @@ ) from neptune.common.exceptions import InternalClientError -from neptune.new.exceptions import MetadataInconsistency +from neptune.exceptions import MetadataInconsistency from neptune.new.internal.operation import ( AddStrings, AssignArtifact, diff --git a/src/neptune/new/internal/backends/project_name_lookup.py b/src/neptune/new/internal/backends/project_name_lookup.py index 3a888325b..cc55a2e57 100644 --- a/src/neptune/new/internal/backends/project_name_lookup.py +++ b/src/neptune/new/internal/backends/project_name_lookup.py @@ -19,8 +19,8 @@ import os from typing import Optional -from neptune.new.envs import PROJECT_ENV_NAME -from neptune.new.exceptions import NeptuneMissingProjectNameException +from neptune.envs import PROJECT_ENV_NAME +from neptune.exceptions import NeptuneMissingProjectNameException from neptune.new.internal.backends.api_model import Project from neptune.new.internal.backends.neptune_backend import NeptuneBackend from neptune.new.internal.id_formats import QualifiedName diff --git a/src/neptune/new/internal/backends/swagger_client_wrapper.py b/src/neptune/new/internal/backends/swagger_client_wrapper.py index 2fa20e330..3e297629e 100644 --- a/src/neptune/new/internal/backends/swagger_client_wrapper.py +++ b/src/neptune/new/internal/backends/swagger_client_wrapper.py @@ -20,7 +20,7 @@ from bravado.client import SwaggerClient from bravado.exception import HTTPError -from neptune.new.exceptions import ( +from neptune.exceptions import ( NeptuneFieldCountLimitExceedException, NeptuneLimitExceedException, ) diff --git a/src/neptune/new/internal/backends/utils.py b/src/neptune/new/internal/backends/utils.py index 6de5ba6e6..ab342ed29 100644 --- a/src/neptune/new/internal/backends/utils.py +++ b/src/neptune/new/internal/backends/utils.py @@ -64,8 +64,8 @@ ) from neptune.common.backends.utils import with_api_exceptions_handler -from neptune.new.envs import NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE -from neptune.new.exceptions import ( +from neptune.envs import NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE +from neptune.exceptions import ( CannotResolveHostname, MetadataInconsistency, NeptuneClientUpgradeRequiredError, diff --git a/src/neptune/new/internal/container_structure.py b/src/neptune/new/internal/container_structure.py index a97910beb..f28b2c5c9 100644 --- a/src/neptune/new/internal/container_structure.py +++ b/src/neptune/new/internal/container_structure.py @@ -25,7 +25,7 @@ Union, ) -from neptune.new.exceptions import MetadataInconsistency +from neptune.exceptions import MetadataInconsistency from neptune.new.internal.utils.paths import path_to_str T = TypeVar("T") diff --git a/src/neptune/new/internal/credentials.py b/src/neptune/new/internal/credentials.py index 208d949c6..9cdc53d5b 100644 --- a/src/neptune/new/internal/credentials.py +++ b/src/neptune/new/internal/credentials.py @@ -24,13 +24,13 @@ Optional, ) -from neptune.common.envs import API_TOKEN_ENV_NAME -from neptune.common.exceptions import NeptuneInvalidApiTokenException -from neptune.new import ( +from neptune import ( ANONYMOUS, ANONYMOUS_API_TOKEN, ) -from neptune.new.exceptions import NeptuneMissingApiTokenException +from neptune.common.envs import API_TOKEN_ENV_NAME +from neptune.common.exceptions import NeptuneInvalidApiTokenException +from neptune.exceptions import NeptuneMissingApiTokenException @dataclass(frozen=True) diff --git a/src/neptune/new/internal/disk_queue.py b/src/neptune/new/internal/disk_queue.py index c49e1596d..e650822b6 100644 --- a/src/neptune/new/internal/disk_queue.py +++ b/src/neptune/new/internal/disk_queue.py @@ -32,7 +32,7 @@ TypeVar, ) -from neptune.new.exceptions import MalformedOperation +from neptune.exceptions import MalformedOperation from neptune.new.internal.utils.json_file_splitter import JsonFileSplitter from neptune.new.internal.utils.sync_offset_file import SyncOffsetFile diff --git a/src/neptune/new/internal/init/model.py b/src/neptune/new/internal/init/model.py index 42c4d5394..3d8cec2a1 100644 --- a/src/neptune/new/internal/init/model.py +++ b/src/neptune/new/internal/init/model.py @@ -20,14 +20,14 @@ from typing import Optional from neptune.common.exceptions import NeptuneException -from neptune.new.attributes import constants as attr_consts -from neptune.new.envs import CONNECTION_MODE -from neptune.new.exceptions import ( +from neptune.envs import CONNECTION_MODE +from neptune.exceptions import ( NeedExistingModelForReadOnlyMode, NeptuneMissingRequiredInitParameter, NeptuneModelKeyAlreadyExistsError, NeptuneObjectCreationConflict, ) +from neptune.new.attributes import constants as attr_consts from neptune.new.internal import id_formats from neptune.new.internal.backends.factory import get_backend from neptune.new.internal.backends.project_name_lookup import project_name_lookup diff --git a/src/neptune/new/internal/init/model_version.py b/src/neptune/new/internal/init/model_version.py index c0882da17..84f11098b 100644 --- a/src/neptune/new/internal/init/model_version.py +++ b/src/neptune/new/internal/init/model_version.py @@ -20,12 +20,12 @@ from typing import Optional from neptune.common.exceptions import NeptuneException -from neptune.new.attributes import constants as attr_consts -from neptune.new.envs import CONNECTION_MODE -from neptune.new.exceptions import ( +from neptune.envs import CONNECTION_MODE +from neptune.exceptions import ( NeedExistingModelVersionForReadOnlyMode, NeptuneMissingRequiredInitParameter, ) +from neptune.new.attributes import constants as attr_consts from neptune.new.internal import id_formats from neptune.new.internal.backends.factory import get_backend from neptune.new.internal.backends.project_name_lookup import project_name_lookup diff --git a/src/neptune/new/internal/init/project.py b/src/neptune/new/internal/init/project.py index 692d1cc09..73ed95b50 100644 --- a/src/neptune/new/internal/init/project.py +++ b/src/neptune/new/internal/init/project.py @@ -20,7 +20,7 @@ from typing import Optional from neptune.common.exceptions import NeptuneException -from neptune.new.envs import CONNECTION_MODE +from neptune.envs import CONNECTION_MODE from neptune.new.internal import id_formats from neptune.new.internal.backends.factory import get_backend from neptune.new.internal.backends.project_name_lookup import project_name_lookup @@ -117,7 +117,7 @@ def get_project( Examples: - >>> import neptune.new as neptune + >>> import neptune >>> # Fetch project 'jack/sandbox' ... project = neptune.get_project(project='jack/sandbox') diff --git a/src/neptune/new/internal/init/run.py b/src/neptune/new/internal/init/run.py index 79818d668..631537ffc 100644 --- a/src/neptune/new/internal/init/run.py +++ b/src/neptune/new/internal/init/run.py @@ -24,19 +24,19 @@ Union, ) -from neptune.new.attributes import constants as attr_consts -from neptune.new.envs import ( +from neptune.envs import ( CONNECTION_MODE, CUSTOM_RUN_ID_ENV_NAME, MONITORING_NAMESPACE, NEPTUNE_NOTEBOOK_ID, NEPTUNE_NOTEBOOK_PATH, ) -from neptune.new.exceptions import ( +from neptune.exceptions import ( NeedExistingRunForReadOnlyMode, NeptunePossibleLegacyUsageException, NeptuneRunResumeAndCustomIdCollision, ) +from neptune.new.attributes import constants as attr_consts from neptune.new.internal import id_formats from neptune.new.internal.backends.factory import get_backend from neptune.new.internal.backends.neptune_backend import NeptuneBackend @@ -167,7 +167,7 @@ def init_run( Creating a new run: - >>> import neptune.new as neptune + >>> import neptune >>> # Minimal invoke ... # (creates a run in the project specified by the NEPTUNE_PROJECT environment variable) diff --git a/src/neptune/new/internal/operation.py b/src/neptune/new/internal/operation.py index 8a507a4db..662587a74 100644 --- a/src/neptune/new/internal/operation.py +++ b/src/neptune/new/internal/operation.py @@ -30,7 +30,7 @@ ) from neptune.common.exceptions import InternalClientError -from neptune.new.exceptions import MalformedOperation +from neptune.exceptions import MalformedOperation from neptune.new.internal.container_type import ContainerType from neptune.new.internal.types.file_types import FileType from neptune.new.types.atoms.file import File diff --git a/src/neptune/new/internal/operation_processors/async_operation_processor.py b/src/neptune/new/internal/operation_processors/async_operation_processor.py index 800aaa42e..dd3f09765 100644 --- a/src/neptune/new/internal/operation_processors/async_operation_processor.py +++ b/src/neptune/new/internal/operation_processors/async_operation_processor.py @@ -29,11 +29,11 @@ Optional, ) -from neptune.new.constants import ( +from neptune.constants import ( ASYNC_DIRECTORY, NEPTUNE_DATA_DIRECTORY, ) -from neptune.new.exceptions import NeptuneSynchronizationAlreadyStoppedException +from neptune.exceptions import NeptuneSynchronizationAlreadyStoppedException from neptune.new.internal.backends.neptune_backend import NeptuneBackend from neptune.new.internal.container_type import ContainerType from neptune.new.internal.disk_queue import DiskQueue diff --git a/src/neptune/new/internal/operation_processors/offline_operation_processor.py b/src/neptune/new/internal/operation_processors/offline_operation_processor.py index c5b5904be..2e6792d70 100644 --- a/src/neptune/new/internal/operation_processors/offline_operation_processor.py +++ b/src/neptune/new/internal/operation_processors/offline_operation_processor.py @@ -18,7 +18,7 @@ import threading from typing import Optional -from neptune.new.constants import ( +from neptune.constants import ( NEPTUNE_DATA_DIRECTORY, OFFLINE_DIRECTORY, ) diff --git a/src/neptune/new/internal/operation_processors/operation_storage.py b/src/neptune/new/internal/operation_processors/operation_storage.py index 39eb0293d..34363c5f6 100644 --- a/src/neptune/new/internal/operation_processors/operation_storage.py +++ b/src/neptune/new/internal/operation_processors/operation_storage.py @@ -21,7 +21,7 @@ import shutil from pathlib import Path -from neptune.new.constants import NEPTUNE_DATA_DIRECTORY +from neptune.constants import NEPTUNE_DATA_DIRECTORY from neptune.new.internal.container_type import ContainerType from neptune.new.internal.id_formats import UniqueId from neptune.new.internal.utils.logger import logger diff --git a/src/neptune/new/internal/operation_processors/sync_operation_processor.py b/src/neptune/new/internal/operation_processors/sync_operation_processor.py index 68536f0fb..082cdfa43 100644 --- a/src/neptune/new/internal/operation_processors/sync_operation_processor.py +++ b/src/neptune/new/internal/operation_processors/sync_operation_processor.py @@ -18,7 +18,7 @@ from datetime import datetime from typing import Optional -from neptune.new.constants import ( +from neptune.constants import ( NEPTUNE_DATA_DIRECTORY, SYNC_DIRECTORY, ) diff --git a/src/neptune/new/internal/types/file_types.py b/src/neptune/new/internal/types/file_types.py index 9604851e2..0b0598da4 100644 --- a/src/neptune/new/internal/types/file_types.py +++ b/src/neptune/new/internal/types/file_types.py @@ -33,7 +33,7 @@ ) from neptune.common.exceptions import NeptuneException -from neptune.new.exceptions import StreamAlreadyUsedException +from neptune.exceptions import StreamAlreadyUsedException from neptune.new.internal.utils import verify_type diff --git a/src/neptune/new/internal/utils/deprecation.py b/src/neptune/new/internal/utils/deprecation.py index 089655f0d..09aa20287 100644 --- a/src/neptune/new/internal/utils/deprecation.py +++ b/src/neptune/new/internal/utils/deprecation.py @@ -17,7 +17,7 @@ from typing import Optional from neptune.common.deprecation import warn_once -from neptune.new.exceptions import NeptuneParametersCollision +from neptune.exceptions import NeptuneParametersCollision __all__ = ["deprecated", "deprecated_parameter"] diff --git a/src/neptune/new/internal/utils/images.py b/src/neptune/new/internal/utils/images.py index 22ef166ff..56b1d3e31 100644 --- a/src/neptune/new/internal/utils/images.py +++ b/src/neptune/new/internal/utils/images.py @@ -40,7 +40,7 @@ from packaging import version from pandas import DataFrame -from neptune.new.exceptions import PlotlyIncompatibilityException +from neptune.exceptions import PlotlyIncompatibilityException from neptune.new.internal.utils.logger import logger _logger = logging.getLogger(__name__) diff --git a/src/neptune/new/internal/utils/process_killer.py b/src/neptune/new/internal/utils/process_killer.py index a1c3ba4d5..be5b15907 100644 --- a/src/neptune/new/internal/utils/process_killer.py +++ b/src/neptune/new/internal/utils/process_killer.py @@ -18,7 +18,7 @@ import os import signal -from neptune.new.envs import NEPTUNE_SUBPROCESS_KILL_TIMEOUT +from neptune.envs import NEPTUNE_SUBPROCESS_KILL_TIMEOUT try: import psutil diff --git a/src/neptune/new/internal/utils/s3.py b/src/neptune/new/internal/utils/s3.py index fe90eb5ab..4a7ec1f05 100644 --- a/src/neptune/new/internal/utils/s3.py +++ b/src/neptune/new/internal/utils/s3.py @@ -19,7 +19,7 @@ import boto3 -from neptune.new.envs import S3_ENDPOINT_URL +from neptune.envs import S3_ENDPOINT_URL def get_boto_s3_client(): diff --git a/src/neptune/new/internal/utils/source_code.py b/src/neptune/new/internal/utils/source_code.py index 01998312f..9207a6863 100644 --- a/src/neptune/new/internal/utils/source_code.py +++ b/src/neptune/new/internal/utils/source_code.py @@ -36,7 +36,7 @@ ) if TYPE_CHECKING: - from neptune.new import Run + from neptune import Run def upload_source_code(source_files: Optional[List[str]], run: "Run") -> None: diff --git a/src/neptune/new/internal/value_to_attribute_visitor.py b/src/neptune/new/internal/value_to_attribute_visitor.py index e5cef11f7..a39ae84a5 100644 --- a/src/neptune/new/internal/value_to_attribute_visitor.py +++ b/src/neptune/new/internal/value_to_attribute_visitor.py @@ -21,6 +21,7 @@ Type, ) +from neptune.exceptions import OperationNotSupported from neptune.new.attributes.atoms.artifact import Artifact as ArtifactAttr from neptune.new.attributes.atoms.boolean import Boolean as BooleanAttr from neptune.new.attributes.atoms.datetime import Datetime as DatetimeAttr @@ -35,7 +36,6 @@ from neptune.new.attributes.series.float_series import FloatSeries as FloatSeriesAttr from neptune.new.attributes.series.string_series import StringSeries as StringSeriesAttr from neptune.new.attributes.sets.string_set import StringSet as StringSetAttr -from neptune.new.exceptions import OperationNotSupported from neptune.new.types import ( Boolean, Integer, diff --git a/src/neptune/new/metadata_containers/metadata_container.py b/src/neptune/new/metadata_containers/metadata_container.py index 431381b67..0b5ac60cc 100644 --- a/src/neptune/new/metadata_containers/metadata_container.py +++ b/src/neptune/new/metadata_containers/metadata_container.py @@ -33,11 +33,7 @@ ) from neptune.common.exceptions import UNIX_STYLES -from neptune.new.attributes import create_attribute_from_type -from neptune.new.attributes.attribute import Attribute -from neptune.new.attributes.namespace import Namespace as NamespaceAttr -from neptune.new.attributes.namespace import NamespaceBuilder -from neptune.new.exceptions import ( +from neptune.exceptions import ( InactiveModelException, InactiveModelVersionException, InactiveProjectException, @@ -45,7 +41,11 @@ MetadataInconsistency, NeptunePossibleLegacyUsageException, ) -from neptune.new.handler import Handler +from neptune.handler import Handler +from neptune.new.attributes import create_attribute_from_type +from neptune.new.attributes.attribute import Attribute +from neptune.new.attributes.namespace import Namespace as NamespaceAttr +from neptune.new.attributes.namespace import NamespaceBuilder from neptune.new.internal.backends.api_model import AttributeType from neptune.new.internal.backends.neptune_backend import NeptuneBackend from neptune.new.internal.backends.nql import NQLQuery diff --git a/src/neptune/new/metadata_containers/metadata_containers_table.py b/src/neptune/new/metadata_containers/metadata_containers_table.py index 6573dbab1..5f491b7bf 100644 --- a/src/neptune/new/metadata_containers/metadata_containers_table.py +++ b/src/neptune/new/metadata_containers/metadata_containers_table.py @@ -25,7 +25,7 @@ Union, ) -from neptune.new.exceptions import MetadataInconsistency +from neptune.exceptions import MetadataInconsistency from neptune.new.internal.backends.api_model import ( AttributeType, AttributeWithProperties, diff --git a/src/neptune/new/metadata_containers/model_version.py b/src/neptune/new/metadata_containers/model_version.py index 19beb9337..9d8f08e68 100644 --- a/src/neptune/new/metadata_containers/model_version.py +++ b/src/neptune/new/metadata_containers/model_version.py @@ -15,8 +15,8 @@ # __all__ = ["ModelVersion"] +from neptune.exceptions import NeptuneOfflineModeChangeStageException from neptune.new.attributes.constants import SYSTEM_STAGE_ATTRIBUTE_PATH -from neptune.new.exceptions import NeptuneOfflineModeChangeStageException from neptune.new.internal.container_type import ContainerType from neptune.new.internal.operation_processors.offline_operation_processor import OfflineOperationProcessor from neptune.new.metadata_containers import MetadataContainer diff --git a/src/neptune/new/types/type_casting.py b/src/neptune/new/types/type_casting.py index 5f967cbc7..636df43bc 100644 --- a/src/neptune/new/types/type_casting.py +++ b/src/neptune/new/types/type_casting.py @@ -54,7 +54,7 @@ def cast_value(value: Any) -> Value: - from neptune.new.handler import Handler + from neptune.handler import Handler from_stringify_value = False if is_stringify_value(value): From ecdb8e70ed545a5becda0612c63ab0c69216bb89 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 15:07:15 +0100 Subject: [PATCH 14/33] Internal moved --- src/neptune/__init__.py | 4 +- src/neptune/exceptions.py | 12 ++--- src/neptune/handler.py | 34 +++++++------- src/neptune/{new => }/internal/__init__.py | 0 .../{new => }/internal/artifacts/__init__.py | 2 +- .../internal/artifacts/drivers/__init__.py | 4 +- .../internal/artifacts/drivers/local.py | 4 +- .../internal/artifacts/drivers/s3.py | 4 +- .../internal/artifacts/file_hasher.py | 6 +-- .../artifacts/local_file_hash_storage.py | 0 .../{new => }/internal/artifacts/types.py | 0 .../{new => }/internal/artifacts/utils.py | 0 .../{new => }/internal/backends/__init__.py | 0 .../{new => }/internal/backends/api_model.py | 4 +- .../{new => }/internal/backends/factory.py | 2 +- .../backends/hosted_artifact_operations.py | 10 ++--- .../internal/backends/hosted_client.py | 8 ++-- .../backends/hosted_file_operations.py | 8 ++-- .../backends/hosted_neptune_backend.py | 42 +++++++++--------- .../internal/backends/neptune_backend.py | 14 +++--- .../internal/backends/neptune_backend_mock.py | 28 ++++++------ .../{new => }/internal/backends/nql.py | 0 .../backends/offline_neptune_backend.py | 8 ++-- .../backends/operation_api_name_visitor.py | 4 +- .../operation_api_object_converter.py | 4 +- .../backends/operations_preprocessor.py | 6 +-- .../internal/backends/project_name_lookup.py | 8 ++-- .../backends/swagger_client_wrapper.py | 0 .../{new => }/internal/backends/utils.py | 12 ++--- .../{new => }/internal/backgroud_job_list.py | 2 +- .../{new => }/internal/background_job.py | 0 .../{new => }/internal/container_structure.py | 2 +- .../{new => }/internal/container_type.py | 2 +- src/neptune/{new => }/internal/credentials.py | 0 src/neptune/{new => }/internal/disk_queue.py | 4 +- src/neptune/{new => }/internal/exceptions.py | 0 .../{new => }/internal/hardware/__init__.py | 0 .../internal/hardware/gpu/__init__.py | 0 .../internal/hardware/gpu/gpu_monitor.py | 0 .../hardware/hardware_metric_reporting_job.py | 6 +-- src/neptune/{new => }/internal/id_formats.py | 0 .../{new => }/internal/init/__init__.py | 10 ++--- src/neptune/{new => }/internal/init/model.py | 22 +++++----- .../{new => }/internal/init/model_version.py | 22 +++++----- .../{new => }/internal/init/parameters.py | 0 .../{new => }/internal/init/project.py | 18 ++++---- src/neptune/{new => }/internal/init/run.py | 40 ++++++++--------- .../{new => }/internal/notebooks/__init__.py | 0 .../{new => }/internal/notebooks/comm.py | 0 .../{new => }/internal/notebooks/notebooks.py | 6 +-- src/neptune/{new => }/internal/operation.py | 8 ++-- .../internal/operation_processors/__init__.py | 0 .../async_operation_processor.py | 18 ++++---- .../internal/operation_processors/factory.py | 6 +-- .../offline_operation_processor.py | 12 ++--- .../operation_processor.py | 2 +- .../operation_processors/operation_storage.py | 6 +-- .../read_only_operation_processor.py | 6 +-- .../sync_operation_processor.py | 12 ++--- .../{new => }/internal/operation_visitor.py | 2 +- src/neptune/{new => }/internal/state.py | 0 .../{new => }/internal/streams/__init__.py | 0 .../streams/std_capture_background_job.py | 10 ++--- .../streams/std_stream_capture_logger.py | 0 .../{new => }/internal/threading/__init__.py | 0 .../{new => }/internal/threading/daemon.py | 2 +- .../{new => }/internal/types/__init__.py | 0 .../{new => }/internal/types/file_types.py | 2 +- .../{new => }/internal/utils/__init__.py | 2 +- .../{new => }/internal/utils/deprecation.py | 0 .../utils/generic_attribute_mapper.py | 2 +- src/neptune/{new => }/internal/utils/git.py | 0 .../{new => }/internal/utils/images.py | 2 +- .../{new => }/internal/utils/iteration.py | 0 .../internal/utils/json_file_splitter.py | 0 .../{new => }/internal/utils/limits.py | 0 .../{new => }/internal/utils/logger.py | 0 src/neptune/{new => }/internal/utils/paths.py | 0 .../internal/utils/ping_background_job.py | 4 +- .../internal/utils/process_killer.py | 0 .../{new => }/internal/utils/runningmode.py | 0 src/neptune/{new => }/internal/utils/s3.py | 0 .../{new => }/internal/utils/source_code.py | 4 +- .../internal/utils/stringify_value.py | 0 .../internal/utils/sync_offset_file.py | 0 .../{new => }/internal/utils/traceback_job.py | 4 +- .../utils/uncaught_exception_handler.py | 0 .../internal/value_to_attribute_visitor.py | 0 .../{new => }/internal/websockets/__init__.py | 0 .../websocket_signals_background_job.py | 10 ++--- .../internal/websockets/websockets_factory.py | 0 .../hosted_alpha_leaderboard_api_client.py | 44 +++++++++---------- .../hosted_backend_api_client.py | 2 +- .../internal/utils/alpha_integration.py | 10 ++--- src/neptune/management/internal/api.py | 40 ++++++++--------- src/neptune/management/internal/dto.py | 2 +- src/neptune/new/attributes/atoms/artifact.py | 8 ++-- src/neptune/new/attributes/atoms/boolean.py | 6 +-- .../new/attributes/atoms/copiable_atom.py | 8 ++-- src/neptune/new/attributes/atoms/datetime.py | 8 ++-- src/neptune/new/attributes/atoms/file.py | 4 +- src/neptune/new/attributes/atoms/float.py | 6 +-- src/neptune/new/attributes/atoms/integer.py | 6 +-- src/neptune/new/attributes/atoms/string.py | 10 ++--- src/neptune/new/attributes/attribute.py | 6 +-- src/neptune/new/attributes/file_set.py | 6 +-- src/neptune/new/attributes/namespace.py | 8 ++-- .../new/attributes/series/fetchable_series.py | 2 +- .../new/attributes/series/file_series.py | 10 ++--- .../new/attributes/series/float_series.py | 12 ++--- src/neptune/new/attributes/series/series.py | 8 ++-- .../new/attributes/series/string_series.py | 12 ++--- src/neptune/new/attributes/sets/string_set.py | 6 +-- src/neptune/new/attributes/utils.py | 2 +- .../new/cli/abstract_backend_runner.py | 2 +- src/neptune/new/cli/clear.py | 6 +-- src/neptune/new/cli/commands.py | 20 ++++----- src/neptune/new/cli/container_manager.py | 6 +-- src/neptune/new/cli/path_option.py | 8 ++-- src/neptune/new/cli/status.py | 4 +- src/neptune/new/cli/sync.py | 24 +++++----- src/neptune/new/cli/utils.py | 14 +++--- src/neptune/new/integrations/python_logger.py | 2 +- src/neptune/new/integrations/utils.py | 4 +- .../metadata_containers/metadata_container.py | 40 ++++++++--------- .../metadata_containers_table.py | 8 ++-- src/neptune/new/metadata_containers/model.py | 4 +- .../new/metadata_containers/model_version.py | 4 +- .../new/metadata_containers/project.py | 14 +++--- src/neptune/new/metadata_containers/run.py | 12 ++--- src/neptune/new/run.py | 3 +- src/neptune/new/runs_table.py | 11 ++--- src/neptune/new/types/atoms/artifact.py | 2 +- src/neptune/new/types/atoms/boolean.py | 2 +- src/neptune/new/types/atoms/datetime.py | 2 +- src/neptune/new/types/atoms/file.py | 6 +-- src/neptune/new/types/atoms/float.py | 2 +- src/neptune/new/types/atoms/integer.py | 2 +- src/neptune/new/types/atoms/string.py | 2 +- src/neptune/new/types/file_set.py | 2 +- src/neptune/new/types/series/file_series.py | 6 +-- src/neptune/new/types/series/float_series.py | 4 +- src/neptune/new/types/series/string_series.py | 2 +- src/neptune/new/types/type_casting.py | 2 +- src/neptune/new/types/value_copy.py | 2 +- src/neptune/utils.py | 2 +- 146 files changed, 463 insertions(+), 463 deletions(-) rename src/neptune/{new => }/internal/__init__.py (100%) rename src/neptune/{new => }/internal/artifacts/__init__.py (93%) rename src/neptune/{new => }/internal/artifacts/drivers/__init__.py (81%) rename src/neptune/{new => }/internal/artifacts/drivers/local.py (97%) rename src/neptune/{new => }/internal/artifacts/drivers/s3.py (97%) rename src/neptune/{new => }/internal/artifacts/file_hasher.py (95%) rename src/neptune/{new => }/internal/artifacts/local_file_hash_storage.py (100%) rename src/neptune/{new => }/internal/artifacts/types.py (100%) rename src/neptune/{new => }/internal/artifacts/utils.py (100%) rename src/neptune/{new => }/internal/backends/__init__.py (100%) rename src/neptune/{new => }/internal/backends/api_model.py (98%) rename src/neptune/{new => }/internal/backends/factory.py (96%) rename src/neptune/{new => }/internal/backends/hosted_artifact_operations.py (95%) rename src/neptune/{new => }/internal/backends/hosted_client.py (95%) rename src/neptune/{new => }/internal/backends/hosted_file_operations.py (98%) rename src/neptune/{new => }/internal/backends/hosted_neptune_backend.py (96%) rename src/neptune/{new => }/internal/backends/neptune_backend.py (95%) rename src/neptune/{new => }/internal/backends/neptune_backend_mock.py (97%) rename src/neptune/{new => }/internal/backends/nql.py (100%) rename src/neptune/{new => }/internal/backends/offline_neptune_backend.py (94%) rename src/neptune/{new => }/internal/backends/operation_api_name_visitor.py (97%) rename src/neptune/{new => }/internal/backends/operation_api_object_converter.py (98%) rename src/neptune/{new => }/internal/backends/operations_preprocessor.py (98%) rename src/neptune/{new => }/internal/backends/project_name_lookup.py (85%) rename src/neptune/{new => }/internal/backends/swagger_client_wrapper.py (100%) rename src/neptune/{new => }/internal/backends/utils.py (95%) rename src/neptune/{new => }/internal/backgroud_job_list.py (95%) rename src/neptune/{new => }/internal/background_job.py (100%) rename src/neptune/{new => }/internal/container_structure.py (98%) rename src/neptune/{new => }/internal/container_type.py (95%) rename src/neptune/{new => }/internal/credentials.py (100%) rename src/neptune/{new => }/internal/disk_queue.py (98%) rename src/neptune/{new => }/internal/exceptions.py (100%) rename src/neptune/{new => }/internal/hardware/__init__.py (100%) rename src/neptune/{new => }/internal/hardware/gpu/__init__.py (100%) rename src/neptune/{new => }/internal/hardware/gpu/gpu_monitor.py (100%) rename src/neptune/{new => }/internal/hardware/hardware_metric_reporting_job.py (96%) rename src/neptune/{new => }/internal/id_formats.py (100%) rename src/neptune/{new => }/internal/init/__init__.py (76%) rename src/neptune/{new => }/internal/init/model.py (87%) rename src/neptune/{new => }/internal/init/model_version.py (87%) rename src/neptune/{new => }/internal/init/parameters.py (100%) rename src/neptune/{new => }/internal/init/project.py (88%) rename src/neptune/{new => }/internal/init/run.py (91%) rename src/neptune/{new => }/internal/notebooks/__init__.py (100%) rename src/neptune/{new => }/internal/notebooks/comm.py (100%) rename src/neptune/{new => }/internal/notebooks/notebooks.py (89%) rename src/neptune/{new => }/internal/operation.py (98%) rename src/neptune/{new => }/internal/operation_processors/__init__.py (100%) rename src/neptune/{new => }/internal/operation_processors/async_operation_processor.py (94%) rename src/neptune/{new => }/internal/operation_processors/factory.py (91%) rename src/neptune/{new => }/internal/operation_processors/offline_operation_processor.py (81%) rename src/neptune/{new => }/internal/operation_processors/operation_processor.py (95%) rename src/neptune/{new => }/internal/operation_processors/operation_storage.py (91%) rename src/neptune/{new => }/internal/operation_processors/read_only_operation_processor.py (86%) rename src/neptune/{new => }/internal/operation_processors/sync_operation_processor.py (82%) rename src/neptune/{new => }/internal/operation_visitor.py (98%) rename src/neptune/{new => }/internal/state.py (100%) rename src/neptune/{new => }/internal/streams/__init__.py (100%) rename src/neptune/{new => }/internal/streams/std_capture_background_job.py (93%) rename src/neptune/{new => }/internal/streams/std_stream_capture_logger.py (100%) rename src/neptune/{new => }/internal/threading/__init__.py (100%) rename src/neptune/{new => }/internal/threading/daemon.py (98%) rename src/neptune/{new => }/internal/types/__init__.py (100%) rename src/neptune/{new => }/internal/types/file_types.py (98%) rename src/neptune/{new => }/internal/utils/__init__.py (98%) rename src/neptune/{new => }/internal/utils/deprecation.py (100%) rename src/neptune/{new => }/internal/utils/generic_attribute_mapper.py (97%) rename src/neptune/{new => }/internal/utils/git.py (100%) rename src/neptune/{new => }/internal/utils/images.py (99%) rename src/neptune/{new => }/internal/utils/iteration.py (100%) rename src/neptune/{new => }/internal/utils/json_file_splitter.py (100%) rename src/neptune/{new => }/internal/utils/limits.py (100%) rename src/neptune/{new => }/internal/utils/logger.py (100%) rename src/neptune/{new => }/internal/utils/paths.py (100%) rename src/neptune/{new => }/internal/utils/ping_background_job.py (94%) rename src/neptune/{new => }/internal/utils/process_killer.py (100%) rename src/neptune/{new => }/internal/utils/runningmode.py (100%) rename src/neptune/{new => }/internal/utils/s3.py (100%) rename src/neptune/{new => }/internal/utils/source_code.py (98%) rename src/neptune/{new => }/internal/utils/stringify_value.py (100%) rename src/neptune/{new => }/internal/utils/sync_offset_file.py (100%) rename src/neptune/{new => }/internal/utils/traceback_job.py (91%) rename src/neptune/{new => }/internal/utils/uncaught_exception_handler.py (100%) rename src/neptune/{new => }/internal/value_to_attribute_visitor.py (100%) rename src/neptune/{new => }/internal/websockets/__init__.py (100%) rename src/neptune/{new => }/internal/websockets/websocket_signals_background_job.py (94%) rename src/neptune/{new => }/internal/websockets/websockets_factory.py (100%) diff --git a/src/neptune/__init__.py b/src/neptune/__init__.py index db5cc2c5a..38b0fba09 100644 --- a/src/neptune/__init__.py +++ b/src/neptune/__init__.py @@ -35,7 +35,7 @@ ANONYMOUS_API_TOKEN, ) from neptune.exceptions import NeptuneUninitializedException -from neptune.new.internal.init import ( +from neptune.internal.init import ( get_project, init, init_model, @@ -43,7 +43,7 @@ init_project, init_run, ) -from neptune.new.internal.utils.deprecation import deprecated +from neptune.internal.utils.deprecation import deprecated from neptune.new.metadata_containers import Run from neptune.version import version diff --git a/src/neptune/exceptions.py b/src/neptune/exceptions.py index 5ada35fc7..62e9e06ba 100644 --- a/src/neptune/exceptions.py +++ b/src/neptune/exceptions.py @@ -117,15 +117,15 @@ NeptuneSSLVerificationError, Unauthorized, ) -from neptune.new import envs -from neptune.new.envs import CUSTOM_RUN_ID_ENV_NAME -from neptune.new.internal.backends.api_model import ( +from neptune.internal.backends.api_model import ( Project, Workspace, ) -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.id_formats import QualifiedName -from neptune.new.internal.utils import replace_patch_version +from neptune.internal.container_type import ContainerType +from neptune.internal.id_formats import QualifiedName +from neptune.internal.utils import replace_patch_version +from neptune.new import envs +from neptune.new.envs import CUSTOM_RUN_ID_ENV_NAME class MetadataInconsistency(NeptuneException): diff --git a/src/neptune/handler.py b/src/neptune/handler.py index 041124ee7..b270fffc0 100644 --- a/src/neptune/handler.py +++ b/src/neptune/handler.py @@ -33,6 +33,23 @@ # backwards compatibility from neptune.common.exceptions import NeptuneException # noqa: F401 +from neptune.internal.artifacts.types import ArtifactFileData +from neptune.internal.utils import ( + is_collection, + is_dict_like, + is_float, + is_float_like, + is_string, + is_string_like, + is_stringify_value, + verify_collection_type, + verify_type, +) +from neptune.internal.utils.paths import ( + join_paths, + parse_path, +) +from neptune.internal.value_to_attribute_visitor import ValueToAttributeVisitor from neptune.new.attributes import File from neptune.new.attributes.atoms.artifact import Artifact from neptune.new.attributes.constants import SYSTEM_STAGE_ATTRIBUTE_PATH @@ -47,23 +64,6 @@ NeptuneCannotChangeStageManually, NeptuneUserApiInputException, ) -from neptune.new.internal.artifacts.types import ArtifactFileData -from neptune.new.internal.utils import ( - is_collection, - is_dict_like, - is_float, - is_float_like, - is_string, - is_string_like, - is_stringify_value, - verify_collection_type, - verify_type, -) -from neptune.new.internal.utils.paths import ( - join_paths, - parse_path, -) -from neptune.new.internal.value_to_attribute_visitor import ValueToAttributeVisitor from neptune.new.types.atoms.file import File as FileVal from neptune.new.types.type_casting import cast_value_for_extend from neptune.new.types.value_copy import ValueCopy diff --git a/src/neptune/new/internal/__init__.py b/src/neptune/internal/__init__.py similarity index 100% rename from src/neptune/new/internal/__init__.py rename to src/neptune/internal/__init__.py diff --git a/src/neptune/new/internal/artifacts/__init__.py b/src/neptune/internal/artifacts/__init__.py similarity index 93% rename from src/neptune/new/internal/artifacts/__init__.py rename to src/neptune/internal/artifacts/__init__.py index 4c947c41b..14617c961 100644 --- a/src/neptune/new/internal/artifacts/__init__.py +++ b/src/neptune/internal/artifacts/__init__.py @@ -18,7 +18,7 @@ "S3ArtifactDriver", ] -from neptune.new.internal.artifacts.drivers import ( +from neptune.internal.artifacts.drivers import ( LocalArtifactDriver, S3ArtifactDriver, ) diff --git a/src/neptune/new/internal/artifacts/drivers/__init__.py b/src/neptune/internal/artifacts/drivers/__init__.py similarity index 81% rename from src/neptune/new/internal/artifacts/drivers/__init__.py rename to src/neptune/internal/artifacts/drivers/__init__.py index 9b43d7156..dcdf2934b 100644 --- a/src/neptune/new/internal/artifacts/drivers/__init__.py +++ b/src/neptune/internal/artifacts/drivers/__init__.py @@ -15,5 +15,5 @@ # __all__ = ["LocalArtifactDriver", "S3ArtifactDriver"] -from neptune.new.internal.artifacts.drivers.local import LocalArtifactDriver -from neptune.new.internal.artifacts.drivers.s3 import S3ArtifactDriver +from neptune.internal.artifacts.drivers.local import LocalArtifactDriver +from neptune.internal.artifacts.drivers.s3 import S3ArtifactDriver diff --git a/src/neptune/new/internal/artifacts/drivers/local.py b/src/neptune/internal/artifacts/drivers/local.py similarity index 97% rename from src/neptune/new/internal/artifacts/drivers/local.py rename to src/neptune/internal/artifacts/drivers/local.py index 69c32124e..5e9af0582 100644 --- a/src/neptune/new/internal/artifacts/drivers/local.py +++ b/src/neptune/internal/artifacts/drivers/local.py @@ -25,8 +25,8 @@ NeptuneLocalStorageAccessException, NeptuneUnsupportedArtifactFunctionalityException, ) -from neptune.new.internal.artifacts.file_hasher import FileHasher -from neptune.new.internal.artifacts.types import ( +from neptune.internal.artifacts.file_hasher import FileHasher +from neptune.internal.artifacts.types import ( ArtifactDriver, ArtifactFileData, ArtifactFileType, diff --git a/src/neptune/new/internal/artifacts/drivers/s3.py b/src/neptune/internal/artifacts/drivers/s3.py similarity index 97% rename from src/neptune/new/internal/artifacts/drivers/s3.py rename to src/neptune/internal/artifacts/drivers/s3.py index 9b2a289a4..20083a63e 100644 --- a/src/neptune/new/internal/artifacts/drivers/s3.py +++ b/src/neptune/internal/artifacts/drivers/s3.py @@ -27,12 +27,12 @@ NeptuneRemoteStorageCredentialsException, NeptuneUnsupportedArtifactFunctionalityException, ) -from neptune.new.internal.artifacts.types import ( +from neptune.internal.artifacts.types import ( ArtifactDriver, ArtifactFileData, ArtifactFileType, ) -from neptune.new.internal.utils.s3 import get_boto_s3_client +from neptune.internal.utils.s3 import get_boto_s3_client class S3ArtifactDriver(ArtifactDriver): diff --git a/src/neptune/new/internal/artifacts/file_hasher.py b/src/neptune/internal/artifacts/file_hasher.py similarity index 95% rename from src/neptune/new/internal/artifacts/file_hasher.py rename to src/neptune/internal/artifacts/file_hasher.py index 05a3faa10..78b61f4f2 100644 --- a/src/neptune/new/internal/artifacts/file_hasher.py +++ b/src/neptune/internal/artifacts/file_hasher.py @@ -20,12 +20,12 @@ import typing from pathlib import Path -from neptune.new.internal.artifacts.local_file_hash_storage import LocalFileHashStorage -from neptune.new.internal.artifacts.types import ( +from neptune.internal.artifacts.local_file_hash_storage import LocalFileHashStorage +from neptune.internal.artifacts.types import ( ArtifactFileData, ArtifactMetadataSerializer, ) -from neptune.new.internal.artifacts.utils import sha1 +from neptune.internal.artifacts.utils import sha1 class FileHasher: diff --git a/src/neptune/new/internal/artifacts/local_file_hash_storage.py b/src/neptune/internal/artifacts/local_file_hash_storage.py similarity index 100% rename from src/neptune/new/internal/artifacts/local_file_hash_storage.py rename to src/neptune/internal/artifacts/local_file_hash_storage.py diff --git a/src/neptune/new/internal/artifacts/types.py b/src/neptune/internal/artifacts/types.py similarity index 100% rename from src/neptune/new/internal/artifacts/types.py rename to src/neptune/internal/artifacts/types.py diff --git a/src/neptune/new/internal/artifacts/utils.py b/src/neptune/internal/artifacts/utils.py similarity index 100% rename from src/neptune/new/internal/artifacts/utils.py rename to src/neptune/internal/artifacts/utils.py diff --git a/src/neptune/new/internal/backends/__init__.py b/src/neptune/internal/backends/__init__.py similarity index 100% rename from src/neptune/new/internal/backends/__init__.py rename to src/neptune/internal/backends/__init__.py diff --git a/src/neptune/new/internal/backends/api_model.py b/src/neptune/internal/backends/api_model.py similarity index 98% rename from src/neptune/new/internal/backends/api_model.py rename to src/neptune/internal/backends/api_model.py index e98c1f8a6..4a94faf2f 100644 --- a/src/neptune/new/internal/backends/api_model.py +++ b/src/neptune/internal/backends/api_model.py @@ -56,8 +56,8 @@ from packaging import version from neptune.common.backends.api_model import MultipartConfig -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.id_formats import ( +from neptune.internal.container_type import ContainerType +from neptune.internal.id_formats import ( SysId, UniqueId, ) diff --git a/src/neptune/new/internal/backends/factory.py b/src/neptune/internal/backends/factory.py similarity index 96% rename from src/neptune/new/internal/backends/factory.py rename to src/neptune/internal/backends/factory.py index ee3aad12b..beb0dafc6 100644 --- a/src/neptune/new/internal/backends/factory.py +++ b/src/neptune/internal/backends/factory.py @@ -17,7 +17,7 @@ from typing import Optional -from neptune.new.internal.credentials import Credentials +from neptune.internal.credentials import Credentials from neptune.new.types.mode import Mode from .hosted_neptune_backend import HostedNeptuneBackend diff --git a/src/neptune/new/internal/backends/hosted_artifact_operations.py b/src/neptune/internal/backends/hosted_artifact_operations.py similarity index 95% rename from src/neptune/new/internal/backends/hosted_artifact_operations.py rename to src/neptune/internal/backends/hosted_artifact_operations.py index a09f24c53..cdc7ae33b 100644 --- a/src/neptune/new/internal/backends/hosted_artifact_operations.py +++ b/src/neptune/internal/backends/hosted_artifact_operations.py @@ -31,15 +31,15 @@ ArtifactUploadingError, NeptuneEmptyLocationException, ) -from neptune.new.internal.artifacts.file_hasher import FileHasher -from neptune.new.internal.artifacts.types import ( +from neptune.internal.artifacts.file_hasher import FileHasher +from neptune.internal.artifacts.types import ( ArtifactDriver, ArtifactDriversMap, ArtifactFileData, ) -from neptune.new.internal.backends.api_model import ArtifactModel -from neptune.new.internal.backends.swagger_client_wrapper import SwaggerClientWrapper -from neptune.new.internal.operation import ( +from neptune.internal.backends.api_model import ArtifactModel +from neptune.internal.backends.swagger_client_wrapper import SwaggerClientWrapper +from neptune.internal.operation import ( AssignArtifact, Operation, ) diff --git a/src/neptune/new/internal/backends/hosted_client.py b/src/neptune/internal/backends/hosted_client.py similarity index 95% rename from src/neptune/new/internal/backends/hosted_client.py rename to src/neptune/internal/backends/hosted_client.py index 8e63b2289..78fe71aee 100644 --- a/src/neptune/new/internal/backends/hosted_client.py +++ b/src/neptune/internal/backends/hosted_client.py @@ -33,9 +33,9 @@ from neptune.common.backends.utils import with_api_exceptions_handler from neptune.common.oauth import NeptuneAuthenticator from neptune.exceptions import NeptuneClientUpgradeRequiredError -from neptune.new.internal.backends.api_model import ClientConfig -from neptune.new.internal.backends.swagger_client_wrapper import SwaggerClientWrapper -from neptune.new.internal.backends.utils import ( +from neptune.internal.backends.api_model import ClientConfig +from neptune.internal.backends.swagger_client_wrapper import SwaggerClientWrapper +from neptune.internal.backends.utils import ( NeptuneResponseAdapter, build_operation_url, cache, @@ -44,7 +44,7 @@ verify_client_version, verify_host_resolution, ) -from neptune.new.internal.credentials import Credentials +from neptune.internal.credentials import Credentials from neptune.version import version as neptune_client_version BACKEND_SWAGGER_PATH = "/api/backend/swagger.json" diff --git a/src/neptune/new/internal/backends/hosted_file_operations.py b/src/neptune/internal/backends/hosted_file_operations.py similarity index 98% rename from src/neptune/new/internal/backends/hosted_file_operations.py rename to src/neptune/internal/backends/hosted_file_operations.py index 10687c228..e526b91f1 100644 --- a/src/neptune/new/internal/backends/hosted_file_operations.py +++ b/src/neptune/internal/backends/hosted_file_operations.py @@ -72,19 +72,19 @@ MetadataInconsistency, NeptuneLimitExceedException, ) -from neptune.new.internal.backends.swagger_client_wrapper import ( +from neptune.internal.backends.swagger_client_wrapper import ( ApiMethodWrapper, SwaggerClientWrapper, ) -from neptune.new.internal.backends.utils import ( +from neptune.internal.backends.utils import ( build_operation_url, handle_server_raw_response_messages, ) -from neptune.new.internal.utils import ( +from neptune.internal.utils import ( get_absolute_paths, get_common_root, ) -from neptune.new.internal.utils.logger import logger +from neptune.internal.utils.logger import logger DEFAULT_CHUNK_SIZE = 5 * BYTES_IN_ONE_MB DEFAULT_UPLOAD_CONFIG = AttributeUploadConfiguration(chunk_size=DEFAULT_CHUNK_SIZE) diff --git a/src/neptune/new/internal/backends/hosted_neptune_backend.py b/src/neptune/internal/backends/hosted_neptune_backend.py similarity index 96% rename from src/neptune/new/internal/backends/hosted_neptune_backend.py rename to src/neptune/internal/backends/hosted_neptune_backend.py index 31453663c..f5ff2e413 100644 --- a/src/neptune/new/internal/backends/hosted_neptune_backend.py +++ b/src/neptune/internal/backends/hosted_neptune_backend.py @@ -60,9 +60,8 @@ ProjectNotFound, ProjectNotFoundWithSuggestions, ) -from neptune.management.exceptions import ObjectNotFound -from neptune.new.internal.artifacts.types import ArtifactFileData -from neptune.new.internal.backends.api_model import ( +from neptune.internal.artifacts.types import ArtifactFileData +from neptune.internal.backends.api_model import ( ApiExperiment, ArtifactAttribute, Attribute, @@ -87,42 +86,42 @@ StringSetAttribute, Workspace, ) -from neptune.new.internal.backends.hosted_artifact_operations import ( +from neptune.internal.backends.hosted_artifact_operations import ( track_to_existing_artifact, track_to_new_artifact, ) -from neptune.new.internal.backends.hosted_client import ( +from neptune.internal.backends.hosted_client import ( DEFAULT_REQUEST_KWARGS, create_artifacts_client, create_backend_client, create_http_client_with_auth, create_leaderboard_client, ) -from neptune.new.internal.backends.hosted_file_operations import ( +from neptune.internal.backends.hosted_file_operations import ( download_file_attribute, download_file_set_attribute, download_image_series_element, upload_file_attribute, upload_file_set_attribute, ) -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.backends.nql import NQLQuery -from neptune.new.internal.backends.operation_api_name_visitor import OperationApiNameVisitor -from neptune.new.internal.backends.operation_api_object_converter import OperationApiObjectConverter -from neptune.new.internal.backends.operations_preprocessor import OperationsPreprocessor -from neptune.new.internal.backends.utils import ( +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.backends.nql import NQLQuery +from neptune.internal.backends.operation_api_name_visitor import OperationApiNameVisitor +from neptune.internal.backends.operation_api_object_converter import OperationApiObjectConverter +from neptune.internal.backends.operations_preprocessor import OperationsPreprocessor +from neptune.internal.backends.utils import ( ExecuteOperationsBatchingManager, MissingApiClient, build_operation_url, ssl_verify, ) -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.credentials import Credentials -from neptune.new.internal.id_formats import ( +from neptune.internal.container_type import ContainerType +from neptune.internal.credentials import Credentials +from neptune.internal.id_formats import ( QualifiedName, UniqueId, ) -from neptune.new.internal.operation import ( +from neptune.internal.operation import ( DeleteAttribute, Operation, TrackFilesToArtifact, @@ -130,17 +129,18 @@ UploadFileContent, UploadFileSet, ) -from neptune.new.internal.utils import base64_decode -from neptune.new.internal.utils.generic_attribute_mapper import map_attribute_result_to_value -from neptune.new.internal.utils.paths import path_to_str -from neptune.new.internal.websockets.websockets_factory import WebsocketsFactory +from neptune.internal.utils import base64_decode +from neptune.internal.utils.generic_attribute_mapper import map_attribute_result_to_value +from neptune.internal.utils.paths import path_to_str +from neptune.internal.websockets.websockets_factory import WebsocketsFactory +from neptune.management.exceptions import ObjectNotFound from neptune.new.types.atoms import GitRef from neptune.version import version as neptune_client_version if TYPE_CHECKING: from bravado.requests_client import RequestsClient - from neptune.new.internal.backends.api_model import ClientConfig + from neptune.internal.backends.api_model import ClientConfig _logger = logging.getLogger(__name__) diff --git a/src/neptune/new/internal/backends/neptune_backend.py b/src/neptune/internal/backends/neptune_backend.py similarity index 95% rename from src/neptune/new/internal/backends/neptune_backend.py rename to src/neptune/internal/backends/neptune_backend.py index 05f605cdc..cb838fb45 100644 --- a/src/neptune/new/internal/backends/neptune_backend.py +++ b/src/neptune/internal/backends/neptune_backend.py @@ -26,8 +26,8 @@ ) from neptune.common.exceptions import NeptuneException -from neptune.new.internal.artifacts.types import ArtifactFileData -from neptune.new.internal.backends.api_model import ( +from neptune.internal.artifacts.types import ArtifactFileData +from neptune.internal.backends.api_model import ( ApiExperiment, ArtifactAttribute, Attribute, @@ -48,14 +48,14 @@ StringSetAttribute, Workspace, ) -from neptune.new.internal.backends.nql import NQLQuery -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.id_formats import ( +from neptune.internal.backends.nql import NQLQuery +from neptune.internal.container_type import ContainerType +from neptune.internal.id_formats import ( QualifiedName, UniqueId, ) -from neptune.new.internal.operation import Operation -from neptune.new.internal.websockets.websockets_factory import WebsocketsFactory +from neptune.internal.operation import Operation +from neptune.internal.websockets.websockets_factory import WebsocketsFactory from neptune.new.types.atoms import GitRef diff --git a/src/neptune/new/internal/backends/neptune_backend_mock.py b/src/neptune/internal/backends/neptune_backend_mock.py similarity index 97% rename from src/neptune/new/internal/backends/neptune_backend_mock.py rename to src/neptune/internal/backends/neptune_backend_mock.py index dd734ea7b..8005482f3 100644 --- a/src/neptune/new/internal/backends/neptune_backend_mock.py +++ b/src/neptune/internal/backends/neptune_backend_mock.py @@ -44,8 +44,8 @@ ProjectNotFound, RunNotFound, ) -from neptune.new.internal.artifacts.types import ArtifactFileData -from neptune.new.internal.backends.api_model import ( +from neptune.internal.artifacts.types import ArtifactFileData +from neptune.internal.backends.api_model import ( ApiExperiment, ArtifactAttribute, Attribute, @@ -68,17 +68,17 @@ StringSetAttribute, Workspace, ) -from neptune.new.internal.backends.hosted_file_operations import get_unique_upload_entries -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.backends.nql import NQLQuery -from neptune.new.internal.container_structure import ContainerStructure -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.id_formats import ( +from neptune.internal.backends.hosted_file_operations import get_unique_upload_entries +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.backends.nql import NQLQuery +from neptune.internal.container_structure import ContainerStructure +from neptune.internal.container_type import ContainerType +from neptune.internal.id_formats import ( QualifiedName, SysId, UniqueId, ) -from neptune.new.internal.operation import ( +from neptune.internal.operation import ( AddStrings, AssignArtifact, AssignBool, @@ -105,11 +105,11 @@ UploadFileContent, UploadFileSet, ) -from neptune.new.internal.operation_visitor import OperationVisitor -from neptune.new.internal.types.file_types import FileType -from neptune.new.internal.utils import base64_decode -from neptune.new.internal.utils.generic_attribute_mapper import NoValue -from neptune.new.internal.utils.paths import path_to_str +from neptune.internal.operation_visitor import OperationVisitor +from neptune.internal.types.file_types import FileType +from neptune.internal.utils import base64_decode +from neptune.internal.utils.generic_attribute_mapper import NoValue +from neptune.internal.utils.paths import path_to_str from neptune.new.metadata_containers import Model from neptune.new.types import ( Boolean, diff --git a/src/neptune/new/internal/backends/nql.py b/src/neptune/internal/backends/nql.py similarity index 100% rename from src/neptune/new/internal/backends/nql.py rename to src/neptune/internal/backends/nql.py diff --git a/src/neptune/new/internal/backends/offline_neptune_backend.py b/src/neptune/internal/backends/offline_neptune_backend.py similarity index 94% rename from src/neptune/new/internal/backends/offline_neptune_backend.py rename to src/neptune/internal/backends/offline_neptune_backend.py index 30fe2758d..2af189268 100644 --- a/src/neptune/new/internal/backends/offline_neptune_backend.py +++ b/src/neptune/internal/backends/offline_neptune_backend.py @@ -18,8 +18,8 @@ from typing import List from neptune.exceptions import NeptuneOfflineModeFetchException -from neptune.new.internal.artifacts.types import ArtifactFileData -from neptune.new.internal.backends.api_model import ( +from neptune.internal.artifacts.types import ArtifactFileData +from neptune.internal.backends.api_model import ( ArtifactAttribute, Attribute, BoolAttribute, @@ -35,8 +35,8 @@ StringSeriesValues, StringSetAttribute, ) -from neptune.new.internal.backends.neptune_backend_mock import NeptuneBackendMock -from neptune.new.internal.container_type import ContainerType +from neptune.internal.backends.neptune_backend_mock import NeptuneBackendMock +from neptune.internal.container_type import ContainerType class OfflineNeptuneBackend(NeptuneBackendMock): diff --git a/src/neptune/new/internal/backends/operation_api_name_visitor.py b/src/neptune/internal/backends/operation_api_name_visitor.py similarity index 97% rename from src/neptune/new/internal/backends/operation_api_name_visitor.py rename to src/neptune/internal/backends/operation_api_name_visitor.py index 3f66a435b..7a23728cd 100644 --- a/src/neptune/new/internal/backends/operation_api_name_visitor.py +++ b/src/neptune/internal/backends/operation_api_name_visitor.py @@ -16,7 +16,7 @@ __all__ = ["OperationApiNameVisitor"] from neptune.common.exceptions import InternalClientError -from neptune.new.internal.operation import ( +from neptune.internal.operation import ( AddStrings, AssignArtifact, AssignBool, @@ -43,7 +43,7 @@ UploadFileContent, UploadFileSet, ) -from neptune.new.internal.operation_visitor import ( +from neptune.internal.operation_visitor import ( OperationVisitor, Ret, ) diff --git a/src/neptune/new/internal/backends/operation_api_object_converter.py b/src/neptune/internal/backends/operation_api_object_converter.py similarity index 98% rename from src/neptune/new/internal/backends/operation_api_object_converter.py rename to src/neptune/internal/backends/operation_api_object_converter.py index e04f77fa5..8ce48c8d3 100644 --- a/src/neptune/new/internal/backends/operation_api_object_converter.py +++ b/src/neptune/internal/backends/operation_api_object_converter.py @@ -16,7 +16,7 @@ __all__ = ["OperationApiObjectConverter"] from neptune.common.exceptions import InternalClientError -from neptune.new.internal.operation import ( +from neptune.internal.operation import ( AddStrings, AssignArtifact, AssignBool, @@ -43,7 +43,7 @@ UploadFileContent, UploadFileSet, ) -from neptune.new.internal.operation_visitor import ( +from neptune.internal.operation_visitor import ( OperationVisitor, Ret, ) diff --git a/src/neptune/new/internal/backends/operations_preprocessor.py b/src/neptune/internal/backends/operations_preprocessor.py similarity index 98% rename from src/neptune/new/internal/backends/operations_preprocessor.py rename to src/neptune/internal/backends/operations_preprocessor.py index 03d914aea..b71abc768 100644 --- a/src/neptune/new/internal/backends/operations_preprocessor.py +++ b/src/neptune/internal/backends/operations_preprocessor.py @@ -26,7 +26,7 @@ from neptune.common.exceptions import InternalClientError from neptune.exceptions import MetadataInconsistency -from neptune.new.internal.operation import ( +from neptune.internal.operation import ( AddStrings, AssignArtifact, AssignBool, @@ -52,8 +52,8 @@ UploadFileContent, UploadFileSet, ) -from neptune.new.internal.operation_visitor import OperationVisitor -from neptune.new.internal.utils.paths import path_to_str +from neptune.internal.operation_visitor import OperationVisitor +from neptune.internal.utils.paths import path_to_str T = TypeVar("T") diff --git a/src/neptune/new/internal/backends/project_name_lookup.py b/src/neptune/internal/backends/project_name_lookup.py similarity index 85% rename from src/neptune/new/internal/backends/project_name_lookup.py rename to src/neptune/internal/backends/project_name_lookup.py index cc55a2e57..12c2af289 100644 --- a/src/neptune/new/internal/backends/project_name_lookup.py +++ b/src/neptune/internal/backends/project_name_lookup.py @@ -21,10 +21,10 @@ from neptune.envs import PROJECT_ENV_NAME from neptune.exceptions import NeptuneMissingProjectNameException -from neptune.new.internal.backends.api_model import Project -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.id_formats import QualifiedName -from neptune.new.internal.utils import verify_type +from neptune.internal.backends.api_model import Project +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.id_formats import QualifiedName +from neptune.internal.utils import verify_type _logger = logging.getLogger(__name__) diff --git a/src/neptune/new/internal/backends/swagger_client_wrapper.py b/src/neptune/internal/backends/swagger_client_wrapper.py similarity index 100% rename from src/neptune/new/internal/backends/swagger_client_wrapper.py rename to src/neptune/internal/backends/swagger_client_wrapper.py diff --git a/src/neptune/new/internal/backends/utils.py b/src/neptune/internal/backends/utils.py similarity index 95% rename from src/neptune/new/internal/backends/utils.py rename to src/neptune/internal/backends/utils.py index ab342ed29..ea724ced9 100644 --- a/src/neptune/new/internal/backends/utils.py +++ b/src/neptune/internal/backends/utils.py @@ -71,19 +71,19 @@ NeptuneClientUpgradeRequiredError, NeptuneFeatureNotAvailableException, ) -from neptune.new.internal.backends.api_model import ClientConfig -from neptune.new.internal.backends.swagger_client_wrapper import SwaggerClientWrapper -from neptune.new.internal.operation import ( +from neptune.internal.backends.api_model import ClientConfig +from neptune.internal.backends.swagger_client_wrapper import SwaggerClientWrapper +from neptune.internal.operation import ( CopyAttribute, Operation, ) -from neptune.new.internal.utils import replace_patch_version -from neptune.new.internal.utils.logger import logger +from neptune.internal.utils import replace_patch_version +from neptune.internal.utils.logger import logger _logger = logging.getLogger(__name__) if TYPE_CHECKING: - from neptune.new.internal.backends.neptune_backend import NeptuneBackend + from neptune.internal.backends.neptune_backend import NeptuneBackend @lru_cache(maxsize=None, typed=True) diff --git a/src/neptune/new/internal/backgroud_job_list.py b/src/neptune/internal/backgroud_job_list.py similarity index 95% rename from src/neptune/new/internal/backgroud_job_list.py rename to src/neptune/internal/backgroud_job_list.py index 5650f6670..802cfcf6b 100644 --- a/src/neptune/new/internal/backgroud_job_list.py +++ b/src/neptune/internal/backgroud_job_list.py @@ -22,7 +22,7 @@ Optional, ) -from neptune.new.internal.background_job import BackgroundJob +from neptune.internal.background_job import BackgroundJob if TYPE_CHECKING: from neptune.new.metadata_containers import MetadataContainer diff --git a/src/neptune/new/internal/background_job.py b/src/neptune/internal/background_job.py similarity index 100% rename from src/neptune/new/internal/background_job.py rename to src/neptune/internal/background_job.py diff --git a/src/neptune/new/internal/container_structure.py b/src/neptune/internal/container_structure.py similarity index 98% rename from src/neptune/new/internal/container_structure.py rename to src/neptune/internal/container_structure.py index f28b2c5c9..ebb01884b 100644 --- a/src/neptune/new/internal/container_structure.py +++ b/src/neptune/internal/container_structure.py @@ -26,7 +26,7 @@ ) from neptune.exceptions import MetadataInconsistency -from neptune.new.internal.utils.paths import path_to_str +from neptune.internal.utils.paths import path_to_str T = TypeVar("T") Node = TypeVar("Node") diff --git a/src/neptune/new/internal/container_type.py b/src/neptune/internal/container_type.py similarity index 95% rename from src/neptune/new/internal/container_type.py rename to src/neptune/internal/container_type.py index 9e47cadd5..f13ee81b8 100644 --- a/src/neptune/new/internal/container_type.py +++ b/src/neptune/internal/container_type.py @@ -17,7 +17,7 @@ import enum -from neptune.new.internal.id_formats import UniqueId +from neptune.internal.id_formats import UniqueId class ContainerType(str, enum.Enum): diff --git a/src/neptune/new/internal/credentials.py b/src/neptune/internal/credentials.py similarity index 100% rename from src/neptune/new/internal/credentials.py rename to src/neptune/internal/credentials.py diff --git a/src/neptune/new/internal/disk_queue.py b/src/neptune/internal/disk_queue.py similarity index 98% rename from src/neptune/new/internal/disk_queue.py rename to src/neptune/internal/disk_queue.py index e650822b6..c6bdd69ad 100644 --- a/src/neptune/new/internal/disk_queue.py +++ b/src/neptune/internal/disk_queue.py @@ -33,8 +33,8 @@ ) from neptune.exceptions import MalformedOperation -from neptune.new.internal.utils.json_file_splitter import JsonFileSplitter -from neptune.new.internal.utils.sync_offset_file import SyncOffsetFile +from neptune.internal.utils.json_file_splitter import JsonFileSplitter +from neptune.internal.utils.sync_offset_file import SyncOffsetFile T = TypeVar("T") diff --git a/src/neptune/new/internal/exceptions.py b/src/neptune/internal/exceptions.py similarity index 100% rename from src/neptune/new/internal/exceptions.py rename to src/neptune/internal/exceptions.py diff --git a/src/neptune/new/internal/hardware/__init__.py b/src/neptune/internal/hardware/__init__.py similarity index 100% rename from src/neptune/new/internal/hardware/__init__.py rename to src/neptune/internal/hardware/__init__.py diff --git a/src/neptune/new/internal/hardware/gpu/__init__.py b/src/neptune/internal/hardware/gpu/__init__.py similarity index 100% rename from src/neptune/new/internal/hardware/gpu/__init__.py rename to src/neptune/internal/hardware/gpu/__init__.py diff --git a/src/neptune/new/internal/hardware/gpu/gpu_monitor.py b/src/neptune/internal/hardware/gpu/gpu_monitor.py similarity index 100% rename from src/neptune/new/internal/hardware/gpu/gpu_monitor.py rename to src/neptune/internal/hardware/gpu/gpu_monitor.py diff --git a/src/neptune/new/internal/hardware/hardware_metric_reporting_job.py b/src/neptune/internal/hardware/hardware_metric_reporting_job.py similarity index 96% rename from src/neptune/new/internal/hardware/hardware_metric_reporting_job.py rename to src/neptune/internal/hardware/hardware_metric_reporting_job.py index 814e407bf..84dae3cd2 100644 --- a/src/neptune/new/internal/hardware/hardware_metric_reporting_job.py +++ b/src/neptune/internal/hardware/hardware_metric_reporting_job.py @@ -33,9 +33,9 @@ from neptune.common.hardware.resources.system_resource_info_factory import SystemResourceInfoFactory from neptune.common.hardware.system.system_monitor import SystemMonitor from neptune.common.utils import in_docker -from neptune.new.internal.background_job import BackgroundJob -from neptune.new.internal.hardware.gpu.gpu_monitor import GPUMonitor -from neptune.new.internal.threading.daemon import Daemon +from neptune.internal.background_job import BackgroundJob +from neptune.internal.hardware.gpu.gpu_monitor import GPUMonitor +from neptune.internal.threading.daemon import Daemon from neptune.new.types.series import FloatSeries if TYPE_CHECKING: diff --git a/src/neptune/new/internal/id_formats.py b/src/neptune/internal/id_formats.py similarity index 100% rename from src/neptune/new/internal/id_formats.py rename to src/neptune/internal/id_formats.py diff --git a/src/neptune/new/internal/init/__init__.py b/src/neptune/internal/init/__init__.py similarity index 76% rename from src/neptune/new/internal/init/__init__.py rename to src/neptune/internal/init/__init__.py index be8702bb3..31c394339 100644 --- a/src/neptune/new/internal/init/__init__.py +++ b/src/neptune/internal/init/__init__.py @@ -25,14 +25,14 @@ ] -from neptune.new.internal.init.model import init_model -from neptune.new.internal.init.model_version import init_model_version -from neptune.new.internal.init.project import ( +from neptune.internal.init.model import init_model +from neptune.internal.init.model_version import init_model_version +from neptune.internal.init.project import ( get_project, init_project, ) -from neptune.new.internal.init.run import init_run -from neptune.new.internal.utils.deprecation import deprecated +from neptune.internal.init.run import init_run +from neptune.internal.utils.deprecation import deprecated from neptune.new.types.mode import Mode RunMode = Mode diff --git a/src/neptune/new/internal/init/model.py b/src/neptune/internal/init/model.py similarity index 87% rename from src/neptune/new/internal/init/model.py rename to src/neptune/internal/init/model.py index 3d8cec2a1..5ee20f8b8 100644 --- a/src/neptune/new/internal/init/model.py +++ b/src/neptune/internal/init/model.py @@ -27,21 +27,21 @@ NeptuneModelKeyAlreadyExistsError, NeptuneObjectCreationConflict, ) -from neptune.new.attributes import constants as attr_consts -from neptune.new.internal import id_formats -from neptune.new.internal.backends.factory import get_backend -from neptune.new.internal.backends.project_name_lookup import project_name_lookup -from neptune.new.internal.backgroud_job_list import BackgroundJobList -from neptune.new.internal.id_formats import QualifiedName -from neptune.new.internal.init.parameters import ( +from neptune.internal import id_formats +from neptune.internal.backends.factory import get_backend +from neptune.internal.backends.project_name_lookup import project_name_lookup +from neptune.internal.backgroud_job_list import BackgroundJobList +from neptune.internal.id_formats import QualifiedName +from neptune.internal.init.parameters import ( DEFAULT_FLUSH_PERIOD, DEFAULT_NAME, OFFLINE_PROJECT_QUALIFIED_NAME, ) -from neptune.new.internal.operation_processors.factory import get_operation_processor -from neptune.new.internal.utils import verify_type -from neptune.new.internal.utils.deprecation import deprecated_parameter -from neptune.new.internal.utils.ping_background_job import PingBackgroundJob +from neptune.internal.operation_processors.factory import get_operation_processor +from neptune.internal.utils import verify_type +from neptune.internal.utils.deprecation import deprecated_parameter +from neptune.internal.utils.ping_background_job import PingBackgroundJob +from neptune.new.attributes import constants as attr_consts from neptune.new.metadata_containers import Model from neptune.new.types.mode import Mode diff --git a/src/neptune/new/internal/init/model_version.py b/src/neptune/internal/init/model_version.py similarity index 87% rename from src/neptune/new/internal/init/model_version.py rename to src/neptune/internal/init/model_version.py index 84f11098b..6a36b4563 100644 --- a/src/neptune/new/internal/init/model_version.py +++ b/src/neptune/internal/init/model_version.py @@ -25,21 +25,21 @@ NeedExistingModelVersionForReadOnlyMode, NeptuneMissingRequiredInitParameter, ) -from neptune.new.attributes import constants as attr_consts -from neptune.new.internal import id_formats -from neptune.new.internal.backends.factory import get_backend -from neptune.new.internal.backends.project_name_lookup import project_name_lookup -from neptune.new.internal.backgroud_job_list import BackgroundJobList -from neptune.new.internal.id_formats import QualifiedName -from neptune.new.internal.init.parameters import ( +from neptune.internal import id_formats +from neptune.internal.backends.factory import get_backend +from neptune.internal.backends.project_name_lookup import project_name_lookup +from neptune.internal.backgroud_job_list import BackgroundJobList +from neptune.internal.id_formats import QualifiedName +from neptune.internal.init.parameters import ( DEFAULT_FLUSH_PERIOD, DEFAULT_NAME, OFFLINE_PROJECT_QUALIFIED_NAME, ) -from neptune.new.internal.operation_processors.factory import get_operation_processor -from neptune.new.internal.utils import verify_type -from neptune.new.internal.utils.deprecation import deprecated_parameter -from neptune.new.internal.utils.ping_background_job import PingBackgroundJob +from neptune.internal.operation_processors.factory import get_operation_processor +from neptune.internal.utils import verify_type +from neptune.internal.utils.deprecation import deprecated_parameter +from neptune.internal.utils.ping_background_job import PingBackgroundJob +from neptune.new.attributes import constants as attr_consts from neptune.new.metadata_containers import ( Model, ModelVersion, diff --git a/src/neptune/new/internal/init/parameters.py b/src/neptune/internal/init/parameters.py similarity index 100% rename from src/neptune/new/internal/init/parameters.py rename to src/neptune/internal/init/parameters.py diff --git a/src/neptune/new/internal/init/project.py b/src/neptune/internal/init/project.py similarity index 88% rename from src/neptune/new/internal/init/project.py rename to src/neptune/internal/init/project.py index 73ed95b50..77b048702 100644 --- a/src/neptune/new/internal/init/project.py +++ b/src/neptune/internal/init/project.py @@ -21,15 +21,15 @@ from neptune.common.exceptions import NeptuneException from neptune.envs import CONNECTION_MODE -from neptune.new.internal import id_formats -from neptune.new.internal.backends.factory import get_backend -from neptune.new.internal.backends.project_name_lookup import project_name_lookup -from neptune.new.internal.backgroud_job_list import BackgroundJobList -from neptune.new.internal.id_formats import QualifiedName -from neptune.new.internal.init.parameters import DEFAULT_FLUSH_PERIOD -from neptune.new.internal.operation_processors.factory import get_operation_processor -from neptune.new.internal.utils import verify_type -from neptune.new.internal.utils.deprecation import ( +from neptune.internal import id_formats +from neptune.internal.backends.factory import get_backend +from neptune.internal.backends.project_name_lookup import project_name_lookup +from neptune.internal.backgroud_job_list import BackgroundJobList +from neptune.internal.id_formats import QualifiedName +from neptune.internal.init.parameters import DEFAULT_FLUSH_PERIOD +from neptune.internal.operation_processors.factory import get_operation_processor +from neptune.internal.utils import verify_type +from neptune.internal.utils.deprecation import ( deprecated, deprecated_parameter, ) diff --git a/src/neptune/new/internal/init/run.py b/src/neptune/internal/init/run.py similarity index 91% rename from src/neptune/new/internal/init/run.py rename to src/neptune/internal/init/run.py index 631537ffc..8f3dbb6fc 100644 --- a/src/neptune/new/internal/init/run.py +++ b/src/neptune/internal/init/run.py @@ -36,39 +36,39 @@ NeptunePossibleLegacyUsageException, NeptuneRunResumeAndCustomIdCollision, ) -from neptune.new.attributes import constants as attr_consts -from neptune.new.internal import id_formats -from neptune.new.internal.backends.factory import get_backend -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.backends.project_name_lookup import project_name_lookup -from neptune.new.internal.backgroud_job_list import BackgroundJobList -from neptune.new.internal.hardware.hardware_metric_reporting_job import HardwareMetricReportingJob -from neptune.new.internal.id_formats import QualifiedName -from neptune.new.internal.init.parameters import ( +from neptune.internal import id_formats +from neptune.internal.backends.factory import get_backend +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.backends.project_name_lookup import project_name_lookup +from neptune.internal.backgroud_job_list import BackgroundJobList +from neptune.internal.hardware.hardware_metric_reporting_job import HardwareMetricReportingJob +from neptune.internal.id_formats import QualifiedName +from neptune.internal.init.parameters import ( DEFAULT_FLUSH_PERIOD, DEFAULT_NAME, OFFLINE_PROJECT_QUALIFIED_NAME, ) -from neptune.new.internal.notebooks.notebooks import create_checkpoint -from neptune.new.internal.operation_processors.factory import get_operation_processor -from neptune.new.internal.streams.std_capture_background_job import ( +from neptune.internal.notebooks.notebooks import create_checkpoint +from neptune.internal.operation_processors.factory import get_operation_processor +from neptune.internal.streams.std_capture_background_job import ( StderrCaptureBackgroundJob, StdoutCaptureBackgroundJob, ) -from neptune.new.internal.utils import ( +from neptune.internal.utils import ( verify_collection_type, verify_type, ) -from neptune.new.internal.utils.deprecation import deprecated_parameter -from neptune.new.internal.utils.git import ( +from neptune.internal.utils.deprecation import deprecated_parameter +from neptune.internal.utils.git import ( discover_git_repo_location, get_git_info, ) -from neptune.new.internal.utils.limits import custom_run_id_exceeds_length -from neptune.new.internal.utils.ping_background_job import PingBackgroundJob -from neptune.new.internal.utils.source_code import upload_source_code -from neptune.new.internal.utils.traceback_job import TracebackJob -from neptune.new.internal.websockets.websocket_signals_background_job import WebsocketSignalsBackgroundJob +from neptune.internal.utils.limits import custom_run_id_exceeds_length +from neptune.internal.utils.ping_background_job import PingBackgroundJob +from neptune.internal.utils.source_code import upload_source_code +from neptune.internal.utils.traceback_job import TracebackJob +from neptune.internal.websockets.websocket_signals_background_job import WebsocketSignalsBackgroundJob +from neptune.new.attributes import constants as attr_consts from neptune.new.metadata_containers import Run from neptune.new.types.mode import Mode from neptune.new.types.series.string_series import StringSeries diff --git a/src/neptune/new/internal/notebooks/__init__.py b/src/neptune/internal/notebooks/__init__.py similarity index 100% rename from src/neptune/new/internal/notebooks/__init__.py rename to src/neptune/internal/notebooks/__init__.py diff --git a/src/neptune/new/internal/notebooks/comm.py b/src/neptune/internal/notebooks/comm.py similarity index 100% rename from src/neptune/new/internal/notebooks/comm.py rename to src/neptune/internal/notebooks/comm.py diff --git a/src/neptune/new/internal/notebooks/notebooks.py b/src/neptune/internal/notebooks/notebooks.py similarity index 89% rename from src/neptune/new/internal/notebooks/notebooks.py rename to src/neptune/internal/notebooks/notebooks.py index 21d3aeb08..09fdf574c 100644 --- a/src/neptune/new/internal/notebooks/notebooks.py +++ b/src/neptune/internal/notebooks/notebooks.py @@ -18,9 +18,9 @@ import logging import threading -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.notebooks.comm import send_checkpoint_created -from neptune.new.internal.utils import is_ipython +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.notebooks.comm import send_checkpoint_created +from neptune.internal.utils import is_ipython _logger = logging.getLogger(__name__) diff --git a/src/neptune/new/internal/operation.py b/src/neptune/internal/operation.py similarity index 98% rename from src/neptune/new/internal/operation.py rename to src/neptune/internal/operation.py index 662587a74..7f238da38 100644 --- a/src/neptune/new/internal/operation.py +++ b/src/neptune/internal/operation.py @@ -31,14 +31,14 @@ from neptune.common.exceptions import InternalClientError from neptune.exceptions import MalformedOperation -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.types.file_types import FileType +from neptune.internal.container_type import ContainerType +from neptune.internal.types.file_types import FileType from neptune.new.types.atoms.file import File if TYPE_CHECKING: + from neptune.internal.backends.neptune_backend import NeptuneBackend + from neptune.internal.operation_visitor import OperationVisitor from neptune.new.attributes.attribute import Attribute - from neptune.new.internal.backends.neptune_backend import NeptuneBackend - from neptune.new.internal.operation_visitor import OperationVisitor Ret = TypeVar("Ret") T = TypeVar("T") diff --git a/src/neptune/new/internal/operation_processors/__init__.py b/src/neptune/internal/operation_processors/__init__.py similarity index 100% rename from src/neptune/new/internal/operation_processors/__init__.py rename to src/neptune/internal/operation_processors/__init__.py diff --git a/src/neptune/new/internal/operation_processors/async_operation_processor.py b/src/neptune/internal/operation_processors/async_operation_processor.py similarity index 94% rename from src/neptune/new/internal/operation_processors/async_operation_processor.py rename to src/neptune/internal/operation_processors/async_operation_processor.py index dd3f09765..0dda2ac8d 100644 --- a/src/neptune/new/internal/operation_processors/async_operation_processor.py +++ b/src/neptune/internal/operation_processors/async_operation_processor.py @@ -34,15 +34,15 @@ NEPTUNE_DATA_DIRECTORY, ) from neptune.exceptions import NeptuneSynchronizationAlreadyStoppedException -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.disk_queue import DiskQueue -from neptune.new.internal.id_formats import UniqueId -from neptune.new.internal.operation import Operation -from neptune.new.internal.operation_processors.operation_processor import OperationProcessor -from neptune.new.internal.operation_processors.operation_storage import OperationStorage -from neptune.new.internal.threading.daemon import Daemon -from neptune.new.internal.utils.logger import logger +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.container_type import ContainerType +from neptune.internal.disk_queue import DiskQueue +from neptune.internal.id_formats import UniqueId +from neptune.internal.operation import Operation +from neptune.internal.operation_processors.operation_processor import OperationProcessor +from neptune.internal.operation_processors.operation_storage import OperationStorage +from neptune.internal.threading.daemon import Daemon +from neptune.internal.utils.logger import logger _logger = logging.getLogger(__name__) diff --git a/src/neptune/new/internal/operation_processors/factory.py b/src/neptune/internal/operation_processors/factory.py similarity index 91% rename from src/neptune/new/internal/operation_processors/factory.py rename to src/neptune/internal/operation_processors/factory.py index 76ba69a90..88f876b26 100644 --- a/src/neptune/new/internal/operation_processors/factory.py +++ b/src/neptune/internal/operation_processors/factory.py @@ -18,9 +18,9 @@ import threading -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.id_formats import UniqueId +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.container_type import ContainerType +from neptune.internal.id_formats import UniqueId from neptune.new.types.mode import Mode from .async_operation_processor import AsyncOperationProcessor diff --git a/src/neptune/new/internal/operation_processors/offline_operation_processor.py b/src/neptune/internal/operation_processors/offline_operation_processor.py similarity index 81% rename from src/neptune/new/internal/operation_processors/offline_operation_processor.py rename to src/neptune/internal/operation_processors/offline_operation_processor.py index 2e6792d70..1983fd4c3 100644 --- a/src/neptune/new/internal/operation_processors/offline_operation_processor.py +++ b/src/neptune/internal/operation_processors/offline_operation_processor.py @@ -22,12 +22,12 @@ NEPTUNE_DATA_DIRECTORY, OFFLINE_DIRECTORY, ) -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.disk_queue import DiskQueue -from neptune.new.internal.id_formats import UniqueId -from neptune.new.internal.operation import Operation -from neptune.new.internal.operation_processors.operation_processor import OperationProcessor -from neptune.new.internal.operation_processors.operation_storage import OperationStorage +from neptune.internal.container_type import ContainerType +from neptune.internal.disk_queue import DiskQueue +from neptune.internal.id_formats import UniqueId +from neptune.internal.operation import Operation +from neptune.internal.operation_processors.operation_processor import OperationProcessor +from neptune.internal.operation_processors.operation_storage import OperationStorage class OfflineOperationProcessor(OperationProcessor): diff --git a/src/neptune/new/internal/operation_processors/operation_processor.py b/src/neptune/internal/operation_processors/operation_processor.py similarity index 95% rename from src/neptune/new/internal/operation_processors/operation_processor.py rename to src/neptune/internal/operation_processors/operation_processor.py index 61b618524..a5c47590e 100644 --- a/src/neptune/new/internal/operation_processors/operation_processor.py +++ b/src/neptune/internal/operation_processors/operation_processor.py @@ -18,7 +18,7 @@ import abc from typing import Optional -from neptune.new.internal.operation import Operation +from neptune.internal.operation import Operation class OperationProcessor(abc.ABC): diff --git a/src/neptune/new/internal/operation_processors/operation_storage.py b/src/neptune/internal/operation_processors/operation_storage.py similarity index 91% rename from src/neptune/new/internal/operation_processors/operation_storage.py rename to src/neptune/internal/operation_processors/operation_storage.py index 34363c5f6..9a4546e3a 100644 --- a/src/neptune/new/internal/operation_processors/operation_storage.py +++ b/src/neptune/internal/operation_processors/operation_storage.py @@ -22,9 +22,9 @@ from pathlib import Path from neptune.constants import NEPTUNE_DATA_DIRECTORY -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.id_formats import UniqueId -from neptune.new.internal.utils.logger import logger +from neptune.internal.container_type import ContainerType +from neptune.internal.id_formats import UniqueId +from neptune.internal.utils.logger import logger class OperationStorage: diff --git a/src/neptune/new/internal/operation_processors/read_only_operation_processor.py b/src/neptune/internal/operation_processors/read_only_operation_processor.py similarity index 86% rename from src/neptune/new/internal/operation_processors/read_only_operation_processor.py rename to src/neptune/internal/operation_processors/read_only_operation_processor.py index e1309ec2a..c38aec585 100644 --- a/src/neptune/new/internal/operation_processors/read_only_operation_processor.py +++ b/src/neptune/internal/operation_processors/read_only_operation_processor.py @@ -18,9 +18,9 @@ import logging from typing import Optional -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.operation import Operation -from neptune.new.internal.operation_processors.operation_processor import OperationProcessor +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.operation import Operation +from neptune.internal.operation_processors.operation_processor import OperationProcessor _logger = logging.getLogger(__name__) diff --git a/src/neptune/new/internal/operation_processors/sync_operation_processor.py b/src/neptune/internal/operation_processors/sync_operation_processor.py similarity index 82% rename from src/neptune/new/internal/operation_processors/sync_operation_processor.py rename to src/neptune/internal/operation_processors/sync_operation_processor.py index 082cdfa43..58a8ee5ed 100644 --- a/src/neptune/new/internal/operation_processors/sync_operation_processor.py +++ b/src/neptune/internal/operation_processors/sync_operation_processor.py @@ -22,12 +22,12 @@ NEPTUNE_DATA_DIRECTORY, SYNC_DIRECTORY, ) -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.id_formats import UniqueId -from neptune.new.internal.operation import Operation -from neptune.new.internal.operation_processors.operation_processor import OperationProcessor -from neptune.new.internal.operation_processors.operation_storage import OperationStorage +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.container_type import ContainerType +from neptune.internal.id_formats import UniqueId +from neptune.internal.operation import Operation +from neptune.internal.operation_processors.operation_processor import OperationProcessor +from neptune.internal.operation_processors.operation_storage import OperationStorage class SyncOperationProcessor(OperationProcessor): diff --git a/src/neptune/new/internal/operation_visitor.py b/src/neptune/internal/operation_visitor.py similarity index 98% rename from src/neptune/new/internal/operation_visitor.py rename to src/neptune/internal/operation_visitor.py index 0b85626b6..12ef82ac6 100644 --- a/src/neptune/new/internal/operation_visitor.py +++ b/src/neptune/internal/operation_visitor.py @@ -21,7 +21,7 @@ TypeVar, ) -from neptune.new.internal.operation import ( +from neptune.internal.operation import ( AddStrings, AssignArtifact, AssignBool, diff --git a/src/neptune/new/internal/state.py b/src/neptune/internal/state.py similarity index 100% rename from src/neptune/new/internal/state.py rename to src/neptune/internal/state.py diff --git a/src/neptune/new/internal/streams/__init__.py b/src/neptune/internal/streams/__init__.py similarity index 100% rename from src/neptune/new/internal/streams/__init__.py rename to src/neptune/internal/streams/__init__.py diff --git a/src/neptune/new/internal/streams/std_capture_background_job.py b/src/neptune/internal/streams/std_capture_background_job.py similarity index 93% rename from src/neptune/new/internal/streams/std_capture_background_job.py rename to src/neptune/internal/streams/std_capture_background_job.py index 7bd9da4bb..309da33b5 100644 --- a/src/neptune/new/internal/streams/std_capture_background_job.py +++ b/src/neptune/internal/streams/std_capture_background_job.py @@ -20,15 +20,15 @@ Optional, ) +from neptune.internal.background_job import BackgroundJob +from neptune.internal.streams.std_stream_capture_logger import ( + StderrCaptureLogger, + StdoutCaptureLogger, +) from neptune.new.attributes.constants import ( MONITORING_STDERR_ATTRIBUTE_PATH, MONITORING_STDOUT_ATTRIBUTE_PATH, ) -from neptune.new.internal.background_job import BackgroundJob -from neptune.new.internal.streams.std_stream_capture_logger import ( - StderrCaptureLogger, - StdoutCaptureLogger, -) if TYPE_CHECKING: from neptune.new.metadata_containers import MetadataContainer diff --git a/src/neptune/new/internal/streams/std_stream_capture_logger.py b/src/neptune/internal/streams/std_stream_capture_logger.py similarity index 100% rename from src/neptune/new/internal/streams/std_stream_capture_logger.py rename to src/neptune/internal/streams/std_stream_capture_logger.py diff --git a/src/neptune/new/internal/threading/__init__.py b/src/neptune/internal/threading/__init__.py similarity index 100% rename from src/neptune/new/internal/threading/__init__.py rename to src/neptune/internal/threading/__init__.py diff --git a/src/neptune/new/internal/threading/daemon.py b/src/neptune/internal/threading/daemon.py similarity index 98% rename from src/neptune/new/internal/threading/daemon.py rename to src/neptune/internal/threading/daemon.py index 7d3a0560f..4c63f7795 100644 --- a/src/neptune/new/internal/threading/daemon.py +++ b/src/neptune/internal/threading/daemon.py @@ -21,7 +21,7 @@ import time from neptune.common.exceptions import NeptuneConnectionLostException -from neptune.new.internal.utils.logger import logger +from neptune.internal.utils.logger import logger class Daemon(threading.Thread): diff --git a/src/neptune/new/internal/types/__init__.py b/src/neptune/internal/types/__init__.py similarity index 100% rename from src/neptune/new/internal/types/__init__.py rename to src/neptune/internal/types/__init__.py diff --git a/src/neptune/new/internal/types/file_types.py b/src/neptune/internal/types/file_types.py similarity index 98% rename from src/neptune/new/internal/types/file_types.py rename to src/neptune/internal/types/file_types.py index 0b0598da4..0fde7eef9 100644 --- a/src/neptune/new/internal/types/file_types.py +++ b/src/neptune/internal/types/file_types.py @@ -34,7 +34,7 @@ from neptune.common.exceptions import NeptuneException from neptune.exceptions import StreamAlreadyUsedException -from neptune.new.internal.utils import verify_type +from neptune.internal.utils import verify_type class FileType(enum.Enum): diff --git a/src/neptune/new/internal/utils/__init__.py b/src/neptune/internal/utils/__init__.py similarity index 98% rename from src/neptune/new/internal/utils/__init__.py rename to src/neptune/internal/utils/__init__.py index 8fc95671f..378c05224 100644 --- a/src/neptune/new/internal/utils/__init__.py +++ b/src/neptune/internal/utils/__init__.py @@ -51,7 +51,7 @@ Union, ) -from neptune.new.internal.utils.stringify_value import StringifyValue +from neptune.internal.utils.stringify_value import StringifyValue T = TypeVar("T") diff --git a/src/neptune/new/internal/utils/deprecation.py b/src/neptune/internal/utils/deprecation.py similarity index 100% rename from src/neptune/new/internal/utils/deprecation.py rename to src/neptune/internal/utils/deprecation.py diff --git a/src/neptune/new/internal/utils/generic_attribute_mapper.py b/src/neptune/internal/utils/generic_attribute_mapper.py similarity index 97% rename from src/neptune/new/internal/utils/generic_attribute_mapper.py rename to src/neptune/internal/utils/generic_attribute_mapper.py index 8f587954f..3f5a29752 100644 --- a/src/neptune/new/internal/utils/generic_attribute_mapper.py +++ b/src/neptune/internal/utils/generic_attribute_mapper.py @@ -15,7 +15,7 @@ # __all__ = ["NoValue", "atomic_attribute_types_map", "map_attribute_result_to_value"] -from neptune.new.internal.backends.api_model import AttributeType +from neptune.internal.backends.api_model import AttributeType class NoValue: diff --git a/src/neptune/new/internal/utils/git.py b/src/neptune/internal/utils/git.py similarity index 100% rename from src/neptune/new/internal/utils/git.py rename to src/neptune/internal/utils/git.py diff --git a/src/neptune/new/internal/utils/images.py b/src/neptune/internal/utils/images.py similarity index 99% rename from src/neptune/new/internal/utils/images.py rename to src/neptune/internal/utils/images.py index 56b1d3e31..7ed833f79 100644 --- a/src/neptune/new/internal/utils/images.py +++ b/src/neptune/internal/utils/images.py @@ -41,7 +41,7 @@ from pandas import DataFrame from neptune.exceptions import PlotlyIncompatibilityException -from neptune.new.internal.utils.logger import logger +from neptune.internal.utils.logger import logger _logger = logging.getLogger(__name__) diff --git a/src/neptune/new/internal/utils/iteration.py b/src/neptune/internal/utils/iteration.py similarity index 100% rename from src/neptune/new/internal/utils/iteration.py rename to src/neptune/internal/utils/iteration.py diff --git a/src/neptune/new/internal/utils/json_file_splitter.py b/src/neptune/internal/utils/json_file_splitter.py similarity index 100% rename from src/neptune/new/internal/utils/json_file_splitter.py rename to src/neptune/internal/utils/json_file_splitter.py diff --git a/src/neptune/new/internal/utils/limits.py b/src/neptune/internal/utils/limits.py similarity index 100% rename from src/neptune/new/internal/utils/limits.py rename to src/neptune/internal/utils/limits.py diff --git a/src/neptune/new/internal/utils/logger.py b/src/neptune/internal/utils/logger.py similarity index 100% rename from src/neptune/new/internal/utils/logger.py rename to src/neptune/internal/utils/logger.py diff --git a/src/neptune/new/internal/utils/paths.py b/src/neptune/internal/utils/paths.py similarity index 100% rename from src/neptune/new/internal/utils/paths.py rename to src/neptune/internal/utils/paths.py diff --git a/src/neptune/new/internal/utils/ping_background_job.py b/src/neptune/internal/utils/ping_background_job.py similarity index 94% rename from src/neptune/new/internal/utils/ping_background_job.py rename to src/neptune/internal/utils/ping_background_job.py index 87e5109fb..06c298c00 100644 --- a/src/neptune/new/internal/utils/ping_background_job.py +++ b/src/neptune/internal/utils/ping_background_job.py @@ -21,8 +21,8 @@ Optional, ) -from neptune.new.internal.background_job import BackgroundJob -from neptune.new.internal.threading.daemon import Daemon +from neptune.internal.background_job import BackgroundJob +from neptune.internal.threading.daemon import Daemon if TYPE_CHECKING: from neptune.new.metadata_containers import MetadataContainer diff --git a/src/neptune/new/internal/utils/process_killer.py b/src/neptune/internal/utils/process_killer.py similarity index 100% rename from src/neptune/new/internal/utils/process_killer.py rename to src/neptune/internal/utils/process_killer.py diff --git a/src/neptune/new/internal/utils/runningmode.py b/src/neptune/internal/utils/runningmode.py similarity index 100% rename from src/neptune/new/internal/utils/runningmode.py rename to src/neptune/internal/utils/runningmode.py diff --git a/src/neptune/new/internal/utils/s3.py b/src/neptune/internal/utils/s3.py similarity index 100% rename from src/neptune/new/internal/utils/s3.py rename to src/neptune/internal/utils/s3.py diff --git a/src/neptune/new/internal/utils/source_code.py b/src/neptune/internal/utils/source_code.py similarity index 98% rename from src/neptune/new/internal/utils/source_code.py rename to src/neptune/internal/utils/source_code.py index 9207a6863..2857f9103 100644 --- a/src/neptune/new/internal/utils/source_code.py +++ b/src/neptune/internal/utils/source_code.py @@ -24,12 +24,12 @@ from neptune.common.storage.storage_utils import normalize_file_name from neptune.common.utils import is_ipython -from neptune.new.attributes import constants as attr_consts -from neptune.new.internal.utils import ( +from neptune.internal.utils import ( does_paths_share_common_drive, get_absolute_paths, get_common_root, ) +from neptune.new.attributes import constants as attr_consts from neptune.vendor.lib_programname import ( empty_path, get_path_executed_script, diff --git a/src/neptune/new/internal/utils/stringify_value.py b/src/neptune/internal/utils/stringify_value.py similarity index 100% rename from src/neptune/new/internal/utils/stringify_value.py rename to src/neptune/internal/utils/stringify_value.py diff --git a/src/neptune/new/internal/utils/sync_offset_file.py b/src/neptune/internal/utils/sync_offset_file.py similarity index 100% rename from src/neptune/new/internal/utils/sync_offset_file.py rename to src/neptune/internal/utils/sync_offset_file.py diff --git a/src/neptune/new/internal/utils/traceback_job.py b/src/neptune/internal/utils/traceback_job.py similarity index 91% rename from src/neptune/new/internal/utils/traceback_job.py rename to src/neptune/internal/utils/traceback_job.py index d26776e28..ac305d5cd 100644 --- a/src/neptune/new/internal/utils/traceback_job.py +++ b/src/neptune/internal/utils/traceback_job.py @@ -23,9 +23,9 @@ Optional, ) +from neptune.internal.background_job import BackgroundJob +from neptune.internal.utils.uncaught_exception_handler import instance as traceback_handler from neptune.new.attributes.constants import SYSTEM_FAILED_ATTRIBUTE_PATH -from neptune.new.internal.background_job import BackgroundJob -from neptune.new.internal.utils.uncaught_exception_handler import instance as traceback_handler if TYPE_CHECKING: from neptune.new.metadata_containers import MetadataContainer diff --git a/src/neptune/new/internal/utils/uncaught_exception_handler.py b/src/neptune/internal/utils/uncaught_exception_handler.py similarity index 100% rename from src/neptune/new/internal/utils/uncaught_exception_handler.py rename to src/neptune/internal/utils/uncaught_exception_handler.py diff --git a/src/neptune/new/internal/value_to_attribute_visitor.py b/src/neptune/internal/value_to_attribute_visitor.py similarity index 100% rename from src/neptune/new/internal/value_to_attribute_visitor.py rename to src/neptune/internal/value_to_attribute_visitor.py diff --git a/src/neptune/new/internal/websockets/__init__.py b/src/neptune/internal/websockets/__init__.py similarity index 100% rename from src/neptune/new/internal/websockets/__init__.py rename to src/neptune/internal/websockets/__init__.py diff --git a/src/neptune/new/internal/websockets/websocket_signals_background_job.py b/src/neptune/internal/websockets/websocket_signals_background_job.py similarity index 94% rename from src/neptune/new/internal/websockets/websocket_signals_background_job.py rename to src/neptune/internal/websockets/websocket_signals_background_job.py index 72c97e504..465953f1b 100644 --- a/src/neptune/new/internal/websockets/websocket_signals_background_job.py +++ b/src/neptune/internal/websockets/websocket_signals_background_job.py @@ -27,16 +27,16 @@ from websocket import WebSocketConnectionClosedException from neptune.common.websockets.reconnecting_websocket import ReconnectingWebsocket +from neptune.internal.background_job import BackgroundJob +from neptune.internal.threading.daemon import Daemon +from neptune.internal.utils import process_killer +from neptune.internal.utils.logger import logger +from neptune.internal.websockets.websockets_factory import WebsocketsFactory from neptune.new.attributes.constants import ( SIGNAL_TYPE_ABORT, SIGNAL_TYPE_STOP, SYSTEM_FAILED_ATTRIBUTE_PATH, ) -from neptune.new.internal.background_job import BackgroundJob -from neptune.new.internal.threading.daemon import Daemon -from neptune.new.internal.utils import process_killer -from neptune.new.internal.utils.logger import logger -from neptune.new.internal.websockets.websockets_factory import WebsocketsFactory if TYPE_CHECKING: from neptune.new.metadata_containers import MetadataContainer diff --git a/src/neptune/new/internal/websockets/websockets_factory.py b/src/neptune/internal/websockets/websockets_factory.py similarity index 100% rename from src/neptune/new/internal/websockets/websockets_factory.py rename to src/neptune/internal/websockets/websockets_factory.py diff --git a/src/neptune/legacy/internal/api_clients/hosted_api_clients/hosted_alpha_leaderboard_api_client.py b/src/neptune/legacy/internal/api_clients/hosted_api_clients/hosted_alpha_leaderboard_api_client.py index 61f266558..469a7e8d0 100644 --- a/src/neptune/legacy/internal/api_clients/hosted_api_clients/hosted_alpha_leaderboard_api_client.py +++ b/src/neptune/legacy/internal/api_clients/hosted_api_clients/hosted_alpha_leaderboard_api_client.py @@ -44,6 +44,27 @@ NoopObject, assure_directory_exists, ) +from neptune.internal import operation as alpha_operation +from neptune.internal.backends import hosted_file_operations as alpha_hosted_file_operations +from neptune.internal.backends.api_model import AttributeType +from neptune.internal.backends.operation_api_name_visitor import OperationApiNameVisitor as AlphaOperationApiNameVisitor +from neptune.internal.backends.operation_api_object_converter import ( + OperationApiObjectConverter as AlphaOperationApiObjectConverter, +) +from neptune.internal.backends.utils import handle_server_raw_response_messages +from neptune.internal.operation import ( + AssignBool, + AssignString, + ConfigFloatSeries, + LogFloats, + LogStrings, +) +from neptune.internal.utils import ( + base64_decode, + base64_encode, +) +from neptune.internal.utils import paths as alpha_path_utils +from neptune.internal.utils.paths import parse_path from neptune.legacy.api_exceptions import ( ExperimentNotFound, ExperimentOperationErrors, @@ -90,29 +111,6 @@ MONITORING_TRACEBACK_ATTRIBUTE_PATH, SYSTEM_FAILED_ATTRIBUTE_PATH, ) -from neptune.new.internal import operation as alpha_operation -from neptune.new.internal.backends import hosted_file_operations as alpha_hosted_file_operations -from neptune.new.internal.backends.api_model import AttributeType -from neptune.new.internal.backends.operation_api_name_visitor import ( - OperationApiNameVisitor as AlphaOperationApiNameVisitor, -) -from neptune.new.internal.backends.operation_api_object_converter import ( - OperationApiObjectConverter as AlphaOperationApiObjectConverter, -) -from neptune.new.internal.backends.utils import handle_server_raw_response_messages -from neptune.new.internal.operation import ( - AssignBool, - AssignString, - ConfigFloatSeries, - LogFloats, - LogStrings, -) -from neptune.new.internal.utils import ( - base64_decode, - base64_encode, -) -from neptune.new.internal.utils import paths as alpha_path_utils -from neptune.new.internal.utils.paths import parse_path _logger = logging.getLogger(__name__) diff --git a/src/neptune/legacy/internal/api_clients/hosted_api_clients/hosted_backend_api_client.py b/src/neptune/legacy/internal/api_clients/hosted_api_clients/hosted_backend_api_client.py index cbb5ed591..d9578ee2d 100644 --- a/src/neptune/legacy/internal/api_clients/hosted_api_clients/hosted_backend_api_client.py +++ b/src/neptune/legacy/internal/api_clients/hosted_api_clients/hosted_backend_api_client.py @@ -30,6 +30,7 @@ NoopObject, update_session_proxies, ) +from neptune.internal.backends.hosted_client import NeptuneResponseAdapter from neptune.legacy.api_exceptions import ( ProjectNotFound, WorkspaceNotFound, @@ -46,7 +47,6 @@ from neptune.legacy.internal.api_clients.hosted_api_clients.mixins import HostedNeptuneMixin from neptune.legacy.internal.api_clients.hosted_api_clients.utils import legacy_with_api_exceptions_handler from neptune.legacy.projects import Project -from neptune.new.internal.backends.hosted_client import NeptuneResponseAdapter _logger = logging.getLogger(__name__) diff --git a/src/neptune/legacy/internal/utils/alpha_integration.py b/src/neptune/legacy/internal/utils/alpha_integration.py index 259a9747d..5c967ab56 100644 --- a/src/neptune/legacy/internal/utils/alpha_integration.py +++ b/src/neptune/legacy/internal/utils/alpha_integration.py @@ -16,17 +16,17 @@ import abc from collections import namedtuple +from neptune.internal import operation as alpha_operation +from neptune.internal.backends.api_model import AttributeType as AlphaAttributeType + +# Alpha equivalent of old api's `KeyValueProperty` used in `Experiment.properties` +from neptune.internal.operation import ImageValue from neptune.legacy.exceptions import NeptuneException from neptune.legacy.internal.channels.channels import ( ChannelType, ChannelValueType, ) from neptune.new.attributes import constants as alpha_consts -from neptune.new.internal import operation as alpha_operation -from neptune.new.internal.backends.api_model import AttributeType as AlphaAttributeType - -# Alpha equivalent of old api's `KeyValueProperty` used in `Experiment.properties` -from neptune.new.internal.operation import ImageValue AlphaKeyValueProperty = namedtuple("AlphaKeyValueProperty", ["key", "value"]) diff --git a/src/neptune/management/internal/api.py b/src/neptune/management/internal/api.py index f1c85d683..b240384dc 100644 --- a/src/neptune/management/internal/api.py +++ b/src/neptune/management/internal/api.py @@ -48,6 +48,26 @@ from neptune.common.backends.utils import with_api_exceptions_handler from neptune.common.envs import API_TOKEN_ENV_NAME +from neptune.internal.backends.hosted_client import ( + DEFAULT_REQUEST_KWARGS, + create_backend_client, + create_http_client_with_auth, + create_leaderboard_client, +) +from neptune.internal.backends.swagger_client_wrapper import SwaggerClientWrapper +from neptune.internal.backends.utils import ( + parse_validation_errors, + ssl_verify, +) +from neptune.internal.credentials import Credentials +from neptune.internal.id_formats import QualifiedName +from neptune.internal.utils import ( + verify_collection_type, + verify_type, +) +from neptune.internal.utils.deprecation import deprecated_parameter +from neptune.internal.utils.iteration import get_batches +from neptune.internal.utils.logger import logger from neptune.management.exceptions import ( AccessRevokedOnDeletion, AccessRevokedOnMemberRemoval, @@ -74,26 +94,6 @@ extract_project_and_workspace, normalize_project_name, ) -from neptune.new.internal.backends.hosted_client import ( - DEFAULT_REQUEST_KWARGS, - create_backend_client, - create_http_client_with_auth, - create_leaderboard_client, -) -from neptune.new.internal.backends.swagger_client_wrapper import SwaggerClientWrapper -from neptune.new.internal.backends.utils import ( - parse_validation_errors, - ssl_verify, -) -from neptune.new.internal.credentials import Credentials -from neptune.new.internal.id_formats import QualifiedName -from neptune.new.internal.utils import ( - verify_collection_type, - verify_type, -) -from neptune.new.internal.utils.deprecation import deprecated_parameter -from neptune.new.internal.utils.iteration import get_batches -from neptune.new.internal.utils.logger import logger TRASH_BATCH_SIZE = 100 diff --git a/src/neptune/management/internal/dto.py b/src/neptune/management/internal/dto.py index 8728c0d07..f01bed086 100644 --- a/src/neptune/management/internal/dto.py +++ b/src/neptune/management/internal/dto.py @@ -16,13 +16,13 @@ from dataclasses import dataclass from enum import Enum +from neptune.internal.utils import verify_type from neptune.management.exceptions import UnsupportedValue from neptune.management.internal.types import ( ProjectMemberRole, ProjectVisibility, WorkspaceMemberRole, ) -from neptune.new.internal.utils import verify_type class ProjectVisibilityDTO(Enum): diff --git a/src/neptune/new/attributes/atoms/artifact.py b/src/neptune/new/attributes/atoms/artifact.py index 693e35516..e5bbbe7fa 100644 --- a/src/neptune/new/attributes/atoms/artifact.py +++ b/src/neptune/new/attributes/atoms/artifact.py @@ -18,17 +18,17 @@ import pathlib import typing -from neptune.new.attributes.atoms.atom import Atom -from neptune.new.internal.artifacts.types import ( +from neptune.internal.artifacts.types import ( ArtifactDriver, ArtifactDriversMap, ArtifactFileData, ) -from neptune.new.internal.backends.api_model import OptionalFeatures -from neptune.new.internal.operation import ( +from neptune.internal.backends.api_model import OptionalFeatures +from neptune.internal.operation import ( AssignArtifact, TrackFilesToArtifact, ) +from neptune.new.attributes.atoms.atom import Atom from neptune.new.types.atoms.artifact import Artifact as ArtifactVal diff --git a/src/neptune/new/attributes/atoms/boolean.py b/src/neptune/new/attributes/atoms/boolean.py index dd63f5552..141c589fe 100644 --- a/src/neptune/new/attributes/atoms/boolean.py +++ b/src/neptune/new/attributes/atoms/boolean.py @@ -17,13 +17,13 @@ import typing +from neptune.internal.container_type import ContainerType +from neptune.internal.operation import AssignBool from neptune.new.attributes.atoms.copiable_atom import CopiableAtom -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.operation import AssignBool from neptune.new.types.atoms.boolean import Boolean as BooleanVal if typing.TYPE_CHECKING: - from neptune.new.internal.backends.neptune_backend import NeptuneBackend + from neptune.internal.backends.neptune_backend import NeptuneBackend class Boolean(CopiableAtom): diff --git a/src/neptune/new/attributes/atoms/copiable_atom.py b/src/neptune/new/attributes/atoms/copiable_atom.py index 8ba5798f7..93d5b5f43 100644 --- a/src/neptune/new/attributes/atoms/copiable_atom.py +++ b/src/neptune/new/attributes/atoms/copiable_atom.py @@ -18,14 +18,14 @@ import abc import typing +from neptune.internal.container_type import ContainerType +from neptune.internal.operation import CopyAttribute +from neptune.internal.utils.paths import parse_path from neptune.new.attributes.atoms.atom import Atom -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.operation import CopyAttribute -from neptune.new.internal.utils.paths import parse_path from neptune.new.types.value_copy import ValueCopy if typing.TYPE_CHECKING: - from neptune.new.internal.backends.neptune_backend import NeptuneBackend + from neptune.internal.backends.neptune_backend import NeptuneBackend class CopiableAtom(Atom): diff --git a/src/neptune/new/attributes/atoms/datetime.py b/src/neptune/new/attributes/atoms/datetime.py index e0f4f5f24..cfc59d4c6 100644 --- a/src/neptune/new/attributes/atoms/datetime.py +++ b/src/neptune/new/attributes/atoms/datetime.py @@ -18,14 +18,14 @@ import typing from datetime import datetime +from neptune.internal.container_type import ContainerType +from neptune.internal.operation import AssignDatetime +from neptune.internal.utils import verify_type from neptune.new.attributes.atoms.copiable_atom import CopiableAtom -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.operation import AssignDatetime -from neptune.new.internal.utils import verify_type from neptune.new.types.atoms.datetime import Datetime as DatetimeVal if typing.TYPE_CHECKING: - from neptune.new.internal.backends.neptune_backend import NeptuneBackend + from neptune.internal.backends.neptune_backend import NeptuneBackend class Datetime(CopiableAtom): diff --git a/src/neptune/new/attributes/atoms/file.py b/src/neptune/new/attributes/atoms/file.py index c6b34ceb7..ed21726c9 100644 --- a/src/neptune/new/attributes/atoms/file.py +++ b/src/neptune/new/attributes/atoms/file.py @@ -17,9 +17,9 @@ from typing import Optional +from neptune.internal.operation import UploadFile +from neptune.internal.utils import verify_type from neptune.new.attributes.atoms.atom import Atom -from neptune.new.internal.operation import UploadFile -from neptune.new.internal.utils import verify_type from neptune.new.types.atoms.file import File as FileVal diff --git a/src/neptune/new/attributes/atoms/float.py b/src/neptune/new/attributes/atoms/float.py index 47235fa34..61e11f9b4 100644 --- a/src/neptune/new/attributes/atoms/float.py +++ b/src/neptune/new/attributes/atoms/float.py @@ -17,13 +17,13 @@ import typing +from neptune.internal.container_type import ContainerType +from neptune.internal.operation import AssignFloat from neptune.new.attributes.atoms.copiable_atom import CopiableAtom -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.operation import AssignFloat from neptune.new.types.atoms.float import Float as FloatVal if typing.TYPE_CHECKING: - from neptune.new.internal.backends.neptune_backend import NeptuneBackend + from neptune.internal.backends.neptune_backend import NeptuneBackend class Float(CopiableAtom): diff --git a/src/neptune/new/attributes/atoms/integer.py b/src/neptune/new/attributes/atoms/integer.py index fa5fbf139..a4bc94823 100644 --- a/src/neptune/new/attributes/atoms/integer.py +++ b/src/neptune/new/attributes/atoms/integer.py @@ -17,13 +17,13 @@ import typing +from neptune.internal.container_type import ContainerType +from neptune.internal.operation import AssignInt from neptune.new.attributes.atoms.copiable_atom import CopiableAtom -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.operation import AssignInt from neptune.new.types.atoms.integer import Integer as IntegerVal if typing.TYPE_CHECKING: - from neptune.new.internal.backends.neptune_backend import NeptuneBackend + from neptune.internal.backends.neptune_backend import NeptuneBackend class Integer(CopiableAtom): diff --git a/src/neptune/new/attributes/atoms/string.py b/src/neptune/new/attributes/atoms/string.py index 520509fca..01f5cfadd 100644 --- a/src/neptune/new/attributes/atoms/string.py +++ b/src/neptune/new/attributes/atoms/string.py @@ -17,15 +17,15 @@ import typing +from neptune.internal.container_type import ContainerType +from neptune.internal.operation import AssignString +from neptune.internal.utils.logger import logger +from neptune.internal.utils.paths import path_to_str from neptune.new.attributes.atoms.copiable_atom import CopiableAtom -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.operation import AssignString -from neptune.new.internal.utils.logger import logger -from neptune.new.internal.utils.paths import path_to_str from neptune.new.types.atoms.string import String as StringVal if typing.TYPE_CHECKING: - from neptune.new.internal.backends.neptune_backend import NeptuneBackend + from neptune.internal.backends.neptune_backend import NeptuneBackend from neptune.new.metadata_containers import MetadataContainer diff --git a/src/neptune/new/attributes/attribute.py b/src/neptune/new/attributes/attribute.py index 267f79b37..f53c958f9 100644 --- a/src/neptune/new/attributes/attribute.py +++ b/src/neptune/new/attributes/attribute.py @@ -21,12 +21,12 @@ ) from neptune.exceptions import TypeDoesNotSupportAttributeException -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.operation import Operation +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.operation import Operation from neptune.new.types.value_copy import ValueCopy if TYPE_CHECKING: - from neptune.new.internal.container_type import ContainerType + from neptune.internal.container_type import ContainerType from neptune.new.metadata_containers import MetadataContainer diff --git a/src/neptune/new/attributes/file_set.py b/src/neptune/new/attributes/file_set.py index 3ea9fd642..7a6971787 100644 --- a/src/neptune/new/attributes/file_set.py +++ b/src/neptune/new/attributes/file_set.py @@ -22,15 +22,15 @@ Union, ) -from neptune.new.attributes.attribute import Attribute -from neptune.new.internal.operation import ( +from neptune.internal.operation import ( DeleteFiles, UploadFileSet, ) -from neptune.new.internal.utils import ( +from neptune.internal.utils import ( verify_collection_type, verify_type, ) +from neptune.new.attributes.attribute import Attribute from neptune.new.types.file_set import FileSet as FileSetVal diff --git a/src/neptune/new/attributes/namespace.py b/src/neptune/new/attributes/namespace.py index f2aec02e4..5706e0f33 100644 --- a/src/neptune/new/attributes/namespace.py +++ b/src/neptune/new/attributes/namespace.py @@ -30,16 +30,16 @@ Union, ) -from neptune.new.attributes.attribute import Attribute -from neptune.new.internal.container_structure import ContainerStructure -from neptune.new.internal.utils.generic_attribute_mapper import ( +from neptune.internal.container_structure import ContainerStructure +from neptune.internal.utils.generic_attribute_mapper import ( NoValue, atomic_attribute_types_map, ) -from neptune.new.internal.utils.paths import ( +from neptune.internal.utils.paths import ( parse_path, path_to_str, ) +from neptune.new.attributes.attribute import Attribute from neptune.new.types.namespace import Namespace as NamespaceVal if TYPE_CHECKING: diff --git a/src/neptune/new/attributes/series/fetchable_series.py b/src/neptune/new/attributes/series/fetchable_series.py index 4fb947372..1436fa9dd 100644 --- a/src/neptune/new/attributes/series/fetchable_series.py +++ b/src/neptune/new/attributes/series/fetchable_series.py @@ -24,7 +24,7 @@ Union, ) -from neptune.new.internal.backends.api_model import ( +from neptune.internal.backends.api_model import ( FloatSeriesValues, StringSeriesValues, ) diff --git a/src/neptune/new/attributes/series/file_series.py b/src/neptune/new/attributes/series/file_series.py index 077230222..2737de98c 100644 --- a/src/neptune/new/attributes/series/file_series.py +++ b/src/neptune/new/attributes/series/file_series.py @@ -28,16 +28,16 @@ FileNotFound, OperationNotSupported, ) -from neptune.new.attributes.series.series import Series -from neptune.new.internal.operation import ( +from neptune.internal.operation import ( ClearImageLog, ImageValue, LogImages, Operation, ) -from neptune.new.internal.types.file_types import FileType -from neptune.new.internal.utils import base64_encode -from neptune.new.internal.utils.limits import image_size_exceeds_limit_for_logging +from neptune.internal.types.file_types import FileType +from neptune.internal.utils import base64_encode +from neptune.internal.utils.limits import image_size_exceeds_limit_for_logging +from neptune.new.attributes.series.series import Series from neptune.new.types import File from neptune.new.types.series.file_series import FileSeries as FileSeriesVal diff --git a/src/neptune/new/attributes/series/float_series.py b/src/neptune/new/attributes/series/float_series.py index 5ff3fd806..23aad37e0 100644 --- a/src/neptune/new/attributes/series/float_series.py +++ b/src/neptune/new/attributes/series/float_series.py @@ -21,17 +21,17 @@ Union, ) -from neptune.new.attributes.series.fetchable_series import FetchableSeries -from neptune.new.attributes.series.series import Series -from neptune.new.internal.backends.api_model import FloatSeriesValues -from neptune.new.internal.operation import ( +from neptune.internal.backends.api_model import FloatSeriesValues +from neptune.internal.operation import ( ClearFloatLog, ConfigFloatSeries, LogFloats, Operation, ) -from neptune.new.internal.utils import verify_type -from neptune.new.internal.utils.logger import logger +from neptune.internal.utils import verify_type +from neptune.internal.utils.logger import logger +from neptune.new.attributes.series.fetchable_series import FetchableSeries +from neptune.new.attributes.series.series import Series from neptune.new.types.series.float_series import FloatSeries as FloatSeriesVal Val = FloatSeriesVal diff --git a/src/neptune/new/attributes/series/series.py b/src/neptune/new/attributes/series/series.py index 020ce05ef..e04277dec 100644 --- a/src/neptune/new/attributes/series/series.py +++ b/src/neptune/new/attributes/series/series.py @@ -28,14 +28,14 @@ Union, ) -from neptune.new.attributes.attribute import Attribute -from neptune.new.internal.operation import LogOperation -from neptune.new.internal.utils import ( +from neptune.internal.operation import LogOperation +from neptune.internal.utils import ( is_collection, verify_collection_type, verify_type, ) -from neptune.new.internal.utils.iteration import get_batches +from neptune.internal.utils.iteration import get_batches +from neptune.new.attributes.attribute import Attribute from neptune.new.types.series.series import Series as SeriesVal ValTV = TypeVar("ValTV", bound=SeriesVal) diff --git a/src/neptune/new/attributes/series/string_series.py b/src/neptune/new/attributes/series/string_series.py index 4eb8dcc52..36dc95420 100644 --- a/src/neptune/new/attributes/series/string_series.py +++ b/src/neptune/new/attributes/series/string_series.py @@ -23,16 +23,16 @@ Union, ) -from neptune.new.attributes.series.fetchable_series import FetchableSeries -from neptune.new.attributes.series.series import Series -from neptune.new.internal.backends.api_model import StringSeriesValues -from neptune.new.internal.operation import ( +from neptune.internal.backends.api_model import StringSeriesValues +from neptune.internal.operation import ( ClearStringLog, LogStrings, Operation, ) -from neptune.new.internal.utils.logger import logger -from neptune.new.internal.utils.paths import path_to_str +from neptune.internal.utils.logger import logger +from neptune.internal.utils.paths import path_to_str +from neptune.new.attributes.series.fetchable_series import FetchableSeries +from neptune.new.attributes.series.series import Series from neptune.new.types.series.string_series import MAX_STRING_SERIES_VALUE_LENGTH from neptune.new.types.series.string_series import StringSeries as StringSeriesVal diff --git a/src/neptune/new/attributes/sets/string_set.py b/src/neptune/new/attributes/sets/string_set.py index 2e216c886..074e50147 100644 --- a/src/neptune/new/attributes/sets/string_set.py +++ b/src/neptune/new/attributes/sets/string_set.py @@ -21,17 +21,17 @@ Union, ) -from neptune.new.attributes.sets.set import Set -from neptune.new.internal.operation import ( +from neptune.internal.operation import ( AddStrings, ClearStringSet, RemoveStrings, ) -from neptune.new.internal.utils import ( +from neptune.internal.utils import ( is_collection, verify_collection_type, verify_type, ) +from neptune.new.attributes.sets.set import Set from neptune.new.types.sets.string_set import StringSet as StringSetVal diff --git a/src/neptune/new/attributes/utils.py b/src/neptune/new/attributes/utils.py index 92a2a6279..8ccd171c2 100644 --- a/src/neptune/new/attributes/utils.py +++ b/src/neptune/new/attributes/utils.py @@ -21,6 +21,7 @@ ) from neptune.common.exceptions import InternalClientError +from neptune.internal.backends.api_model import AttributeType from neptune.new.attributes import ( Artifact, Boolean, @@ -38,7 +39,6 @@ StringSeries, StringSet, ) -from neptune.new.internal.backends.api_model import AttributeType if TYPE_CHECKING: from neptune.new.attributes.attribute import Attribute diff --git a/src/neptune/new/cli/abstract_backend_runner.py b/src/neptune/new/cli/abstract_backend_runner.py index ada3bcd2d..1c5c8f034 100644 --- a/src/neptune/new/cli/abstract_backend_runner.py +++ b/src/neptune/new/cli/abstract_backend_runner.py @@ -18,7 +18,7 @@ import abc -from neptune.new.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.backends.neptune_backend import NeptuneBackend class AbstractBackendRunner(abc.ABC): diff --git a/src/neptune/new/cli/clear.py b/src/neptune/new/cli/clear.py index f74e41706..c3eb4cb6e 100644 --- a/src/neptune/new/cli/clear.py +++ b/src/neptune/new/cli/clear.py @@ -23,13 +23,13 @@ import click from neptune.constants import SYNC_DIRECTORY +from neptune.internal.backends.api_model import ApiExperiment +from neptune.internal.id_formats import UniqueId +from neptune.internal.utils.logger import logger from neptune.new.cli.abstract_backend_runner import AbstractBackendRunner from neptune.new.cli.container_manager import ContainersManager from neptune.new.cli.status import StatusRunner from neptune.new.cli.utils import get_offline_dirs -from neptune.new.internal.backends.api_model import ApiExperiment -from neptune.new.internal.id_formats import UniqueId -from neptune.new.internal.utils.logger import logger class ClearRunner(AbstractBackendRunner): diff --git a/src/neptune/new/cli/commands.py b/src/neptune/new/cli/commands.py index a9e3c65ce..fa9618c15 100644 --- a/src/neptune/new/cli/commands.py +++ b/src/neptune/new/cli/commands.py @@ -30,20 +30,20 @@ ProjectNotFound, RunNotFound, ) +from neptune.internal.backends.api_model import ( # noqa: F401 + ApiExperiment, + Project, +) +from neptune.internal.backends.hosted_neptune_backend import HostedNeptuneBackend +from neptune.internal.backends.neptune_backend import NeptuneBackend # noqa: F401 +from neptune.internal.credentials import Credentials +from neptune.internal.disk_queue import DiskQueue # noqa: F401 +from neptune.internal.operation import Operation # noqa: F401 +from neptune.internal.utils.logger import logger from neptune.new.cli.clear import ClearRunner from neptune.new.cli.path_option import path_option from neptune.new.cli.status import StatusRunner from neptune.new.cli.sync import SyncRunner -from neptune.new.internal.backends.api_model import ( # noqa: F401 - ApiExperiment, - Project, -) -from neptune.new.internal.backends.hosted_neptune_backend import HostedNeptuneBackend -from neptune.new.internal.backends.neptune_backend import NeptuneBackend # noqa: F401 -from neptune.new.internal.credentials import Credentials -from neptune.new.internal.disk_queue import DiskQueue # noqa: F401 -from neptune.new.internal.operation import Operation # noqa: F401 -from neptune.new.internal.utils.logger import logger @click.command() diff --git a/src/neptune/new/cli/container_manager.py b/src/neptune/new/cli/container_manager.py index 651b34c61..8999c197e 100644 --- a/src/neptune/new/cli/container_manager.py +++ b/src/neptune/new/cli/container_manager.py @@ -28,14 +28,14 @@ OFFLINE_DIRECTORY, SYNC_DIRECTORY, ) +from neptune.internal.backends.api_model import ApiExperiment +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.id_formats import UniqueId from neptune.new.cli.utils import ( get_metadata_container, is_container_synced_and_remove_junk, iterate_containers, ) -from neptune.new.internal.backends.api_model import ApiExperiment -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.id_formats import UniqueId class ContainersManager(abc.ABC): diff --git a/src/neptune/new/cli/path_option.py b/src/neptune/new/cli/path_option.py index 7599005e3..b182716d5 100644 --- a/src/neptune/new/cli/path_option.py +++ b/src/neptune/new/cli/path_option.py @@ -27,13 +27,13 @@ ProjectNotFound, RunNotFound, ) -from neptune.new.internal.backends.api_model import ( # noqa: F401 +from neptune.internal.backends.api_model import ( # noqa: F401 ApiExperiment, Project, ) -from neptune.new.internal.backends.neptune_backend import NeptuneBackend # noqa: F401 -from neptune.new.internal.disk_queue import DiskQueue # noqa: F401 -from neptune.new.internal.operation import Operation # noqa: F401 +from neptune.internal.backends.neptune_backend import NeptuneBackend # noqa: F401 +from neptune.internal.disk_queue import DiskQueue # noqa: F401 +from neptune.internal.operation import Operation # noqa: F401 def get_neptune_path(ctx, param, path: str) -> Path: diff --git a/src/neptune/new/cli/status.py b/src/neptune/new/cli/status.py index fd055edfc..902a9aa86 100644 --- a/src/neptune/new/cli/status.py +++ b/src/neptune/new/cli/status.py @@ -26,14 +26,14 @@ from neptune.constants import OFFLINE_NAME_PREFIX from neptune.envs import PROJECT_ENV_NAME +from neptune.internal.backends.api_model import ApiExperiment +from neptune.internal.utils.logger import logger from neptune.new.cli.abstract_backend_runner import AbstractBackendRunner from neptune.new.cli.container_manager import ContainersManager from neptune.new.cli.utils import ( get_offline_dirs, get_qualified_name, ) -from neptune.new.internal.backends.api_model import ApiExperiment -from neptune.new.internal.utils.logger import logger offline_run_explainer = """ Runs which execute offline are not created on the server and they are not assigned to projects; diff --git a/src/neptune/new/cli/sync.py b/src/neptune/new/cli/sync.py index 0ff44146e..2d1a2188d 100644 --- a/src/neptune/new/cli/sync.py +++ b/src/neptune/new/cli/sync.py @@ -36,6 +36,18 @@ ) from neptune.envs import NEPTUNE_SYNC_BATCH_TIMEOUT_ENV from neptune.exceptions import CannotSynchronizeOfflineRunsWithoutProject +from neptune.internal.backends.api_model import ( + ApiExperiment, + Project, +) +from neptune.internal.container_type import ContainerType +from neptune.internal.disk_queue import DiskQueue +from neptune.internal.id_formats import ( + QualifiedName, + UniqueId, +) +from neptune.internal.operation import Operation +from neptune.internal.utils.logger import logger from neptune.new.cli.abstract_backend_runner import AbstractBackendRunner from neptune.new.cli.utils import ( get_metadata_container, @@ -46,18 +58,6 @@ iterate_containers, split_dir_name, ) -from neptune.new.internal.backends.api_model import ( - ApiExperiment, - Project, -) -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.disk_queue import DiskQueue -from neptune.new.internal.id_formats import ( - QualifiedName, - UniqueId, -) -from neptune.new.internal.operation import Operation -from neptune.new.internal.utils.logger import logger retries_timeout = int(os.getenv(NEPTUNE_SYNC_BATCH_TIMEOUT_ENV, "3600")) diff --git a/src/neptune/new/cli/utils.py b/src/neptune/new/cli/utils.py index 59edfcfd8..a872f4295 100644 --- a/src/neptune/new/cli/utils.py +++ b/src/neptune/new/cli/utils.py @@ -44,19 +44,19 @@ MetadataContainerNotFound, ProjectNotFound, ) -from neptune.new.internal.backends.api_model import ( +from neptune.internal.backends.api_model import ( ApiExperiment, Project, ) -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.disk_queue import DiskQueue -from neptune.new.internal.id_formats import ( +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.container_type import ContainerType +from neptune.internal.disk_queue import DiskQueue +from neptune.internal.id_formats import ( QualifiedName, UniqueId, ) -from neptune.new.internal.operation import Operation -from neptune.new.internal.utils.logger import logger +from neptune.internal.operation import Operation +from neptune.internal.utils.logger import logger def get_metadata_container( diff --git a/src/neptune/new/integrations/python_logger.py b/src/neptune/new/integrations/python_logger.py index 7cf532a53..ac7ad3c9a 100644 --- a/src/neptune/new/integrations/python_logger.py +++ b/src/neptune/new/integrations/python_logger.py @@ -19,7 +19,7 @@ import threading from neptune import Run -from neptune.new.internal.utils import verify_type +from neptune.internal.utils import verify_type from neptune.new.logging import Logger from neptune.new.run import RunState from neptune.version import version as neptune_client_version diff --git a/src/neptune/new/integrations/utils.py b/src/neptune/new/integrations/utils.py index 0745def73..ab734cc41 100644 --- a/src/neptune/new/integrations/utils.py +++ b/src/neptune/new/integrations/utils.py @@ -21,8 +21,8 @@ from neptune.common.experiments import LegacyExperiment as Experiment from neptune.exceptions import NeptuneLegacyIncompatibilityException from neptune.handler import Handler -from neptune.new.internal.utils import verify_type -from neptune.new.internal.utils.paths import join_paths +from neptune.internal.utils import verify_type +from neptune.internal.utils.paths import join_paths def expect_not_an_experiment(run: Run): diff --git a/src/neptune/new/metadata_containers/metadata_container.py b/src/neptune/new/metadata_containers/metadata_container.py index 0b5ac60cc..e6cb0e5ed 100644 --- a/src/neptune/new/metadata_containers/metadata_container.py +++ b/src/neptune/new/metadata_containers/metadata_container.py @@ -42,32 +42,32 @@ NeptunePossibleLegacyUsageException, ) from neptune.handler import Handler -from neptune.new.attributes import create_attribute_from_type -from neptune.new.attributes.attribute import Attribute -from neptune.new.attributes.namespace import Namespace as NamespaceAttr -from neptune.new.attributes.namespace import NamespaceBuilder -from neptune.new.internal.backends.api_model import AttributeType -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.backends.nql import NQLQuery -from neptune.new.internal.background_job import BackgroundJob -from neptune.new.internal.container_structure import ContainerStructure -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.id_formats import ( +from neptune.internal.backends.api_model import AttributeType +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.backends.nql import NQLQuery +from neptune.internal.background_job import BackgroundJob +from neptune.internal.container_structure import ContainerStructure +from neptune.internal.container_type import ContainerType +from neptune.internal.id_formats import ( SysId, UniqueId, ) -from neptune.new.internal.operation import DeleteAttribute -from neptune.new.internal.operation_processors.operation_processor import OperationProcessor -from neptune.new.internal.state import ContainerState -from neptune.new.internal.utils import verify_type -from neptune.new.internal.utils.logger import logger -from neptune.new.internal.utils.paths import parse_path -from neptune.new.internal.utils.runningmode import ( +from neptune.internal.operation import DeleteAttribute +from neptune.internal.operation_processors.operation_processor import OperationProcessor +from neptune.internal.state import ContainerState +from neptune.internal.utils import verify_type +from neptune.internal.utils.logger import logger +from neptune.internal.utils.paths import parse_path +from neptune.internal.utils.runningmode import ( in_interactive, in_notebook, ) -from neptune.new.internal.utils.uncaught_exception_handler import instance as uncaught_exception_handler -from neptune.new.internal.value_to_attribute_visitor import ValueToAttributeVisitor +from neptune.internal.utils.uncaught_exception_handler import instance as uncaught_exception_handler +from neptune.internal.value_to_attribute_visitor import ValueToAttributeVisitor +from neptune.new.attributes import create_attribute_from_type +from neptune.new.attributes.attribute import Attribute +from neptune.new.attributes.namespace import Namespace as NamespaceAttr +from neptune.new.attributes.namespace import NamespaceBuilder from neptune.new.metadata_containers.metadata_containers_table import Table from neptune.new.types.mode import Mode from neptune.new.types.type_casting import cast_value diff --git a/src/neptune/new/metadata_containers/metadata_containers_table.py b/src/neptune/new/metadata_containers/metadata_containers_table.py index 5f491b7bf..7fc292f3c 100644 --- a/src/neptune/new/metadata_containers/metadata_containers_table.py +++ b/src/neptune/new/metadata_containers/metadata_containers_table.py @@ -26,14 +26,14 @@ ) from neptune.exceptions import MetadataInconsistency -from neptune.new.internal.backends.api_model import ( +from neptune.internal.backends.api_model import ( AttributeType, AttributeWithProperties, LeaderboardEntry, ) -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.utils.paths import ( +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.container_type import ContainerType +from neptune.internal.utils.paths import ( join_paths, parse_path, ) diff --git a/src/neptune/new/metadata_containers/model.py b/src/neptune/new/metadata_containers/model.py index f8f2f34b7..1dce3692a 100644 --- a/src/neptune/new/metadata_containers/model.py +++ b/src/neptune/new/metadata_containers/model.py @@ -20,14 +20,14 @@ Optional, ) -from neptune.new.internal.backends.nql import ( +from neptune.internal.backends.nql import ( NQLAggregator, NQLAttributeOperator, NQLAttributeType, NQLQueryAggregate, NQLQueryAttribute, ) -from neptune.new.internal.container_type import ContainerType +from neptune.internal.container_type import ContainerType from neptune.new.metadata_containers import MetadataContainer from neptune.new.metadata_containers.metadata_containers_table import Table diff --git a/src/neptune/new/metadata_containers/model_version.py b/src/neptune/new/metadata_containers/model_version.py index 9d8f08e68..87653b1b8 100644 --- a/src/neptune/new/metadata_containers/model_version.py +++ b/src/neptune/new/metadata_containers/model_version.py @@ -16,9 +16,9 @@ __all__ = ["ModelVersion"] from neptune.exceptions import NeptuneOfflineModeChangeStageException +from neptune.internal.container_type import ContainerType +from neptune.internal.operation_processors.offline_operation_processor import OfflineOperationProcessor from neptune.new.attributes.constants import SYSTEM_STAGE_ATTRIBUTE_PATH -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.operation_processors.offline_operation_processor import OfflineOperationProcessor from neptune.new.metadata_containers import MetadataContainer from neptune.new.types.model_version_stage import ModelVersionStage diff --git a/src/neptune/new/metadata_containers/project.py b/src/neptune/new/metadata_containers/project.py index 8ce95fd16..818ef579e 100644 --- a/src/neptune/new/metadata_containers/project.py +++ b/src/neptune/new/metadata_containers/project.py @@ -24,22 +24,22 @@ Union, ) -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.backends.nql import ( +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.backends.nql import ( NQLAggregator, NQLAttributeOperator, NQLAttributeType, NQLQueryAggregate, NQLQueryAttribute, ) -from neptune.new.internal.background_job import BackgroundJob -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.id_formats import ( +from neptune.internal.background_job import BackgroundJob +from neptune.internal.container_type import ContainerType +from neptune.internal.id_formats import ( SysId, UniqueId, ) -from neptune.new.internal.operation_processors.operation_processor import OperationProcessor -from neptune.new.internal.utils import as_list +from neptune.internal.operation_processors.operation_processor import OperationProcessor +from neptune.internal.utils import as_list from neptune.new.metadata_containers import MetadataContainer from neptune.new.metadata_containers.metadata_containers_table import Table from neptune.new.types.mode import Mode diff --git a/src/neptune/new/metadata_containers/run.py b/src/neptune/new/metadata_containers/run.py index 568bbd5ad..5a5ff1288 100644 --- a/src/neptune/new/metadata_containers/run.py +++ b/src/neptune/new/metadata_containers/run.py @@ -23,15 +23,15 @@ Union, ) -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.background_job import BackgroundJob -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.id_formats import ( +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.background_job import BackgroundJob +from neptune.internal.container_type import ContainerType +from neptune.internal.id_formats import ( SysId, UniqueId, ) -from neptune.new.internal.operation_processors.operation_processor import OperationProcessor -from neptune.new.internal.utils.deprecation import deprecated +from neptune.internal.operation_processors.operation_processor import OperationProcessor +from neptune.internal.utils.deprecation import deprecated from neptune.new.metadata_containers import MetadataContainer from neptune.new.types.mode import Mode diff --git a/src/neptune/new/run.py b/src/neptune/new/run.py index 7c1a71be3..81f732d54 100644 --- a/src/neptune/new/run.py +++ b/src/neptune/new/run.py @@ -32,6 +32,8 @@ "Value", ] +from neptune.internal.state import ContainerState as RunState + # backwards compatibility from neptune.new.attributes.attribute import Attribute from neptune.new.attributes.namespace import Namespace as NamespaceAttr @@ -42,7 +44,6 @@ NeptunePossibleLegacyUsageException, ) from neptune.new.handler import Handler -from neptune.new.internal.state import ContainerState as RunState from neptune.new.metadata_containers import Run from neptune.new.types import ( Boolean, diff --git a/src/neptune/new/runs_table.py b/src/neptune/new/runs_table.py index 37ee4ecc3..b5ef24eb5 100644 --- a/src/neptune/new/runs_table.py +++ b/src/neptune/new/runs_table.py @@ -25,14 +25,15 @@ "RunsTableEntry", ] -# backwards compatibility -from neptune.new.exceptions import MetadataInconsistency -from neptune.new.internal.backends.api_model import ( +from neptune.internal.backends.api_model import ( AttributeType, AttributeWithProperties, ) -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.container_type import ContainerType +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.container_type import ContainerType + +# backwards compatibility +from neptune.new.exceptions import MetadataInconsistency from neptune.new.metadata_containers.metadata_containers_table import ( LeaderboardEntry, LeaderboardHandler, diff --git a/src/neptune/new/types/atoms/artifact.py b/src/neptune/new/types/atoms/artifact.py index b58c29e2b..e52ea0f12 100644 --- a/src/neptune/new/types/atoms/artifact.py +++ b/src/neptune/new/types/atoms/artifact.py @@ -22,7 +22,7 @@ TypeVar, ) -from neptune.new.internal.artifacts.file_hasher import FileHasher +from neptune.internal.artifacts.file_hasher import FileHasher from neptune.new.types.atoms.atom import Atom if TYPE_CHECKING: diff --git a/src/neptune/new/types/atoms/boolean.py b/src/neptune/new/types/atoms/boolean.py index 54d1a6a5b..71c1a1419 100644 --- a/src/neptune/new/types/atoms/boolean.py +++ b/src/neptune/new/types/atoms/boolean.py @@ -21,7 +21,7 @@ TypeVar, ) -from neptune.new.internal.utils.stringify_value import extract_if_stringify_value +from neptune.internal.utils.stringify_value import extract_if_stringify_value from neptune.new.types.atoms.atom import Atom if TYPE_CHECKING: diff --git a/src/neptune/new/types/atoms/datetime.py b/src/neptune/new/types/atoms/datetime.py index 4dbf6d982..e60e755ed 100644 --- a/src/neptune/new/types/atoms/datetime.py +++ b/src/neptune/new/types/atoms/datetime.py @@ -22,7 +22,7 @@ TypeVar, ) -from neptune.new.internal.utils.stringify_value import extract_if_stringify_value +from neptune.internal.utils.stringify_value import extract_if_stringify_value from neptune.new.types.atoms.atom import Atom if TYPE_CHECKING: diff --git a/src/neptune/new/types/atoms/file.py b/src/neptune/new/types/atoms/file.py index ef6161645..228244e06 100644 --- a/src/neptune/new/types/atoms/file.py +++ b/src/neptune/new/types/atoms/file.py @@ -25,14 +25,14 @@ Union, ) -from neptune.new.internal.types.file_types import ( +from neptune.internal.types.file_types import ( FileComposite, InMemoryComposite, LocalFileComposite, StreamComposite, ) -from neptune.new.internal.utils import verify_type -from neptune.new.internal.utils.images import ( +from neptune.internal.utils import verify_type +from neptune.internal.utils.images import ( get_html_content, get_image_content, get_pickle_content, diff --git a/src/neptune/new/types/atoms/float.py b/src/neptune/new/types/atoms/float.py index 00571fcd7..808105d50 100644 --- a/src/neptune/new/types/atoms/float.py +++ b/src/neptune/new/types/atoms/float.py @@ -21,7 +21,7 @@ TypeVar, ) -from neptune.new.internal.utils.stringify_value import extract_if_stringify_value +from neptune.internal.utils.stringify_value import extract_if_stringify_value from neptune.new.types.atoms.atom import Atom if TYPE_CHECKING: diff --git a/src/neptune/new/types/atoms/integer.py b/src/neptune/new/types/atoms/integer.py index 1cc0af77a..64992ba51 100644 --- a/src/neptune/new/types/atoms/integer.py +++ b/src/neptune/new/types/atoms/integer.py @@ -21,7 +21,7 @@ TypeVar, ) -from neptune.new.internal.utils.stringify_value import extract_if_stringify_value +from neptune.internal.utils.stringify_value import extract_if_stringify_value from neptune.new.types.atoms.atom import Atom if TYPE_CHECKING: diff --git a/src/neptune/new/types/atoms/string.py b/src/neptune/new/types/atoms/string.py index 28b21261b..db6fcf269 100644 --- a/src/neptune/new/types/atoms/string.py +++ b/src/neptune/new/types/atoms/string.py @@ -22,7 +22,7 @@ ) from neptune.common.deprecation import warn_once -from neptune.new.internal.utils import ( +from neptune.internal.utils import ( is_string, is_stringify_value, ) diff --git a/src/neptune/new/types/file_set.py b/src/neptune/new/types/file_set.py index 0d613c831..902e48b80 100644 --- a/src/neptune/new/types/file_set.py +++ b/src/neptune/new/types/file_set.py @@ -25,7 +25,7 @@ Union, ) -from neptune.new.internal.utils import ( +from neptune.internal.utils import ( verify_collection_type, verify_type, ) diff --git a/src/neptune/new/types/series/file_series.py b/src/neptune/new/types/series/file_series.py index 65967c3ee..78243cb3e 100644 --- a/src/neptune/new/types/series/file_series.py +++ b/src/neptune/new/types/series/file_series.py @@ -21,9 +21,9 @@ TypeVar, ) -from neptune.new.internal.utils import is_collection -from neptune.new.internal.utils.logger import logger -from neptune.new.internal.utils.stringify_value import extract_if_stringify_value +from neptune.internal.utils import is_collection +from neptune.internal.utils.logger import logger +from neptune.internal.utils.stringify_value import extract_if_stringify_value from neptune.new.types import File from neptune.new.types.series.series import Series diff --git a/src/neptune/new/types/series/float_series.py b/src/neptune/new/types/series/float_series.py index bd0c25a1b..84d62a2d7 100644 --- a/src/neptune/new/types/series/float_series.py +++ b/src/neptune/new/types/series/float_series.py @@ -22,8 +22,8 @@ Union, ) -from neptune.new.internal.utils import is_collection -from neptune.new.internal.utils.stringify_value import extract_if_stringify_value +from neptune.internal.utils import is_collection +from neptune.internal.utils.stringify_value import extract_if_stringify_value from neptune.new.types.series.series import Series if TYPE_CHECKING: diff --git a/src/neptune/new/types/series/string_series.py b/src/neptune/new/types/series/string_series.py index 95e04476e..be55b15cc 100644 --- a/src/neptune/new/types/series/string_series.py +++ b/src/neptune/new/types/series/string_series.py @@ -21,7 +21,7 @@ TypeVar, ) -from neptune.new.internal.utils import ( +from neptune.internal.utils import ( is_collection, is_stringify_value, ) diff --git a/src/neptune/new/types/type_casting.py b/src/neptune/new/types/type_casting.py index 636df43bc..fb9ab305f 100644 --- a/src/neptune/new/types/type_casting.py +++ b/src/neptune/new/types/type_casting.py @@ -24,7 +24,7 @@ ) from neptune.common.deprecation import warn_once -from neptune.new.internal.utils import ( +from neptune.internal.utils import ( is_bool, is_dict_like, is_float, diff --git a/src/neptune/new/types/value_copy.py b/src/neptune/new/types/value_copy.py index 38be80fbc..eacee3aa5 100644 --- a/src/neptune/new/types/value_copy.py +++ b/src/neptune/new/types/value_copy.py @@ -21,7 +21,7 @@ TypeVar, ) -from neptune.new.internal.utils.paths import parse_path +from neptune.internal.utils.paths import parse_path from neptune.new.types.value import Value if TYPE_CHECKING: diff --git a/src/neptune/utils.py b/src/neptune/utils.py index 2d7bb31a1..850a5182f 100644 --- a/src/neptune/utils.py +++ b/src/neptune/utils.py @@ -23,7 +23,7 @@ Union, ) -from neptune.new.internal.utils.stringify_value import StringifyValue +from neptune.internal.utils.stringify_value import StringifyValue def stringify_unsupported(value: Any) -> Union[StringifyValue, Mapping, List, Tuple]: From 84ee06eb7f1b24afa2977e48a3ed3198c3e2aa39 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 15:12:56 +0100 Subject: [PATCH 15/33] cli moved --- src/neptune/{new => }/cli/__init__.py | 2 +- src/neptune/{new => }/cli/__main__.py | 2 +- .../{new => }/cli/abstract_backend_runner.py | 0 src/neptune/{new => }/cli/clear.py | 8 ++++---- src/neptune/{new => }/cli/commands.py | 8 ++++---- .../{new => }/cli/container_manager.py | 10 +++++----- src/neptune/{new => }/cli/path_option.py | 0 src/neptune/{new => }/cli/status.py | 12 +++++------ src/neptune/{new => }/cli/sync.py | 20 +++++++++---------- src/neptune/{new => }/cli/utils.py | 0 src/neptune/new/sync/__init__.py | 8 ++++---- .../new/sync/abstract_backend_runner.py | 2 +- src/neptune/new/sync/status.py | 2 +- src/neptune/new/sync/sync.py | 2 +- src/neptune/new/sync/utils.py | 2 +- 15 files changed, 39 insertions(+), 39 deletions(-) rename src/neptune/{new => }/cli/__init__.py (94%) rename src/neptune/{new => }/cli/__main__.py (96%) rename src/neptune/{new => }/cli/abstract_backend_runner.py (100%) rename src/neptune/{new => }/cli/clear.py (93%) rename src/neptune/{new => }/cli/commands.py (96%) rename src/neptune/{new => }/cli/container_manager.py (98%) rename src/neptune/{new => }/cli/path_option.py (100%) rename src/neptune/{new => }/cli/status.py (95%) rename src/neptune/{new => }/cli/sync.py (98%) rename src/neptune/{new => }/cli/utils.py (100%) diff --git a/src/neptune/new/cli/__init__.py b/src/neptune/cli/__init__.py similarity index 94% rename from src/neptune/new/cli/__init__.py rename to src/neptune/cli/__init__.py index a5e20775e..de4b6376a 100644 --- a/src/neptune/new/cli/__init__.py +++ b/src/neptune/cli/__init__.py @@ -16,7 +16,7 @@ __all__ = ["sync", "status"] -from neptune.new.cli.commands import ( +from neptune.cli.commands import ( status, sync, ) diff --git a/src/neptune/new/cli/__main__.py b/src/neptune/cli/__main__.py similarity index 96% rename from src/neptune/new/cli/__main__.py rename to src/neptune/cli/__main__.py index 20e42c29a..6262ada27 100644 --- a/src/neptune/new/cli/__main__.py +++ b/src/neptune/cli/__main__.py @@ -17,7 +17,7 @@ import click import pkg_resources -from neptune.new.cli.commands import ( +from neptune.cli.commands import ( clear, status, sync, diff --git a/src/neptune/new/cli/abstract_backend_runner.py b/src/neptune/cli/abstract_backend_runner.py similarity index 100% rename from src/neptune/new/cli/abstract_backend_runner.py rename to src/neptune/cli/abstract_backend_runner.py diff --git a/src/neptune/new/cli/clear.py b/src/neptune/cli/clear.py similarity index 93% rename from src/neptune/new/cli/clear.py rename to src/neptune/cli/clear.py index c3eb4cb6e..91998b0aa 100644 --- a/src/neptune/new/cli/clear.py +++ b/src/neptune/cli/clear.py @@ -22,14 +22,14 @@ import click +from neptune.cli.abstract_backend_runner import AbstractBackendRunner +from neptune.cli.container_manager import ContainersManager +from neptune.cli.status import StatusRunner +from neptune.cli.utils import get_offline_dirs from neptune.constants import SYNC_DIRECTORY from neptune.internal.backends.api_model import ApiExperiment from neptune.internal.id_formats import UniqueId from neptune.internal.utils.logger import logger -from neptune.new.cli.abstract_backend_runner import AbstractBackendRunner -from neptune.new.cli.container_manager import ContainersManager -from neptune.new.cli.status import StatusRunner -from neptune.new.cli.utils import get_offline_dirs class ClearRunner(AbstractBackendRunner): diff --git a/src/neptune/new/cli/commands.py b/src/neptune/cli/commands.py similarity index 96% rename from src/neptune/new/cli/commands.py rename to src/neptune/cli/commands.py index fa9618c15..c8e193c08 100644 --- a/src/neptune/new/cli/commands.py +++ b/src/neptune/cli/commands.py @@ -24,6 +24,10 @@ import click +from neptune.cli.clear import ClearRunner +from neptune.cli.path_option import path_option +from neptune.cli.status import StatusRunner +from neptune.cli.sync import SyncRunner from neptune.common.exceptions import NeptuneException # noqa: F401 from neptune.exceptions import ( # noqa: F401 CannotSynchronizeOfflineRunsWithoutProject, @@ -40,10 +44,6 @@ from neptune.internal.disk_queue import DiskQueue # noqa: F401 from neptune.internal.operation import Operation # noqa: F401 from neptune.internal.utils.logger import logger -from neptune.new.cli.clear import ClearRunner -from neptune.new.cli.path_option import path_option -from neptune.new.cli.status import StatusRunner -from neptune.new.cli.sync import SyncRunner @click.command() diff --git a/src/neptune/new/cli/container_manager.py b/src/neptune/cli/container_manager.py similarity index 98% rename from src/neptune/new/cli/container_manager.py rename to src/neptune/cli/container_manager.py index 8999c197e..316a8cefe 100644 --- a/src/neptune/new/cli/container_manager.py +++ b/src/neptune/cli/container_manager.py @@ -23,6 +23,11 @@ Tuple, ) +from neptune.cli.utils import ( + get_metadata_container, + is_container_synced_and_remove_junk, + iterate_containers, +) from neptune.constants import ( ASYNC_DIRECTORY, OFFLINE_DIRECTORY, @@ -31,11 +36,6 @@ from neptune.internal.backends.api_model import ApiExperiment from neptune.internal.backends.neptune_backend import NeptuneBackend from neptune.internal.id_formats import UniqueId -from neptune.new.cli.utils import ( - get_metadata_container, - is_container_synced_and_remove_junk, - iterate_containers, -) class ContainersManager(abc.ABC): diff --git a/src/neptune/new/cli/path_option.py b/src/neptune/cli/path_option.py similarity index 100% rename from src/neptune/new/cli/path_option.py rename to src/neptune/cli/path_option.py diff --git a/src/neptune/new/cli/status.py b/src/neptune/cli/status.py similarity index 95% rename from src/neptune/new/cli/status.py rename to src/neptune/cli/status.py index 902a9aa86..9a4c511a4 100644 --- a/src/neptune/new/cli/status.py +++ b/src/neptune/cli/status.py @@ -24,16 +24,16 @@ Sequence, ) +from neptune.cli.abstract_backend_runner import AbstractBackendRunner +from neptune.cli.container_manager import ContainersManager +from neptune.cli.utils import ( + get_offline_dirs, + get_qualified_name, +) from neptune.constants import OFFLINE_NAME_PREFIX from neptune.envs import PROJECT_ENV_NAME from neptune.internal.backends.api_model import ApiExperiment from neptune.internal.utils.logger import logger -from neptune.new.cli.abstract_backend_runner import AbstractBackendRunner -from neptune.new.cli.container_manager import ContainersManager -from neptune.new.cli.utils import ( - get_offline_dirs, - get_qualified_name, -) offline_run_explainer = """ Runs which execute offline are not created on the server and they are not assigned to projects; diff --git a/src/neptune/new/cli/sync.py b/src/neptune/cli/sync.py similarity index 98% rename from src/neptune/new/cli/sync.py rename to src/neptune/cli/sync.py index 2d1a2188d..977752755 100644 --- a/src/neptune/new/cli/sync.py +++ b/src/neptune/cli/sync.py @@ -28,6 +28,16 @@ Sequence, ) +from neptune.cli.abstract_backend_runner import AbstractBackendRunner +from neptune.cli.utils import ( + get_metadata_container, + get_offline_dirs, + get_project, + get_qualified_name, + is_container_synced_and_remove_junk, + iterate_containers, + split_dir_name, +) from neptune.common.exceptions import NeptuneConnectionLostException from neptune.constants import ( ASYNC_DIRECTORY, @@ -48,16 +58,6 @@ ) from neptune.internal.operation import Operation from neptune.internal.utils.logger import logger -from neptune.new.cli.abstract_backend_runner import AbstractBackendRunner -from neptune.new.cli.utils import ( - get_metadata_container, - get_offline_dirs, - get_project, - get_qualified_name, - is_container_synced_and_remove_junk, - iterate_containers, - split_dir_name, -) retries_timeout = int(os.getenv(NEPTUNE_SYNC_BATCH_TIMEOUT_ENV, "3600")) diff --git a/src/neptune/new/cli/utils.py b/src/neptune/cli/utils.py similarity index 100% rename from src/neptune/new/cli/utils.py rename to src/neptune/cli/utils.py diff --git a/src/neptune/new/sync/__init__.py b/src/neptune/new/sync/__init__.py index ba903217e..70f230005 100644 --- a/src/neptune/new/sync/__init__.py +++ b/src/neptune/new/sync/__init__.py @@ -43,9 +43,7 @@ "split_dir_name", ] -from neptune.common.deprecation import warn_once -from neptune.common.exceptions import NeptuneConnectionLostException -from neptune.new.cli.commands import ( +from neptune.cli.commands import ( ApiExperiment, CannotSynchronizeOfflineRunsWithoutProject, DiskQueue, @@ -60,6 +58,8 @@ status, sync, ) +from neptune.common.deprecation import warn_once +from neptune.common.exceptions import NeptuneConnectionLostException from neptune.new.sync.abstract_backend_runner import AbstractBackendRunner from neptune.new.sync.status import StatusRunner from neptune.new.sync.sync import SyncRunner @@ -76,5 +76,5 @@ warn_once( message="You're using a legacy neptune.new.sync package." " It will be removed since `neptune-client==1.0.0`." - " Please use neptune.new.cli" + " Please use neptune.cli" ) diff --git a/src/neptune/new/sync/abstract_backend_runner.py b/src/neptune/new/sync/abstract_backend_runner.py index 8d6bc764e..25b9e7d9e 100644 --- a/src/neptune/new/sync/abstract_backend_runner.py +++ b/src/neptune/new/sync/abstract_backend_runner.py @@ -17,4 +17,4 @@ __all__ = ["AbstractBackendRunner"] # backwards compatibility -from neptune.new.cli.abstract_backend_runner import AbstractBackendRunner +from neptune.cli.abstract_backend_runner import AbstractBackendRunner diff --git a/src/neptune/new/sync/status.py b/src/neptune/new/sync/status.py index bb5349cbc..1b32007d3 100644 --- a/src/neptune/new/sync/status.py +++ b/src/neptune/new/sync/status.py @@ -17,4 +17,4 @@ __all__ = ["StatusRunner"] # backwards compatibility -from neptune.new.cli.status import StatusRunner +from neptune.cli.status import StatusRunner diff --git a/src/neptune/new/sync/sync.py b/src/neptune/new/sync/sync.py index 7abb0a611..0533ea380 100644 --- a/src/neptune/new/sync/sync.py +++ b/src/neptune/new/sync/sync.py @@ -17,4 +17,4 @@ __all__ = ["SyncRunner"] # backwards compatibility -from neptune.new.cli.sync import SyncRunner +from neptune.cli.sync import SyncRunner diff --git a/src/neptune/new/sync/utils.py b/src/neptune/new/sync/utils.py index b578ae722..d07460495 100644 --- a/src/neptune/new/sync/utils.py +++ b/src/neptune/new/sync/utils.py @@ -25,7 +25,7 @@ ] # backwards compatibility -from neptune.new.cli.utils import ( +from neptune.cli.utils import ( get_metadata_container, get_offline_dirs, get_project, From 3295c04280e3163cf622a73e1b2a22227657d02d Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 15:16:03 +0100 Subject: [PATCH 16/33] logging moved --- pyproject.toml | 2 +- src/neptune/internal/streams/std_stream_capture_logger.py | 2 +- src/neptune/{new => }/logging/__init__.py | 2 +- src/neptune/{new => }/logging/logger.py | 0 src/neptune/new/integrations/python_logger.py | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename src/neptune/{new => }/logging/__init__.py (93%) rename src/neptune/{new => }/logging/logger.py (100%) diff --git a/pyproject.toml b/pyproject.toml index 5c3afd85e..1a3eee544 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -169,7 +169,7 @@ packages = [ "Documentation" = "https://docs.neptune.ai/" [tool.poetry.scripts] -neptune = "neptune.new.cli.__main__:main" +neptune = "neptune.cli.__main__:main" [tool.black] line-length = 120 diff --git a/src/neptune/internal/streams/std_stream_capture_logger.py b/src/neptune/internal/streams/std_stream_capture_logger.py index eb4289eb7..c8661b55d 100644 --- a/src/neptune/internal/streams/std_stream_capture_logger.py +++ b/src/neptune/internal/streams/std_stream_capture_logger.py @@ -20,7 +20,7 @@ from queue import Queue from typing import TextIO -from neptune.new.logging import Logger as NeptuneLogger +from neptune.logging import Logger as NeptuneLogger from neptune.new.metadata_containers import MetadataContainer diff --git a/src/neptune/new/logging/__init__.py b/src/neptune/logging/__init__.py similarity index 93% rename from src/neptune/new/logging/__init__.py rename to src/neptune/logging/__init__.py index 0b48c249f..f7909fc20 100644 --- a/src/neptune/new/logging/__init__.py +++ b/src/neptune/logging/__init__.py @@ -15,4 +15,4 @@ # __all__ = ["Logger"] -from neptune.new.logging.logger import Logger +from neptune.logging.logger import Logger diff --git a/src/neptune/new/logging/logger.py b/src/neptune/logging/logger.py similarity index 100% rename from src/neptune/new/logging/logger.py rename to src/neptune/logging/logger.py diff --git a/src/neptune/new/integrations/python_logger.py b/src/neptune/new/integrations/python_logger.py index ac7ad3c9a..bb19f26fb 100644 --- a/src/neptune/new/integrations/python_logger.py +++ b/src/neptune/new/integrations/python_logger.py @@ -20,7 +20,7 @@ from neptune import Run from neptune.internal.utils import verify_type -from neptune.new.logging import Logger +from neptune.logging import Logger from neptune.new.run import RunState from neptune.version import version as neptune_client_version From eb9f2f80424a393e283e67ae49fd926dc6dc7beb Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 15:21:33 +0100 Subject: [PATCH 17/33] attributes moved --- src/neptune/{new => }/attributes/__init__.py | 0 .../{new => }/attributes/atoms/__init__.py | 0 .../{new => }/attributes/atoms/artifact.py | 2 +- .../{new => }/attributes/atoms/atom.py | 2 +- .../{new => }/attributes/atoms/boolean.py | 2 +- .../attributes/atoms/copiable_atom.py | 2 +- .../{new => }/attributes/atoms/datetime.py | 2 +- .../{new => }/attributes/atoms/file.py | 2 +- .../{new => }/attributes/atoms/float.py | 2 +- .../{new => }/attributes/atoms/git_ref.py | 2 +- .../{new => }/attributes/atoms/integer.py | 2 +- .../attributes/atoms/notebook_ref.py | 2 +- .../{new => }/attributes/atoms/run_state.py | 2 +- .../{new => }/attributes/atoms/string.py | 2 +- src/neptune/{new => }/attributes/attribute.py | 0 src/neptune/{new => }/attributes/constants.py | 0 src/neptune/{new => }/attributes/file_set.py | 2 +- src/neptune/{new => }/attributes/namespace.py | 2 +- .../{new => }/attributes/series/__init__.py | 0 .../attributes/series/fetchable_series.py | 0 .../attributes/series/file_series.py | 2 +- .../attributes/series/float_series.py | 4 +-- .../{new => }/attributes/series/series.py | 2 +- .../attributes/series/string_series.py | 4 +-- .../{new => }/attributes/sets/__init__.py | 0 src/neptune/{new => }/attributes/sets/set.py | 2 +- .../{new => }/attributes/sets/string_set.py | 2 +- src/neptune/{new => }/attributes/utils.py | 8 +++--- src/neptune/handler.py | 18 ++++++------ src/neptune/internal/init/model.py | 2 +- src/neptune/internal/init/model_version.py | 2 +- src/neptune/internal/init/run.py | 2 +- src/neptune/internal/operation.py | 4 +-- .../streams/std_capture_background_job.py | 8 +++--- src/neptune/internal/utils/source_code.py | 2 +- src/neptune/internal/utils/traceback_job.py | 2 +- .../internal/value_to_attribute_visitor.py | 28 +++++++++---------- .../websocket_signals_background_job.py | 10 +++---- .../hosted_alpha_leaderboard_api_client.py | 10 +++---- .../internal/utils/alpha_integration.py | 2 +- .../legacy/internal/websockets/message.py | 2 +- .../metadata_containers/metadata_container.py | 8 +++--- .../new/metadata_containers/model_version.py | 2 +- src/neptune/new/run.py | 9 +++--- src/neptune/new/types/value_visitor.py | 2 +- 45 files changed, 82 insertions(+), 83 deletions(-) rename src/neptune/{new => }/attributes/__init__.py (100%) rename src/neptune/{new => }/attributes/atoms/__init__.py (100%) rename src/neptune/{new => }/attributes/atoms/artifact.py (98%) rename src/neptune/{new => }/attributes/atoms/atom.py (92%) rename src/neptune/{new => }/attributes/atoms/boolean.py (96%) rename src/neptune/{new => }/attributes/atoms/copiable_atom.py (97%) rename src/neptune/{new => }/attributes/atoms/datetime.py (96%) rename src/neptune/{new => }/attributes/atoms/file.py (97%) rename src/neptune/{new => }/attributes/atoms/float.py (96%) rename src/neptune/{new => }/attributes/atoms/git_ref.py (92%) rename src/neptune/{new => }/attributes/atoms/integer.py (96%) rename src/neptune/{new => }/attributes/atoms/notebook_ref.py (92%) rename src/neptune/{new => }/attributes/atoms/run_state.py (92%) rename src/neptune/{new => }/attributes/atoms/string.py (97%) rename src/neptune/{new => }/attributes/attribute.py (100%) rename src/neptune/{new => }/attributes/constants.py (100%) rename src/neptune/{new => }/attributes/file_set.py (97%) rename src/neptune/{new => }/attributes/namespace.py (98%) rename src/neptune/{new => }/attributes/series/__init__.py (100%) rename src/neptune/{new => }/attributes/series/fetchable_series.py (100%) rename src/neptune/{new => }/attributes/series/file_series.py (98%) rename src/neptune/{new => }/attributes/series/float_series.py (95%) rename src/neptune/{new => }/attributes/series/series.py (99%) rename src/neptune/{new => }/attributes/series/string_series.py (96%) rename src/neptune/{new => }/attributes/sets/__init__.py (100%) rename src/neptune/{new => }/attributes/sets/set.py (92%) rename src/neptune/{new => }/attributes/sets/string_set.py (98%) rename src/neptune/{new => }/attributes/utils.py (95%) diff --git a/src/neptune/new/attributes/__init__.py b/src/neptune/attributes/__init__.py similarity index 100% rename from src/neptune/new/attributes/__init__.py rename to src/neptune/attributes/__init__.py diff --git a/src/neptune/new/attributes/atoms/__init__.py b/src/neptune/attributes/atoms/__init__.py similarity index 100% rename from src/neptune/new/attributes/atoms/__init__.py rename to src/neptune/attributes/atoms/__init__.py diff --git a/src/neptune/new/attributes/atoms/artifact.py b/src/neptune/attributes/atoms/artifact.py similarity index 98% rename from src/neptune/new/attributes/atoms/artifact.py rename to src/neptune/attributes/atoms/artifact.py index e5bbbe7fa..1fc0f66bd 100644 --- a/src/neptune/new/attributes/atoms/artifact.py +++ b/src/neptune/attributes/atoms/artifact.py @@ -18,6 +18,7 @@ import pathlib import typing +from neptune.attributes.atoms.atom import Atom from neptune.internal.artifacts.types import ( ArtifactDriver, ArtifactDriversMap, @@ -28,7 +29,6 @@ AssignArtifact, TrackFilesToArtifact, ) -from neptune.new.attributes.atoms.atom import Atom from neptune.new.types.atoms.artifact import Artifact as ArtifactVal diff --git a/src/neptune/new/attributes/atoms/atom.py b/src/neptune/attributes/atoms/atom.py similarity index 92% rename from src/neptune/new/attributes/atoms/atom.py rename to src/neptune/attributes/atoms/atom.py index dcc4ca0f1..f5ae4256e 100644 --- a/src/neptune/new/attributes/atoms/atom.py +++ b/src/neptune/attributes/atoms/atom.py @@ -15,7 +15,7 @@ # __all__ = ["Atom"] -from neptune.new.attributes.attribute import Attribute +from neptune.attributes.attribute import Attribute class Atom(Attribute): diff --git a/src/neptune/new/attributes/atoms/boolean.py b/src/neptune/attributes/atoms/boolean.py similarity index 96% rename from src/neptune/new/attributes/atoms/boolean.py rename to src/neptune/attributes/atoms/boolean.py index 141c589fe..b2a603940 100644 --- a/src/neptune/new/attributes/atoms/boolean.py +++ b/src/neptune/attributes/atoms/boolean.py @@ -17,9 +17,9 @@ import typing +from neptune.attributes.atoms.copiable_atom import CopiableAtom from neptune.internal.container_type import ContainerType from neptune.internal.operation import AssignBool -from neptune.new.attributes.atoms.copiable_atom import CopiableAtom from neptune.new.types.atoms.boolean import Boolean as BooleanVal if typing.TYPE_CHECKING: diff --git a/src/neptune/new/attributes/atoms/copiable_atom.py b/src/neptune/attributes/atoms/copiable_atom.py similarity index 97% rename from src/neptune/new/attributes/atoms/copiable_atom.py rename to src/neptune/attributes/atoms/copiable_atom.py index 93d5b5f43..ed2e93450 100644 --- a/src/neptune/new/attributes/atoms/copiable_atom.py +++ b/src/neptune/attributes/atoms/copiable_atom.py @@ -18,10 +18,10 @@ import abc import typing +from neptune.attributes.atoms.atom import Atom from neptune.internal.container_type import ContainerType from neptune.internal.operation import CopyAttribute from neptune.internal.utils.paths import parse_path -from neptune.new.attributes.atoms.atom import Atom from neptune.new.types.value_copy import ValueCopy if typing.TYPE_CHECKING: diff --git a/src/neptune/new/attributes/atoms/datetime.py b/src/neptune/attributes/atoms/datetime.py similarity index 96% rename from src/neptune/new/attributes/atoms/datetime.py rename to src/neptune/attributes/atoms/datetime.py index cfc59d4c6..9e6f520d2 100644 --- a/src/neptune/new/attributes/atoms/datetime.py +++ b/src/neptune/attributes/atoms/datetime.py @@ -18,10 +18,10 @@ import typing from datetime import datetime +from neptune.attributes.atoms.copiable_atom import CopiableAtom from neptune.internal.container_type import ContainerType from neptune.internal.operation import AssignDatetime from neptune.internal.utils import verify_type -from neptune.new.attributes.atoms.copiable_atom import CopiableAtom from neptune.new.types.atoms.datetime import Datetime as DatetimeVal if typing.TYPE_CHECKING: diff --git a/src/neptune/new/attributes/atoms/file.py b/src/neptune/attributes/atoms/file.py similarity index 97% rename from src/neptune/new/attributes/atoms/file.py rename to src/neptune/attributes/atoms/file.py index ed21726c9..c2f903011 100644 --- a/src/neptune/new/attributes/atoms/file.py +++ b/src/neptune/attributes/atoms/file.py @@ -17,9 +17,9 @@ from typing import Optional +from neptune.attributes.atoms.atom import Atom from neptune.internal.operation import UploadFile from neptune.internal.utils import verify_type -from neptune.new.attributes.atoms.atom import Atom from neptune.new.types.atoms.file import File as FileVal diff --git a/src/neptune/new/attributes/atoms/float.py b/src/neptune/attributes/atoms/float.py similarity index 96% rename from src/neptune/new/attributes/atoms/float.py rename to src/neptune/attributes/atoms/float.py index 61e11f9b4..768539406 100644 --- a/src/neptune/new/attributes/atoms/float.py +++ b/src/neptune/attributes/atoms/float.py @@ -17,9 +17,9 @@ import typing +from neptune.attributes.atoms.copiable_atom import CopiableAtom from neptune.internal.container_type import ContainerType from neptune.internal.operation import AssignFloat -from neptune.new.attributes.atoms.copiable_atom import CopiableAtom from neptune.new.types.atoms.float import Float as FloatVal if typing.TYPE_CHECKING: diff --git a/src/neptune/new/attributes/atoms/git_ref.py b/src/neptune/attributes/atoms/git_ref.py similarity index 92% rename from src/neptune/new/attributes/atoms/git_ref.py rename to src/neptune/attributes/atoms/git_ref.py index c8f7f6816..4b1fe892f 100644 --- a/src/neptune/new/attributes/atoms/git_ref.py +++ b/src/neptune/attributes/atoms/git_ref.py @@ -15,7 +15,7 @@ # __all__ = ["GitRef"] -from neptune.new.attributes.atoms.atom import Atom +from neptune.attributes.atoms.atom import Atom class GitRef(Atom): diff --git a/src/neptune/new/attributes/atoms/integer.py b/src/neptune/attributes/atoms/integer.py similarity index 96% rename from src/neptune/new/attributes/atoms/integer.py rename to src/neptune/attributes/atoms/integer.py index a4bc94823..39752feb0 100644 --- a/src/neptune/new/attributes/atoms/integer.py +++ b/src/neptune/attributes/atoms/integer.py @@ -17,9 +17,9 @@ import typing +from neptune.attributes.atoms.copiable_atom import CopiableAtom from neptune.internal.container_type import ContainerType from neptune.internal.operation import AssignInt -from neptune.new.attributes.atoms.copiable_atom import CopiableAtom from neptune.new.types.atoms.integer import Integer as IntegerVal if typing.TYPE_CHECKING: diff --git a/src/neptune/new/attributes/atoms/notebook_ref.py b/src/neptune/attributes/atoms/notebook_ref.py similarity index 92% rename from src/neptune/new/attributes/atoms/notebook_ref.py rename to src/neptune/attributes/atoms/notebook_ref.py index c5d0d44ad..fe1044e18 100644 --- a/src/neptune/new/attributes/atoms/notebook_ref.py +++ b/src/neptune/attributes/atoms/notebook_ref.py @@ -16,7 +16,7 @@ __all__ = ["NotebookRef"] -from neptune.new.attributes.atoms.atom import Atom +from neptune.attributes.atoms.atom import Atom class NotebookRef(Atom): diff --git a/src/neptune/new/attributes/atoms/run_state.py b/src/neptune/attributes/atoms/run_state.py similarity index 92% rename from src/neptune/new/attributes/atoms/run_state.py rename to src/neptune/attributes/atoms/run_state.py index a54dcd4b8..20bb761ce 100644 --- a/src/neptune/new/attributes/atoms/run_state.py +++ b/src/neptune/attributes/atoms/run_state.py @@ -15,7 +15,7 @@ # __all__ = ["RunState"] -from neptune.new.attributes.atoms.atom import Atom +from neptune.attributes.atoms.atom import Atom class RunState(Atom): diff --git a/src/neptune/new/attributes/atoms/string.py b/src/neptune/attributes/atoms/string.py similarity index 97% rename from src/neptune/new/attributes/atoms/string.py rename to src/neptune/attributes/atoms/string.py index 01f5cfadd..f40f790f0 100644 --- a/src/neptune/new/attributes/atoms/string.py +++ b/src/neptune/attributes/atoms/string.py @@ -17,11 +17,11 @@ import typing +from neptune.attributes.atoms.copiable_atom import CopiableAtom from neptune.internal.container_type import ContainerType from neptune.internal.operation import AssignString from neptune.internal.utils.logger import logger from neptune.internal.utils.paths import path_to_str -from neptune.new.attributes.atoms.copiable_atom import CopiableAtom from neptune.new.types.atoms.string import String as StringVal if typing.TYPE_CHECKING: diff --git a/src/neptune/new/attributes/attribute.py b/src/neptune/attributes/attribute.py similarity index 100% rename from src/neptune/new/attributes/attribute.py rename to src/neptune/attributes/attribute.py diff --git a/src/neptune/new/attributes/constants.py b/src/neptune/attributes/constants.py similarity index 100% rename from src/neptune/new/attributes/constants.py rename to src/neptune/attributes/constants.py diff --git a/src/neptune/new/attributes/file_set.py b/src/neptune/attributes/file_set.py similarity index 97% rename from src/neptune/new/attributes/file_set.py rename to src/neptune/attributes/file_set.py index 7a6971787..64124b114 100644 --- a/src/neptune/new/attributes/file_set.py +++ b/src/neptune/attributes/file_set.py @@ -22,6 +22,7 @@ Union, ) +from neptune.attributes.attribute import Attribute from neptune.internal.operation import ( DeleteFiles, UploadFileSet, @@ -30,7 +31,6 @@ verify_collection_type, verify_type, ) -from neptune.new.attributes.attribute import Attribute from neptune.new.types.file_set import FileSet as FileSetVal diff --git a/src/neptune/new/attributes/namespace.py b/src/neptune/attributes/namespace.py similarity index 98% rename from src/neptune/new/attributes/namespace.py rename to src/neptune/attributes/namespace.py index 5706e0f33..af28469f3 100644 --- a/src/neptune/new/attributes/namespace.py +++ b/src/neptune/attributes/namespace.py @@ -30,6 +30,7 @@ Union, ) +from neptune.attributes.attribute import Attribute from neptune.internal.container_structure import ContainerStructure from neptune.internal.utils.generic_attribute_mapper import ( NoValue, @@ -39,7 +40,6 @@ parse_path, path_to_str, ) -from neptune.new.attributes.attribute import Attribute from neptune.new.types.namespace import Namespace as NamespaceVal if TYPE_CHECKING: diff --git a/src/neptune/new/attributes/series/__init__.py b/src/neptune/attributes/series/__init__.py similarity index 100% rename from src/neptune/new/attributes/series/__init__.py rename to src/neptune/attributes/series/__init__.py diff --git a/src/neptune/new/attributes/series/fetchable_series.py b/src/neptune/attributes/series/fetchable_series.py similarity index 100% rename from src/neptune/new/attributes/series/fetchable_series.py rename to src/neptune/attributes/series/fetchable_series.py diff --git a/src/neptune/new/attributes/series/file_series.py b/src/neptune/attributes/series/file_series.py similarity index 98% rename from src/neptune/new/attributes/series/file_series.py rename to src/neptune/attributes/series/file_series.py index 2737de98c..0c79f2f70 100644 --- a/src/neptune/new/attributes/series/file_series.py +++ b/src/neptune/attributes/series/file_series.py @@ -24,6 +24,7 @@ Optional, ) +from neptune.attributes.series.series import Series from neptune.exceptions import ( FileNotFound, OperationNotSupported, @@ -37,7 +38,6 @@ from neptune.internal.types.file_types import FileType from neptune.internal.utils import base64_encode from neptune.internal.utils.limits import image_size_exceeds_limit_for_logging -from neptune.new.attributes.series.series import Series from neptune.new.types import File from neptune.new.types.series.file_series import FileSeries as FileSeriesVal diff --git a/src/neptune/new/attributes/series/float_series.py b/src/neptune/attributes/series/float_series.py similarity index 95% rename from src/neptune/new/attributes/series/float_series.py rename to src/neptune/attributes/series/float_series.py index 23aad37e0..8c1f3e7cb 100644 --- a/src/neptune/new/attributes/series/float_series.py +++ b/src/neptune/attributes/series/float_series.py @@ -21,6 +21,8 @@ Union, ) +from neptune.attributes.series.fetchable_series import FetchableSeries +from neptune.attributes.series.series import Series from neptune.internal.backends.api_model import FloatSeriesValues from neptune.internal.operation import ( ClearFloatLog, @@ -30,8 +32,6 @@ ) from neptune.internal.utils import verify_type from neptune.internal.utils.logger import logger -from neptune.new.attributes.series.fetchable_series import FetchableSeries -from neptune.new.attributes.series.series import Series from neptune.new.types.series.float_series import FloatSeries as FloatSeriesVal Val = FloatSeriesVal diff --git a/src/neptune/new/attributes/series/series.py b/src/neptune/attributes/series/series.py similarity index 99% rename from src/neptune/new/attributes/series/series.py rename to src/neptune/attributes/series/series.py index e04277dec..15159f650 100644 --- a/src/neptune/new/attributes/series/series.py +++ b/src/neptune/attributes/series/series.py @@ -28,6 +28,7 @@ Union, ) +from neptune.attributes.attribute import Attribute from neptune.internal.operation import LogOperation from neptune.internal.utils import ( is_collection, @@ -35,7 +36,6 @@ verify_type, ) from neptune.internal.utils.iteration import get_batches -from neptune.new.attributes.attribute import Attribute from neptune.new.types.series.series import Series as SeriesVal ValTV = TypeVar("ValTV", bound=SeriesVal) diff --git a/src/neptune/new/attributes/series/string_series.py b/src/neptune/attributes/series/string_series.py similarity index 96% rename from src/neptune/new/attributes/series/string_series.py rename to src/neptune/attributes/series/string_series.py index 36dc95420..93ce8cb3f 100644 --- a/src/neptune/new/attributes/series/string_series.py +++ b/src/neptune/attributes/series/string_series.py @@ -23,6 +23,8 @@ Union, ) +from neptune.attributes.series.fetchable_series import FetchableSeries +from neptune.attributes.series.series import Series from neptune.internal.backends.api_model import StringSeriesValues from neptune.internal.operation import ( ClearStringLog, @@ -31,8 +33,6 @@ ) from neptune.internal.utils.logger import logger from neptune.internal.utils.paths import path_to_str -from neptune.new.attributes.series.fetchable_series import FetchableSeries -from neptune.new.attributes.series.series import Series from neptune.new.types.series.string_series import MAX_STRING_SERIES_VALUE_LENGTH from neptune.new.types.series.string_series import StringSeries as StringSeriesVal diff --git a/src/neptune/new/attributes/sets/__init__.py b/src/neptune/attributes/sets/__init__.py similarity index 100% rename from src/neptune/new/attributes/sets/__init__.py rename to src/neptune/attributes/sets/__init__.py diff --git a/src/neptune/new/attributes/sets/set.py b/src/neptune/attributes/sets/set.py similarity index 92% rename from src/neptune/new/attributes/sets/set.py rename to src/neptune/attributes/sets/set.py index 4afaa53f4..7c83ef921 100644 --- a/src/neptune/new/attributes/sets/set.py +++ b/src/neptune/attributes/sets/set.py @@ -15,7 +15,7 @@ # __all__ = ["Set"] -from neptune.new.attributes.attribute import Attribute +from neptune.attributes.attribute import Attribute class Set(Attribute): diff --git a/src/neptune/new/attributes/sets/string_set.py b/src/neptune/attributes/sets/string_set.py similarity index 98% rename from src/neptune/new/attributes/sets/string_set.py rename to src/neptune/attributes/sets/string_set.py index 074e50147..38d8d3b16 100644 --- a/src/neptune/new/attributes/sets/string_set.py +++ b/src/neptune/attributes/sets/string_set.py @@ -21,6 +21,7 @@ Union, ) +from neptune.attributes.sets.set import Set from neptune.internal.operation import ( AddStrings, ClearStringSet, @@ -31,7 +32,6 @@ verify_collection_type, verify_type, ) -from neptune.new.attributes.sets.set import Set from neptune.new.types.sets.string_set import StringSet as StringSetVal diff --git a/src/neptune/new/attributes/utils.py b/src/neptune/attributes/utils.py similarity index 95% rename from src/neptune/new/attributes/utils.py rename to src/neptune/attributes/utils.py index 8ccd171c2..5c8b6cadd 100644 --- a/src/neptune/new/attributes/utils.py +++ b/src/neptune/attributes/utils.py @@ -20,9 +20,7 @@ List, ) -from neptune.common.exceptions import InternalClientError -from neptune.internal.backends.api_model import AttributeType -from neptune.new.attributes import ( +from neptune.attributes import ( Artifact, Boolean, Datetime, @@ -39,9 +37,11 @@ StringSeries, StringSet, ) +from neptune.common.exceptions import InternalClientError +from neptune.internal.backends.api_model import AttributeType if TYPE_CHECKING: - from neptune.new.attributes.attribute import Attribute + from neptune.attributes.attribute import Attribute from neptune.new.metadata_containers import MetadataContainer _attribute_type_to_attr_class_map = { diff --git a/src/neptune/handler.py b/src/neptune/handler.py index b270fffc0..c063628e0 100644 --- a/src/neptune/handler.py +++ b/src/neptune/handler.py @@ -29,6 +29,15 @@ Union, ) +from neptune.attributes import File +from neptune.attributes.atoms.artifact import Artifact +from neptune.attributes.constants import SYSTEM_STAGE_ATTRIBUTE_PATH +from neptune.attributes.file_set import FileSet +from neptune.attributes.namespace import Namespace +from neptune.attributes.series import FileSeries +from neptune.attributes.series.float_series import FloatSeries +from neptune.attributes.series.string_series import StringSeries +from neptune.attributes.sets.string_set import StringSet from neptune.common.deprecation import warn_once # backwards compatibility @@ -50,15 +59,6 @@ parse_path, ) from neptune.internal.value_to_attribute_visitor import ValueToAttributeVisitor -from neptune.new.attributes import File -from neptune.new.attributes.atoms.artifact import Artifact -from neptune.new.attributes.constants import SYSTEM_STAGE_ATTRIBUTE_PATH -from neptune.new.attributes.file_set import FileSet -from neptune.new.attributes.namespace import Namespace -from neptune.new.attributes.series import FileSeries -from neptune.new.attributes.series.float_series import FloatSeries -from neptune.new.attributes.series.string_series import StringSeries -from neptune.new.attributes.sets.string_set import StringSet from neptune.new.exceptions import ( MissingFieldException, NeptuneCannotChangeStageManually, diff --git a/src/neptune/internal/init/model.py b/src/neptune/internal/init/model.py index 5ee20f8b8..6d053b9ea 100644 --- a/src/neptune/internal/init/model.py +++ b/src/neptune/internal/init/model.py @@ -19,6 +19,7 @@ import threading from typing import Optional +from neptune.attributes import constants as attr_consts from neptune.common.exceptions import NeptuneException from neptune.envs import CONNECTION_MODE from neptune.exceptions import ( @@ -41,7 +42,6 @@ from neptune.internal.utils import verify_type from neptune.internal.utils.deprecation import deprecated_parameter from neptune.internal.utils.ping_background_job import PingBackgroundJob -from neptune.new.attributes import constants as attr_consts from neptune.new.metadata_containers import Model from neptune.new.types.mode import Mode diff --git a/src/neptune/internal/init/model_version.py b/src/neptune/internal/init/model_version.py index 6a36b4563..13ff548d3 100644 --- a/src/neptune/internal/init/model_version.py +++ b/src/neptune/internal/init/model_version.py @@ -19,6 +19,7 @@ import threading from typing import Optional +from neptune.attributes import constants as attr_consts from neptune.common.exceptions import NeptuneException from neptune.envs import CONNECTION_MODE from neptune.exceptions import ( @@ -39,7 +40,6 @@ from neptune.internal.utils import verify_type from neptune.internal.utils.deprecation import deprecated_parameter from neptune.internal.utils.ping_background_job import PingBackgroundJob -from neptune.new.attributes import constants as attr_consts from neptune.new.metadata_containers import ( Model, ModelVersion, diff --git a/src/neptune/internal/init/run.py b/src/neptune/internal/init/run.py index 8f3dbb6fc..99cc130b9 100644 --- a/src/neptune/internal/init/run.py +++ b/src/neptune/internal/init/run.py @@ -24,6 +24,7 @@ Union, ) +from neptune.attributes import constants as attr_consts from neptune.envs import ( CONNECTION_MODE, CUSTOM_RUN_ID_ENV_NAME, @@ -68,7 +69,6 @@ from neptune.internal.utils.source_code import upload_source_code from neptune.internal.utils.traceback_job import TracebackJob from neptune.internal.websockets.websocket_signals_background_job import WebsocketSignalsBackgroundJob -from neptune.new.attributes import constants as attr_consts from neptune.new.metadata_containers import Run from neptune.new.types.mode import Mode from neptune.new.types.series.string_series import StringSeries diff --git a/src/neptune/internal/operation.py b/src/neptune/internal/operation.py index 7f238da38..31386a668 100644 --- a/src/neptune/internal/operation.py +++ b/src/neptune/internal/operation.py @@ -36,9 +36,9 @@ from neptune.new.types.atoms.file import File if TYPE_CHECKING: + from neptune.attributes.attribute import Attribute from neptune.internal.backends.neptune_backend import NeptuneBackend from neptune.internal.operation_visitor import OperationVisitor - from neptune.new.attributes.attribute import Attribute Ret = TypeVar("Ret") T = TypeVar("T") @@ -565,7 +565,7 @@ def to_dict(self) -> dict: @staticmethod def from_dict(data: dict) -> "CopyAttribute": - from neptune.new.attributes.attribute import Attribute + from neptune.attributes.attribute import Attribute source_attr_cls = {cls.__name__: cls for cls in all_subclasses(Attribute) if cls.supports_copy}.get( data["source_attr_name"] diff --git a/src/neptune/internal/streams/std_capture_background_job.py b/src/neptune/internal/streams/std_capture_background_job.py index 309da33b5..4cafbbd34 100644 --- a/src/neptune/internal/streams/std_capture_background_job.py +++ b/src/neptune/internal/streams/std_capture_background_job.py @@ -20,15 +20,15 @@ Optional, ) +from neptune.attributes.constants import ( + MONITORING_STDERR_ATTRIBUTE_PATH, + MONITORING_STDOUT_ATTRIBUTE_PATH, +) from neptune.internal.background_job import BackgroundJob from neptune.internal.streams.std_stream_capture_logger import ( StderrCaptureLogger, StdoutCaptureLogger, ) -from neptune.new.attributes.constants import ( - MONITORING_STDERR_ATTRIBUTE_PATH, - MONITORING_STDOUT_ATTRIBUTE_PATH, -) if TYPE_CHECKING: from neptune.new.metadata_containers import MetadataContainer diff --git a/src/neptune/internal/utils/source_code.py b/src/neptune/internal/utils/source_code.py index 2857f9103..1a87e3026 100644 --- a/src/neptune/internal/utils/source_code.py +++ b/src/neptune/internal/utils/source_code.py @@ -22,6 +22,7 @@ Optional, ) +from neptune.attributes import constants as attr_consts from neptune.common.storage.storage_utils import normalize_file_name from neptune.common.utils import is_ipython from neptune.internal.utils import ( @@ -29,7 +30,6 @@ get_absolute_paths, get_common_root, ) -from neptune.new.attributes import constants as attr_consts from neptune.vendor.lib_programname import ( empty_path, get_path_executed_script, diff --git a/src/neptune/internal/utils/traceback_job.py b/src/neptune/internal/utils/traceback_job.py index ac305d5cd..64ea6a125 100644 --- a/src/neptune/internal/utils/traceback_job.py +++ b/src/neptune/internal/utils/traceback_job.py @@ -23,9 +23,9 @@ Optional, ) +from neptune.attributes.constants import SYSTEM_FAILED_ATTRIBUTE_PATH from neptune.internal.background_job import BackgroundJob from neptune.internal.utils.uncaught_exception_handler import instance as traceback_handler -from neptune.new.attributes.constants import SYSTEM_FAILED_ATTRIBUTE_PATH if TYPE_CHECKING: from neptune.new.metadata_containers import MetadataContainer diff --git a/src/neptune/internal/value_to_attribute_visitor.py b/src/neptune/internal/value_to_attribute_visitor.py index a39ae84a5..bbe02e4c8 100644 --- a/src/neptune/internal/value_to_attribute_visitor.py +++ b/src/neptune/internal/value_to_attribute_visitor.py @@ -21,21 +21,21 @@ Type, ) +from neptune.attributes.atoms.artifact import Artifact as ArtifactAttr +from neptune.attributes.atoms.boolean import Boolean as BooleanAttr +from neptune.attributes.atoms.datetime import Datetime as DatetimeAttr +from neptune.attributes.atoms.file import File as FileAttr +from neptune.attributes.atoms.float import Float as FloatAttr +from neptune.attributes.atoms.integer import Integer as IntegerAttr +from neptune.attributes.atoms.string import String as StringAttr +from neptune.attributes.attribute import Attribute +from neptune.attributes.file_set import FileSet as FileSetAttr +from neptune.attributes.namespace import Namespace as NamespaceAttr +from neptune.attributes.series.file_series import FileSeries as ImageSeriesAttr +from neptune.attributes.series.float_series import FloatSeries as FloatSeriesAttr +from neptune.attributes.series.string_series import StringSeries as StringSeriesAttr +from neptune.attributes.sets.string_set import StringSet as StringSetAttr from neptune.exceptions import OperationNotSupported -from neptune.new.attributes.atoms.artifact import Artifact as ArtifactAttr -from neptune.new.attributes.atoms.boolean import Boolean as BooleanAttr -from neptune.new.attributes.atoms.datetime import Datetime as DatetimeAttr -from neptune.new.attributes.atoms.file import File as FileAttr -from neptune.new.attributes.atoms.float import Float as FloatAttr -from neptune.new.attributes.atoms.integer import Integer as IntegerAttr -from neptune.new.attributes.atoms.string import String as StringAttr -from neptune.new.attributes.attribute import Attribute -from neptune.new.attributes.file_set import FileSet as FileSetAttr -from neptune.new.attributes.namespace import Namespace as NamespaceAttr -from neptune.new.attributes.series.file_series import FileSeries as ImageSeriesAttr -from neptune.new.attributes.series.float_series import FloatSeries as FloatSeriesAttr -from neptune.new.attributes.series.string_series import StringSeries as StringSeriesAttr -from neptune.new.attributes.sets.string_set import StringSet as StringSetAttr from neptune.new.types import ( Boolean, Integer, diff --git a/src/neptune/internal/websockets/websocket_signals_background_job.py b/src/neptune/internal/websockets/websocket_signals_background_job.py index 465953f1b..f30828b8c 100644 --- a/src/neptune/internal/websockets/websocket_signals_background_job.py +++ b/src/neptune/internal/websockets/websocket_signals_background_job.py @@ -26,17 +26,17 @@ from websocket import WebSocketConnectionClosedException +from neptune.attributes.constants import ( + SIGNAL_TYPE_ABORT, + SIGNAL_TYPE_STOP, + SYSTEM_FAILED_ATTRIBUTE_PATH, +) from neptune.common.websockets.reconnecting_websocket import ReconnectingWebsocket from neptune.internal.background_job import BackgroundJob from neptune.internal.threading.daemon import Daemon from neptune.internal.utils import process_killer from neptune.internal.utils.logger import logger from neptune.internal.websockets.websockets_factory import WebsocketsFactory -from neptune.new.attributes.constants import ( - SIGNAL_TYPE_ABORT, - SIGNAL_TYPE_STOP, - SYSTEM_FAILED_ATTRIBUTE_PATH, -) if TYPE_CHECKING: from neptune.new.metadata_containers import MetadataContainer diff --git a/src/neptune/legacy/internal/api_clients/hosted_api_clients/hosted_alpha_leaderboard_api_client.py b/src/neptune/legacy/internal/api_clients/hosted_api_clients/hosted_alpha_leaderboard_api_client.py index 469a7e8d0..1c8761a33 100644 --- a/src/neptune/legacy/internal/api_clients/hosted_api_clients/hosted_alpha_leaderboard_api_client.py +++ b/src/neptune/legacy/internal/api_clients/hosted_api_clients/hosted_alpha_leaderboard_api_client.py @@ -37,6 +37,11 @@ from bravado.exception import HTTPNotFound import neptune.exceptions as alpha_exceptions +from neptune.attributes import constants as alpha_consts +from neptune.attributes.constants import ( + MONITORING_TRACEBACK_ATTRIBUTE_PATH, + SYSTEM_FAILED_ATTRIBUTE_PATH, +) from neptune.common import exceptions as common_exceptions from neptune.common.exceptions import ClientHttpError from neptune.common.storage.storage_utils import normalize_file_name @@ -106,11 +111,6 @@ LeaderboardEntry, ) from neptune.legacy.notebook import Notebook -from neptune.new.attributes import constants as alpha_consts -from neptune.new.attributes.constants import ( - MONITORING_TRACEBACK_ATTRIBUTE_PATH, - SYSTEM_FAILED_ATTRIBUTE_PATH, -) _logger = logging.getLogger(__name__) diff --git a/src/neptune/legacy/internal/utils/alpha_integration.py b/src/neptune/legacy/internal/utils/alpha_integration.py index 5c967ab56..2b9056924 100644 --- a/src/neptune/legacy/internal/utils/alpha_integration.py +++ b/src/neptune/legacy/internal/utils/alpha_integration.py @@ -16,6 +16,7 @@ import abc from collections import namedtuple +from neptune.attributes import constants as alpha_consts from neptune.internal import operation as alpha_operation from neptune.internal.backends.api_model import AttributeType as AlphaAttributeType @@ -26,7 +27,6 @@ ChannelType, ChannelValueType, ) -from neptune.new.attributes import constants as alpha_consts AlphaKeyValueProperty = namedtuple("AlphaKeyValueProperty", ["key", "value"]) diff --git a/src/neptune/legacy/internal/websockets/message.py b/src/neptune/legacy/internal/websockets/message.py index f912dcd25..91f4f0baa 100644 --- a/src/neptune/legacy/internal/websockets/message.py +++ b/src/neptune/legacy/internal/websockets/message.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from neptune.new.attributes.constants import ( +from neptune.attributes.constants import ( SIGNAL_TYPE_ABORT, SIGNAL_TYPE_STOP, ) diff --git a/src/neptune/new/metadata_containers/metadata_container.py b/src/neptune/new/metadata_containers/metadata_container.py index e6cb0e5ed..b1bbc4429 100644 --- a/src/neptune/new/metadata_containers/metadata_container.py +++ b/src/neptune/new/metadata_containers/metadata_container.py @@ -32,6 +32,10 @@ Union, ) +from neptune.attributes import create_attribute_from_type +from neptune.attributes.attribute import Attribute +from neptune.attributes.namespace import Namespace as NamespaceAttr +from neptune.attributes.namespace import NamespaceBuilder from neptune.common.exceptions import UNIX_STYLES from neptune.exceptions import ( InactiveModelException, @@ -64,10 +68,6 @@ ) from neptune.internal.utils.uncaught_exception_handler import instance as uncaught_exception_handler from neptune.internal.value_to_attribute_visitor import ValueToAttributeVisitor -from neptune.new.attributes import create_attribute_from_type -from neptune.new.attributes.attribute import Attribute -from neptune.new.attributes.namespace import Namespace as NamespaceAttr -from neptune.new.attributes.namespace import NamespaceBuilder from neptune.new.metadata_containers.metadata_containers_table import Table from neptune.new.types.mode import Mode from neptune.new.types.type_casting import cast_value diff --git a/src/neptune/new/metadata_containers/model_version.py b/src/neptune/new/metadata_containers/model_version.py index 87653b1b8..66a7d2274 100644 --- a/src/neptune/new/metadata_containers/model_version.py +++ b/src/neptune/new/metadata_containers/model_version.py @@ -15,10 +15,10 @@ # __all__ = ["ModelVersion"] +from neptune.attributes.constants import SYSTEM_STAGE_ATTRIBUTE_PATH from neptune.exceptions import NeptuneOfflineModeChangeStageException from neptune.internal.container_type import ContainerType from neptune.internal.operation_processors.offline_operation_processor import OfflineOperationProcessor -from neptune.new.attributes.constants import SYSTEM_STAGE_ATTRIBUTE_PATH from neptune.new.metadata_containers import MetadataContainer from neptune.new.types.model_version_stage import ModelVersionStage diff --git a/src/neptune/new/run.py b/src/neptune/new/run.py index 81f732d54..7b812f99a 100644 --- a/src/neptune/new/run.py +++ b/src/neptune/new/run.py @@ -32,12 +32,11 @@ "Value", ] -from neptune.internal.state import ContainerState as RunState - # backwards compatibility -from neptune.new.attributes.attribute import Attribute -from neptune.new.attributes.namespace import Namespace as NamespaceAttr -from neptune.new.attributes.namespace import NamespaceBuilder +from neptune.attributes.attribute import Attribute +from neptune.attributes.namespace import Namespace as NamespaceAttr +from neptune.attributes.namespace import NamespaceBuilder +from neptune.internal.state import ContainerState as RunState from neptune.new.exceptions import ( InactiveRunException, MetadataInconsistency, diff --git a/src/neptune/new/types/value_visitor.py b/src/neptune/new/types/value_visitor.py index 2890cf01b..dab5e8dd5 100644 --- a/src/neptune/new/types/value_visitor.py +++ b/src/neptune/new/types/value_visitor.py @@ -22,7 +22,7 @@ TypeVar, ) -from neptune.new.attributes.attribute import Attribute +from neptune.attributes.attribute import Attribute from neptune.new.types.atoms import GitRef from neptune.new.types.atoms.artifact import Artifact from neptune.new.types.atoms.boolean import Boolean From 7972863136c3d17f0a0646b985c4e77610b945fd Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 15:22:27 +0100 Subject: [PATCH 18/33] Integrations moved --- src/neptune/{new => }/integrations/__init__.py | 0 src/neptune/{new => }/integrations/aws/__init__.py | 0 src/neptune/{new => }/integrations/detectron2/__init__.py | 0 src/neptune/{new => }/integrations/fastai/__init__.py | 0 src/neptune/{new => }/integrations/kedro/__init__.py | 0 src/neptune/{new => }/integrations/lightgbm/__init__.py | 0 src/neptune/{new => }/integrations/optuna/__init__.py | 0 src/neptune/{new => }/integrations/prophet/__init__.py | 0 src/neptune/{new => }/integrations/python_logger.py | 2 +- .../{new => }/integrations/pytorch_lightning/__init__.py | 0 src/neptune/{new => }/integrations/sacred/__init__.py | 0 src/neptune/{new => }/integrations/sklearn/__init__.py | 0 src/neptune/{new => }/integrations/tensorflow_keras/__init__.py | 0 src/neptune/{new => }/integrations/transformers/__init__.py | 0 src/neptune/{new => }/integrations/utils.py | 0 src/neptune/{new => }/integrations/xgboost/__init__.py | 0 16 files changed, 1 insertion(+), 1 deletion(-) rename src/neptune/{new => }/integrations/__init__.py (100%) rename src/neptune/{new => }/integrations/aws/__init__.py (100%) rename src/neptune/{new => }/integrations/detectron2/__init__.py (100%) rename src/neptune/{new => }/integrations/fastai/__init__.py (100%) rename src/neptune/{new => }/integrations/kedro/__init__.py (100%) rename src/neptune/{new => }/integrations/lightgbm/__init__.py (100%) rename src/neptune/{new => }/integrations/optuna/__init__.py (100%) rename src/neptune/{new => }/integrations/prophet/__init__.py (100%) rename src/neptune/{new => }/integrations/python_logger.py (97%) rename src/neptune/{new => }/integrations/pytorch_lightning/__init__.py (100%) rename src/neptune/{new => }/integrations/sacred/__init__.py (100%) rename src/neptune/{new => }/integrations/sklearn/__init__.py (100%) rename src/neptune/{new => }/integrations/tensorflow_keras/__init__.py (100%) rename src/neptune/{new => }/integrations/transformers/__init__.py (100%) rename src/neptune/{new => }/integrations/utils.py (100%) rename src/neptune/{new => }/integrations/xgboost/__init__.py (100%) diff --git a/src/neptune/new/integrations/__init__.py b/src/neptune/integrations/__init__.py similarity index 100% rename from src/neptune/new/integrations/__init__.py rename to src/neptune/integrations/__init__.py diff --git a/src/neptune/new/integrations/aws/__init__.py b/src/neptune/integrations/aws/__init__.py similarity index 100% rename from src/neptune/new/integrations/aws/__init__.py rename to src/neptune/integrations/aws/__init__.py diff --git a/src/neptune/new/integrations/detectron2/__init__.py b/src/neptune/integrations/detectron2/__init__.py similarity index 100% rename from src/neptune/new/integrations/detectron2/__init__.py rename to src/neptune/integrations/detectron2/__init__.py diff --git a/src/neptune/new/integrations/fastai/__init__.py b/src/neptune/integrations/fastai/__init__.py similarity index 100% rename from src/neptune/new/integrations/fastai/__init__.py rename to src/neptune/integrations/fastai/__init__.py diff --git a/src/neptune/new/integrations/kedro/__init__.py b/src/neptune/integrations/kedro/__init__.py similarity index 100% rename from src/neptune/new/integrations/kedro/__init__.py rename to src/neptune/integrations/kedro/__init__.py diff --git a/src/neptune/new/integrations/lightgbm/__init__.py b/src/neptune/integrations/lightgbm/__init__.py similarity index 100% rename from src/neptune/new/integrations/lightgbm/__init__.py rename to src/neptune/integrations/lightgbm/__init__.py diff --git a/src/neptune/new/integrations/optuna/__init__.py b/src/neptune/integrations/optuna/__init__.py similarity index 100% rename from src/neptune/new/integrations/optuna/__init__.py rename to src/neptune/integrations/optuna/__init__.py diff --git a/src/neptune/new/integrations/prophet/__init__.py b/src/neptune/integrations/prophet/__init__.py similarity index 100% rename from src/neptune/new/integrations/prophet/__init__.py rename to src/neptune/integrations/prophet/__init__.py diff --git a/src/neptune/new/integrations/python_logger.py b/src/neptune/integrations/python_logger.py similarity index 97% rename from src/neptune/new/integrations/python_logger.py rename to src/neptune/integrations/python_logger.py index bb19f26fb..fe25ed34d 100644 --- a/src/neptune/new/integrations/python_logger.py +++ b/src/neptune/integrations/python_logger.py @@ -41,7 +41,7 @@ class NeptuneHandler(logging.Handler): Examples: >>> import logging >>> import neptune.new as neptune - >>> from neptune.new.integrations.python_logger import NeptuneHandler + >>> from neptune.integrations.python_logger import NeptuneHandler >>> logger = logging.getLogger("root_experiment") >>> logger.setLevel(logging.DEBUG) diff --git a/src/neptune/new/integrations/pytorch_lightning/__init__.py b/src/neptune/integrations/pytorch_lightning/__init__.py similarity index 100% rename from src/neptune/new/integrations/pytorch_lightning/__init__.py rename to src/neptune/integrations/pytorch_lightning/__init__.py diff --git a/src/neptune/new/integrations/sacred/__init__.py b/src/neptune/integrations/sacred/__init__.py similarity index 100% rename from src/neptune/new/integrations/sacred/__init__.py rename to src/neptune/integrations/sacred/__init__.py diff --git a/src/neptune/new/integrations/sklearn/__init__.py b/src/neptune/integrations/sklearn/__init__.py similarity index 100% rename from src/neptune/new/integrations/sklearn/__init__.py rename to src/neptune/integrations/sklearn/__init__.py diff --git a/src/neptune/new/integrations/tensorflow_keras/__init__.py b/src/neptune/integrations/tensorflow_keras/__init__.py similarity index 100% rename from src/neptune/new/integrations/tensorflow_keras/__init__.py rename to src/neptune/integrations/tensorflow_keras/__init__.py diff --git a/src/neptune/new/integrations/transformers/__init__.py b/src/neptune/integrations/transformers/__init__.py similarity index 100% rename from src/neptune/new/integrations/transformers/__init__.py rename to src/neptune/integrations/transformers/__init__.py diff --git a/src/neptune/new/integrations/utils.py b/src/neptune/integrations/utils.py similarity index 100% rename from src/neptune/new/integrations/utils.py rename to src/neptune/integrations/utils.py diff --git a/src/neptune/new/integrations/xgboost/__init__.py b/src/neptune/integrations/xgboost/__init__.py similarity index 100% rename from src/neptune/new/integrations/xgboost/__init__.py rename to src/neptune/integrations/xgboost/__init__.py From 06d402a788500acbab8d89383b387ea0aaf75398 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 15:24:10 +0100 Subject: [PATCH 19/33] Metadata containers moved --- src/neptune/__init__.py | 2 +- src/neptune/attributes/atoms/string.py | 2 +- src/neptune/attributes/attribute.py | 2 +- src/neptune/attributes/namespace.py | 2 +- src/neptune/attributes/series/string_series.py | 2 +- src/neptune/attributes/utils.py | 2 +- src/neptune/handler.py | 2 +- .../internal/backends/neptune_backend_mock.py | 2 +- src/neptune/internal/backgroud_job_list.py | 2 +- src/neptune/internal/background_job.py | 2 +- .../hardware/hardware_metric_reporting_job.py | 2 +- src/neptune/internal/init/model.py | 2 +- src/neptune/internal/init/model_version.py | 2 +- src/neptune/internal/init/project.py | 2 +- src/neptune/internal/init/run.py | 2 +- .../internal/streams/std_capture_background_job.py | 2 +- .../internal/streams/std_stream_capture_logger.py | 2 +- src/neptune/internal/utils/ping_background_job.py | 2 +- src/neptune/internal/utils/traceback_job.py | 2 +- src/neptune/internal/value_to_attribute_visitor.py | 2 +- .../websockets/websocket_signals_background_job.py | 2 +- src/neptune/logging/logger.py | 2 +- .../{new => }/metadata_containers/__init__.py | 10 +++++----- .../metadata_containers/metadata_container.py | 2 +- .../metadata_containers/metadata_containers_table.py | 0 src/neptune/{new => }/metadata_containers/model.py | 4 ++-- .../{new => }/metadata_containers/model_version.py | 2 +- src/neptune/{new => }/metadata_containers/project.py | 4 ++-- src/neptune/{new => }/metadata_containers/run.py | 2 +- src/neptune/new/project.py | 2 +- src/neptune/new/run.py | 2 +- src/neptune/new/runs_table.py | 12 ++++++------ src/neptune/new/types/value_copy.py | 2 +- 33 files changed, 43 insertions(+), 43 deletions(-) rename src/neptune/{new => }/metadata_containers/__init__.py (68%) rename src/neptune/{new => }/metadata_containers/metadata_container.py (99%) rename src/neptune/{new => }/metadata_containers/metadata_containers_table.py (100%) rename src/neptune/{new => }/metadata_containers/model.py (97%) rename src/neptune/{new => }/metadata_containers/model_version.py (97%) rename src/neptune/{new => }/metadata_containers/project.py (99%) rename src/neptune/{new => }/metadata_containers/run.py (99%) diff --git a/src/neptune/__init__.py b/src/neptune/__init__.py index 38b0fba09..ac57857e9 100644 --- a/src/neptune/__init__.py +++ b/src/neptune/__init__.py @@ -44,7 +44,7 @@ init_run, ) from neptune.internal.utils.deprecation import deprecated -from neptune.new.metadata_containers import Run +from neptune.metadata_containers import Run from neptune.version import version diff --git a/src/neptune/attributes/atoms/string.py b/src/neptune/attributes/atoms/string.py index f40f790f0..32a71903e 100644 --- a/src/neptune/attributes/atoms/string.py +++ b/src/neptune/attributes/atoms/string.py @@ -26,7 +26,7 @@ if typing.TYPE_CHECKING: from neptune.internal.backends.neptune_backend import NeptuneBackend - from neptune.new.metadata_containers import MetadataContainer + from neptune.metadata_containers import MetadataContainer class String(CopiableAtom): diff --git a/src/neptune/attributes/attribute.py b/src/neptune/attributes/attribute.py index f53c958f9..bfa2c5100 100644 --- a/src/neptune/attributes/attribute.py +++ b/src/neptune/attributes/attribute.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: from neptune.internal.container_type import ContainerType - from neptune.new.metadata_containers import MetadataContainer + from neptune.metadata_containers import MetadataContainer class Attribute: diff --git a/src/neptune/attributes/namespace.py b/src/neptune/attributes/namespace.py index af28469f3..ad74616fa 100644 --- a/src/neptune/attributes/namespace.py +++ b/src/neptune/attributes/namespace.py @@ -43,7 +43,7 @@ from neptune.new.types.namespace import Namespace as NamespaceVal if TYPE_CHECKING: - from neptune.new.metadata_containers import MetadataContainer + from neptune.metadata_containers import MetadataContainer RunStructure = ContainerStructure # backwards compatibility diff --git a/src/neptune/attributes/series/string_series.py b/src/neptune/attributes/series/string_series.py index 93ce8cb3f..cd51f7441 100644 --- a/src/neptune/attributes/series/string_series.py +++ b/src/neptune/attributes/series/string_series.py @@ -37,7 +37,7 @@ from neptune.new.types.series.string_series import StringSeries as StringSeriesVal if TYPE_CHECKING: - from neptune.new.metadata_containers import MetadataContainer + from neptune.metadata_containers import MetadataContainer Val = StringSeriesVal Data = str diff --git a/src/neptune/attributes/utils.py b/src/neptune/attributes/utils.py index 5c8b6cadd..44c63cfa9 100644 --- a/src/neptune/attributes/utils.py +++ b/src/neptune/attributes/utils.py @@ -42,7 +42,7 @@ if TYPE_CHECKING: from neptune.attributes.attribute import Attribute - from neptune.new.metadata_containers import MetadataContainer + from neptune.metadata_containers import MetadataContainer _attribute_type_to_attr_class_map = { AttributeType.FLOAT: Float, diff --git a/src/neptune/handler.py b/src/neptune/handler.py index c063628e0..533d1b55f 100644 --- a/src/neptune/handler.py +++ b/src/neptune/handler.py @@ -69,7 +69,7 @@ from neptune.new.types.value_copy import ValueCopy if TYPE_CHECKING: - from neptune.new.metadata_containers import MetadataContainer + from neptune.metadata_containers import MetadataContainer NeptuneObject = NewType("NeptuneObject", MetadataContainer) diff --git a/src/neptune/internal/backends/neptune_backend_mock.py b/src/neptune/internal/backends/neptune_backend_mock.py index 8005482f3..656b9f592 100644 --- a/src/neptune/internal/backends/neptune_backend_mock.py +++ b/src/neptune/internal/backends/neptune_backend_mock.py @@ -110,7 +110,7 @@ from neptune.internal.utils import base64_decode from neptune.internal.utils.generic_attribute_mapper import NoValue from neptune.internal.utils.paths import path_to_str -from neptune.new.metadata_containers import Model +from neptune.metadata_containers import Model from neptune.new.types import ( Boolean, Integer, diff --git a/src/neptune/internal/backgroud_job_list.py b/src/neptune/internal/backgroud_job_list.py index 802cfcf6b..c5495a38f 100644 --- a/src/neptune/internal/backgroud_job_list.py +++ b/src/neptune/internal/backgroud_job_list.py @@ -25,7 +25,7 @@ from neptune.internal.background_job import BackgroundJob if TYPE_CHECKING: - from neptune.new.metadata_containers import MetadataContainer + from neptune.metadata_containers import MetadataContainer class BackgroundJobList(BackgroundJob): diff --git a/src/neptune/internal/background_job.py b/src/neptune/internal/background_job.py index d53808437..995992599 100644 --- a/src/neptune/internal/background_job.py +++ b/src/neptune/internal/background_job.py @@ -22,7 +22,7 @@ ) if TYPE_CHECKING: - from neptune.new.metadata_containers import MetadataContainer + from neptune.metadata_containers import MetadataContainer class BackgroundJob: diff --git a/src/neptune/internal/hardware/hardware_metric_reporting_job.py b/src/neptune/internal/hardware/hardware_metric_reporting_job.py index 84dae3cd2..8f2cd83ea 100644 --- a/src/neptune/internal/hardware/hardware_metric_reporting_job.py +++ b/src/neptune/internal/hardware/hardware_metric_reporting_job.py @@ -39,7 +39,7 @@ from neptune.new.types.series import FloatSeries if TYPE_CHECKING: - from neptune.new.metadata_containers import MetadataContainer + from neptune.metadata_containers import MetadataContainer _logger = logging.getLogger(__name__) diff --git a/src/neptune/internal/init/model.py b/src/neptune/internal/init/model.py index 6d053b9ea..6dd2399b9 100644 --- a/src/neptune/internal/init/model.py +++ b/src/neptune/internal/init/model.py @@ -42,7 +42,7 @@ from neptune.internal.utils import verify_type from neptune.internal.utils.deprecation import deprecated_parameter from neptune.internal.utils.ping_background_job import PingBackgroundJob -from neptune.new.metadata_containers import Model +from neptune.metadata_containers import Model from neptune.new.types.mode import Mode diff --git a/src/neptune/internal/init/model_version.py b/src/neptune/internal/init/model_version.py index 13ff548d3..2ccf92975 100644 --- a/src/neptune/internal/init/model_version.py +++ b/src/neptune/internal/init/model_version.py @@ -40,7 +40,7 @@ from neptune.internal.utils import verify_type from neptune.internal.utils.deprecation import deprecated_parameter from neptune.internal.utils.ping_background_job import PingBackgroundJob -from neptune.new.metadata_containers import ( +from neptune.metadata_containers import ( Model, ModelVersion, ) diff --git a/src/neptune/internal/init/project.py b/src/neptune/internal/init/project.py index 77b048702..07b8ccc27 100644 --- a/src/neptune/internal/init/project.py +++ b/src/neptune/internal/init/project.py @@ -33,7 +33,7 @@ deprecated, deprecated_parameter, ) -from neptune.new.metadata_containers import Project +from neptune.metadata_containers import Project from neptune.new.types.mode import Mode diff --git a/src/neptune/internal/init/run.py b/src/neptune/internal/init/run.py index 99cc130b9..98be3b0dc 100644 --- a/src/neptune/internal/init/run.py +++ b/src/neptune/internal/init/run.py @@ -69,7 +69,7 @@ from neptune.internal.utils.source_code import upload_source_code from neptune.internal.utils.traceback_job import TracebackJob from neptune.internal.websockets.websocket_signals_background_job import WebsocketSignalsBackgroundJob -from neptune.new.metadata_containers import Run +from neptune.metadata_containers import Run from neptune.new.types.mode import Mode from neptune.new.types.series.string_series import StringSeries diff --git a/src/neptune/internal/streams/std_capture_background_job.py b/src/neptune/internal/streams/std_capture_background_job.py index 4cafbbd34..5d4cef668 100644 --- a/src/neptune/internal/streams/std_capture_background_job.py +++ b/src/neptune/internal/streams/std_capture_background_job.py @@ -31,7 +31,7 @@ ) if TYPE_CHECKING: - from neptune.new.metadata_containers import MetadataContainer + from neptune.metadata_containers import MetadataContainer class StdoutCaptureBackgroundJob(BackgroundJob): diff --git a/src/neptune/internal/streams/std_stream_capture_logger.py b/src/neptune/internal/streams/std_stream_capture_logger.py index c8661b55d..ca5764cc4 100644 --- a/src/neptune/internal/streams/std_stream_capture_logger.py +++ b/src/neptune/internal/streams/std_stream_capture_logger.py @@ -21,7 +21,7 @@ from typing import TextIO from neptune.logging import Logger as NeptuneLogger -from neptune.new.metadata_containers import MetadataContainer +from neptune.metadata_containers import MetadataContainer class StdStreamCaptureLogger: diff --git a/src/neptune/internal/utils/ping_background_job.py b/src/neptune/internal/utils/ping_background_job.py index 06c298c00..4f0e69081 100644 --- a/src/neptune/internal/utils/ping_background_job.py +++ b/src/neptune/internal/utils/ping_background_job.py @@ -25,7 +25,7 @@ from neptune.internal.threading.daemon import Daemon if TYPE_CHECKING: - from neptune.new.metadata_containers import MetadataContainer + from neptune.metadata_containers import MetadataContainer _logger = logging.getLogger(__name__) diff --git a/src/neptune/internal/utils/traceback_job.py b/src/neptune/internal/utils/traceback_job.py index 64ea6a125..bdaa6dc04 100644 --- a/src/neptune/internal/utils/traceback_job.py +++ b/src/neptune/internal/utils/traceback_job.py @@ -28,7 +28,7 @@ from neptune.internal.utils.uncaught_exception_handler import instance as traceback_handler if TYPE_CHECKING: - from neptune.new.metadata_containers import MetadataContainer + from neptune.metadata_containers import MetadataContainer _logger = logging.getLogger(__name__) diff --git a/src/neptune/internal/value_to_attribute_visitor.py b/src/neptune/internal/value_to_attribute_visitor.py index bbe02e4c8..0bb15aadc 100644 --- a/src/neptune/internal/value_to_attribute_visitor.py +++ b/src/neptune/internal/value_to_attribute_visitor.py @@ -55,7 +55,7 @@ from neptune.new.types.value_visitor import ValueVisitor if TYPE_CHECKING: - from neptune.new.metadata_containers import MetadataContainer + from neptune.metadata_containers import MetadataContainer class ValueToAttributeVisitor(ValueVisitor[Attribute]): diff --git a/src/neptune/internal/websockets/websocket_signals_background_job.py b/src/neptune/internal/websockets/websocket_signals_background_job.py index f30828b8c..8848efec6 100644 --- a/src/neptune/internal/websockets/websocket_signals_background_job.py +++ b/src/neptune/internal/websockets/websocket_signals_background_job.py @@ -39,7 +39,7 @@ from neptune.internal.websockets.websockets_factory import WebsocketsFactory if TYPE_CHECKING: - from neptune.new.metadata_containers import MetadataContainer + from neptune.metadata_containers import MetadataContainer _logger = logging.getLogger(__name__) diff --git a/src/neptune/logging/logger.py b/src/neptune/logging/logger.py index 7b2365a42..74cbc0b8d 100644 --- a/src/neptune/logging/logger.py +++ b/src/neptune/logging/logger.py @@ -19,7 +19,7 @@ "Logger", ] -from neptune.new.metadata_containers import MetadataContainer +from neptune.metadata_containers import MetadataContainer class Logger(object): diff --git a/src/neptune/new/metadata_containers/__init__.py b/src/neptune/metadata_containers/__init__.py similarity index 68% rename from src/neptune/new/metadata_containers/__init__.py rename to src/neptune/metadata_containers/__init__.py index 3cffcfa88..930140042 100644 --- a/src/neptune/new/metadata_containers/__init__.py +++ b/src/neptune/metadata_containers/__init__.py @@ -21,8 +21,8 @@ "Run", ] -from neptune.new.metadata_containers.metadata_container import MetadataContainer -from neptune.new.metadata_containers.model import Model -from neptune.new.metadata_containers.model_version import ModelVersion -from neptune.new.metadata_containers.project import Project -from neptune.new.metadata_containers.run import Run +from neptune.metadata_containers.metadata_container import MetadataContainer +from neptune.metadata_containers.model import Model +from neptune.metadata_containers.model_version import ModelVersion +from neptune.metadata_containers.project import Project +from neptune.metadata_containers.run import Run diff --git a/src/neptune/new/metadata_containers/metadata_container.py b/src/neptune/metadata_containers/metadata_container.py similarity index 99% rename from src/neptune/new/metadata_containers/metadata_container.py rename to src/neptune/metadata_containers/metadata_container.py index b1bbc4429..5eae18a1f 100644 --- a/src/neptune/new/metadata_containers/metadata_container.py +++ b/src/neptune/metadata_containers/metadata_container.py @@ -68,7 +68,7 @@ ) from neptune.internal.utils.uncaught_exception_handler import instance as uncaught_exception_handler from neptune.internal.value_to_attribute_visitor import ValueToAttributeVisitor -from neptune.new.metadata_containers.metadata_containers_table import Table +from neptune.metadata_containers.metadata_containers_table import Table from neptune.new.types.mode import Mode from neptune.new.types.type_casting import cast_value diff --git a/src/neptune/new/metadata_containers/metadata_containers_table.py b/src/neptune/metadata_containers/metadata_containers_table.py similarity index 100% rename from src/neptune/new/metadata_containers/metadata_containers_table.py rename to src/neptune/metadata_containers/metadata_containers_table.py diff --git a/src/neptune/new/metadata_containers/model.py b/src/neptune/metadata_containers/model.py similarity index 97% rename from src/neptune/new/metadata_containers/model.py rename to src/neptune/metadata_containers/model.py index 1dce3692a..992a37809 100644 --- a/src/neptune/new/metadata_containers/model.py +++ b/src/neptune/metadata_containers/model.py @@ -28,8 +28,8 @@ NQLQueryAttribute, ) from neptune.internal.container_type import ContainerType -from neptune.new.metadata_containers import MetadataContainer -from neptune.new.metadata_containers.metadata_containers_table import Table +from neptune.metadata_containers import MetadataContainer +from neptune.metadata_containers.metadata_containers_table import Table class Model(MetadataContainer): diff --git a/src/neptune/new/metadata_containers/model_version.py b/src/neptune/metadata_containers/model_version.py similarity index 97% rename from src/neptune/new/metadata_containers/model_version.py rename to src/neptune/metadata_containers/model_version.py index 66a7d2274..7e3c0da02 100644 --- a/src/neptune/new/metadata_containers/model_version.py +++ b/src/neptune/metadata_containers/model_version.py @@ -19,7 +19,7 @@ from neptune.exceptions import NeptuneOfflineModeChangeStageException from neptune.internal.container_type import ContainerType from neptune.internal.operation_processors.offline_operation_processor import OfflineOperationProcessor -from neptune.new.metadata_containers import MetadataContainer +from neptune.metadata_containers import MetadataContainer from neptune.new.types.model_version_stage import ModelVersionStage diff --git a/src/neptune/new/metadata_containers/project.py b/src/neptune/metadata_containers/project.py similarity index 99% rename from src/neptune/new/metadata_containers/project.py rename to src/neptune/metadata_containers/project.py index 818ef579e..df417fcf5 100644 --- a/src/neptune/new/metadata_containers/project.py +++ b/src/neptune/metadata_containers/project.py @@ -40,8 +40,8 @@ ) from neptune.internal.operation_processors.operation_processor import OperationProcessor from neptune.internal.utils import as_list -from neptune.new.metadata_containers import MetadataContainer -from neptune.new.metadata_containers.metadata_containers_table import Table +from neptune.metadata_containers import MetadataContainer +from neptune.metadata_containers.metadata_containers_table import Table from neptune.new.types.mode import Mode diff --git a/src/neptune/new/metadata_containers/run.py b/src/neptune/metadata_containers/run.py similarity index 99% rename from src/neptune/new/metadata_containers/run.py rename to src/neptune/metadata_containers/run.py index 5a5ff1288..6c6e1fe9b 100644 --- a/src/neptune/new/metadata_containers/run.py +++ b/src/neptune/metadata_containers/run.py @@ -32,7 +32,7 @@ ) from neptune.internal.operation_processors.operation_processor import OperationProcessor from neptune.internal.utils.deprecation import deprecated -from neptune.new.metadata_containers import MetadataContainer +from neptune.metadata_containers import MetadataContainer from neptune.new.types.mode import Mode diff --git a/src/neptune/new/project.py b/src/neptune/new/project.py index ea66056a5..02e9e90fb 100644 --- a/src/neptune/new/project.py +++ b/src/neptune/new/project.py @@ -17,4 +17,4 @@ # backwards compatibility __all__ = ["Project"] -from neptune.new.metadata_containers import Project +from neptune.metadata_containers import Project diff --git a/src/neptune/new/run.py b/src/neptune/new/run.py index 7b812f99a..5f7f31b11 100644 --- a/src/neptune/new/run.py +++ b/src/neptune/new/run.py @@ -37,13 +37,13 @@ from neptune.attributes.namespace import Namespace as NamespaceAttr from neptune.attributes.namespace import NamespaceBuilder from neptune.internal.state import ContainerState as RunState +from neptune.metadata_containers import Run from neptune.new.exceptions import ( InactiveRunException, MetadataInconsistency, NeptunePossibleLegacyUsageException, ) from neptune.new.handler import Handler -from neptune.new.metadata_containers import Run from neptune.new.types import ( Boolean, Integer, diff --git a/src/neptune/new/runs_table.py b/src/neptune/new/runs_table.py index b5ef24eb5..761bf1338 100644 --- a/src/neptune/new/runs_table.py +++ b/src/neptune/new/runs_table.py @@ -31,12 +31,12 @@ ) from neptune.internal.backends.neptune_backend import NeptuneBackend from neptune.internal.container_type import ContainerType - -# backwards compatibility -from neptune.new.exceptions import MetadataInconsistency -from neptune.new.metadata_containers.metadata_containers_table import ( +from neptune.metadata_containers.metadata_containers_table import ( LeaderboardEntry, LeaderboardHandler, ) -from neptune.new.metadata_containers.metadata_containers_table import Table as RunsTable -from neptune.new.metadata_containers.metadata_containers_table import TableEntry as RunsTableEntry +from neptune.metadata_containers.metadata_containers_table import Table as RunsTable +from neptune.metadata_containers.metadata_containers_table import TableEntry as RunsTableEntry + +# backwards compatibility +from neptune.new.exceptions import MetadataInconsistency diff --git a/src/neptune/new/types/value_copy.py b/src/neptune/new/types/value_copy.py index eacee3aa5..fd1b43542 100644 --- a/src/neptune/new/types/value_copy.py +++ b/src/neptune/new/types/value_copy.py @@ -25,7 +25,7 @@ from neptune.new.types.value import Value if TYPE_CHECKING: - from neptune.new.metadata_containers import Handler + from neptune.metadata_containers import Handler from neptune.new.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") From 5f0e2836f0bb07bd73bd2a4d97a3d2171272aa34 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 15:26:03 +0100 Subject: [PATCH 20/33] types moved --- src/neptune/attributes/atoms/artifact.py | 2 +- src/neptune/attributes/atoms/boolean.py | 2 +- src/neptune/attributes/atoms/copiable_atom.py | 2 +- src/neptune/attributes/atoms/datetime.py | 2 +- src/neptune/attributes/atoms/file.py | 2 +- src/neptune/attributes/atoms/float.py | 2 +- src/neptune/attributes/atoms/integer.py | 2 +- src/neptune/attributes/atoms/string.py | 2 +- src/neptune/attributes/attribute.py | 2 +- src/neptune/attributes/file_set.py | 2 +- src/neptune/attributes/namespace.py | 2 +- src/neptune/attributes/series/file_series.py | 4 +-- src/neptune/attributes/series/float_series.py | 2 +- src/neptune/attributes/series/series.py | 2 +- .../attributes/series/string_series.py | 4 +-- src/neptune/attributes/sets/string_set.py | 2 +- src/neptune/handler.py | 8 ++--- src/neptune/internal/backends/factory.py | 2 +- .../backends/hosted_neptune_backend.py | 2 +- .../internal/backends/neptune_backend.py | 2 +- .../internal/backends/neptune_backend_mock.py | 30 +++++++++---------- .../hardware/hardware_metric_reporting_job.py | 2 +- src/neptune/internal/init/__init__.py | 2 +- src/neptune/internal/init/model.py | 2 +- src/neptune/internal/init/model_version.py | 2 +- src/neptune/internal/init/project.py | 2 +- src/neptune/internal/init/run.py | 4 +-- src/neptune/internal/operation.py | 2 +- .../internal/operation_processors/factory.py | 2 +- src/neptune/internal/types/file_types.py | 2 +- src/neptune/internal/utils/git.py | 2 +- .../internal/value_to_attribute_visitor.py | 28 ++++++++--------- .../metadata_containers/metadata_container.py | 4 +-- .../metadata_containers/model_version.py | 2 +- src/neptune/metadata_containers/project.py | 2 +- src/neptune/metadata_containers/run.py | 2 +- src/neptune/new/run.py | 12 ++++---- src/neptune/{new => }/types/__init__.py | 0 src/neptune/{new => }/types/atoms/__init__.py | 0 src/neptune/{new => }/types/atoms/artifact.py | 4 +-- src/neptune/{new => }/types/atoms/atom.py | 4 +-- src/neptune/{new => }/types/atoms/boolean.py | 4 +-- src/neptune/{new => }/types/atoms/datetime.py | 4 +-- src/neptune/{new => }/types/atoms/file.py | 10 +++---- src/neptune/{new => }/types/atoms/float.py | 4 +-- src/neptune/{new => }/types/atoms/git_ref.py | 4 +-- src/neptune/{new => }/types/atoms/integer.py | 4 +-- src/neptune/{new => }/types/atoms/string.py | 4 +-- src/neptune/{new => }/types/file_set.py | 4 +-- src/neptune/{new => }/types/mode.py | 0 .../{new => }/types/model_version_stage.py | 0 src/neptune/{new => }/types/namespace.py | 4 +-- .../{new => }/types/series/__init__.py | 0 .../{new => }/types/series/file_series.py | 6 ++-- .../{new => }/types/series/float_series.py | 4 +-- src/neptune/{new => }/types/series/series.py | 4 +-- .../{new => }/types/series/series_value.py | 0 .../{new => }/types/series/string_series.py | 4 +-- src/neptune/{new => }/types/sets/__init__.py | 0 src/neptune/{new => }/types/sets/set.py | 4 +-- .../{new => }/types/sets/string_set.py | 4 +-- src/neptune/{new => }/types/type_casting.py | 18 +++++------ src/neptune/{new => }/types/value.py | 2 +- src/neptune/{new => }/types/value_copy.py | 4 +-- src/neptune/{new => }/types/value_visitor.py | 30 +++++++++---------- 65 files changed, 141 insertions(+), 141 deletions(-) rename src/neptune/{new => }/types/__init__.py (100%) rename src/neptune/{new => }/types/atoms/__init__.py (100%) rename src/neptune/{new => }/types/atoms/artifact.py (92%) rename src/neptune/{new => }/types/atoms/atom.py (89%) rename src/neptune/{new => }/types/atoms/boolean.py (91%) rename src/neptune/{new => }/types/atoms/datetime.py (92%) rename src/neptune/{new => }/types/atoms/file.py (97%) rename src/neptune/{new => }/types/atoms/float.py (91%) rename src/neptune/{new => }/types/atoms/git_ref.py (91%) rename src/neptune/{new => }/types/atoms/integer.py (91%) rename src/neptune/{new => }/types/atoms/string.py (93%) rename src/neptune/{new => }/types/file_set.py (93%) rename src/neptune/{new => }/types/mode.py (100%) rename src/neptune/{new => }/types/model_version_stage.py (100%) rename src/neptune/{new => }/types/namespace.py (91%) rename src/neptune/{new => }/types/series/__init__.py (100%) rename src/neptune/{new => }/types/series/file_series.py (91%) rename src/neptune/{new => }/types/series/float_series.py (94%) rename src/neptune/{new => }/types/series/series.py (90%) rename src/neptune/{new => }/types/series/series_value.py (100%) rename src/neptune/{new => }/types/series/string_series.py (94%) rename src/neptune/{new => }/types/sets/__init__.py (100%) rename src/neptune/{new => }/types/sets/set.py (89%) rename src/neptune/{new => }/types/sets/string_set.py (90%) rename src/neptune/{new => }/types/type_casting.py (90%) rename src/neptune/{new => }/types/value.py (93%) rename src/neptune/{new => }/types/value_copy.py (93%) rename src/neptune/{new => }/types/value_visitor.py (74%) diff --git a/src/neptune/attributes/atoms/artifact.py b/src/neptune/attributes/atoms/artifact.py index 1fc0f66bd..62c5c73dd 100644 --- a/src/neptune/attributes/atoms/artifact.py +++ b/src/neptune/attributes/atoms/artifact.py @@ -29,7 +29,7 @@ AssignArtifact, TrackFilesToArtifact, ) -from neptune.new.types.atoms.artifact import Artifact as ArtifactVal +from neptune.types.atoms.artifact import Artifact as ArtifactVal class Artifact(Atom): diff --git a/src/neptune/attributes/atoms/boolean.py b/src/neptune/attributes/atoms/boolean.py index b2a603940..cde6bba54 100644 --- a/src/neptune/attributes/atoms/boolean.py +++ b/src/neptune/attributes/atoms/boolean.py @@ -20,7 +20,7 @@ from neptune.attributes.atoms.copiable_atom import CopiableAtom from neptune.internal.container_type import ContainerType from neptune.internal.operation import AssignBool -from neptune.new.types.atoms.boolean import Boolean as BooleanVal +from neptune.types.atoms.boolean import Boolean as BooleanVal if typing.TYPE_CHECKING: from neptune.internal.backends.neptune_backend import NeptuneBackend diff --git a/src/neptune/attributes/atoms/copiable_atom.py b/src/neptune/attributes/atoms/copiable_atom.py index ed2e93450..e5b6f0107 100644 --- a/src/neptune/attributes/atoms/copiable_atom.py +++ b/src/neptune/attributes/atoms/copiable_atom.py @@ -22,7 +22,7 @@ from neptune.internal.container_type import ContainerType from neptune.internal.operation import CopyAttribute from neptune.internal.utils.paths import parse_path -from neptune.new.types.value_copy import ValueCopy +from neptune.types.value_copy import ValueCopy if typing.TYPE_CHECKING: from neptune.internal.backends.neptune_backend import NeptuneBackend diff --git a/src/neptune/attributes/atoms/datetime.py b/src/neptune/attributes/atoms/datetime.py index 9e6f520d2..c2ec64b3f 100644 --- a/src/neptune/attributes/atoms/datetime.py +++ b/src/neptune/attributes/atoms/datetime.py @@ -22,7 +22,7 @@ from neptune.internal.container_type import ContainerType from neptune.internal.operation import AssignDatetime from neptune.internal.utils import verify_type -from neptune.new.types.atoms.datetime import Datetime as DatetimeVal +from neptune.types.atoms.datetime import Datetime as DatetimeVal if typing.TYPE_CHECKING: from neptune.internal.backends.neptune_backend import NeptuneBackend diff --git a/src/neptune/attributes/atoms/file.py b/src/neptune/attributes/atoms/file.py index c2f903011..aed495db4 100644 --- a/src/neptune/attributes/atoms/file.py +++ b/src/neptune/attributes/atoms/file.py @@ -20,7 +20,7 @@ from neptune.attributes.atoms.atom import Atom from neptune.internal.operation import UploadFile from neptune.internal.utils import verify_type -from neptune.new.types.atoms.file import File as FileVal +from neptune.types.atoms.file import File as FileVal class File(Atom): diff --git a/src/neptune/attributes/atoms/float.py b/src/neptune/attributes/atoms/float.py index 768539406..50b909576 100644 --- a/src/neptune/attributes/atoms/float.py +++ b/src/neptune/attributes/atoms/float.py @@ -20,7 +20,7 @@ from neptune.attributes.atoms.copiable_atom import CopiableAtom from neptune.internal.container_type import ContainerType from neptune.internal.operation import AssignFloat -from neptune.new.types.atoms.float import Float as FloatVal +from neptune.types.atoms.float import Float as FloatVal if typing.TYPE_CHECKING: from neptune.internal.backends.neptune_backend import NeptuneBackend diff --git a/src/neptune/attributes/atoms/integer.py b/src/neptune/attributes/atoms/integer.py index 39752feb0..48e84e82b 100644 --- a/src/neptune/attributes/atoms/integer.py +++ b/src/neptune/attributes/atoms/integer.py @@ -20,7 +20,7 @@ from neptune.attributes.atoms.copiable_atom import CopiableAtom from neptune.internal.container_type import ContainerType from neptune.internal.operation import AssignInt -from neptune.new.types.atoms.integer import Integer as IntegerVal +from neptune.types.atoms.integer import Integer as IntegerVal if typing.TYPE_CHECKING: from neptune.internal.backends.neptune_backend import NeptuneBackend diff --git a/src/neptune/attributes/atoms/string.py b/src/neptune/attributes/atoms/string.py index 32a71903e..3ee6b7296 100644 --- a/src/neptune/attributes/atoms/string.py +++ b/src/neptune/attributes/atoms/string.py @@ -22,7 +22,7 @@ from neptune.internal.operation import AssignString from neptune.internal.utils.logger import logger from neptune.internal.utils.paths import path_to_str -from neptune.new.types.atoms.string import String as StringVal +from neptune.types.atoms.string import String as StringVal if typing.TYPE_CHECKING: from neptune.internal.backends.neptune_backend import NeptuneBackend diff --git a/src/neptune/attributes/attribute.py b/src/neptune/attributes/attribute.py index bfa2c5100..5aea61946 100644 --- a/src/neptune/attributes/attribute.py +++ b/src/neptune/attributes/attribute.py @@ -23,7 +23,7 @@ from neptune.exceptions import TypeDoesNotSupportAttributeException from neptune.internal.backends.neptune_backend import NeptuneBackend from neptune.internal.operation import Operation -from neptune.new.types.value_copy import ValueCopy +from neptune.types.value_copy import ValueCopy if TYPE_CHECKING: from neptune.internal.container_type import ContainerType diff --git a/src/neptune/attributes/file_set.py b/src/neptune/attributes/file_set.py index 64124b114..68ff20779 100644 --- a/src/neptune/attributes/file_set.py +++ b/src/neptune/attributes/file_set.py @@ -31,7 +31,7 @@ verify_collection_type, verify_type, ) -from neptune.new.types.file_set import FileSet as FileSetVal +from neptune.types.file_set import FileSet as FileSetVal class FileSet(Attribute): diff --git a/src/neptune/attributes/namespace.py b/src/neptune/attributes/namespace.py index ad74616fa..4214d2a72 100644 --- a/src/neptune/attributes/namespace.py +++ b/src/neptune/attributes/namespace.py @@ -40,7 +40,7 @@ parse_path, path_to_str, ) -from neptune.new.types.namespace import Namespace as NamespaceVal +from neptune.types.namespace import Namespace as NamespaceVal if TYPE_CHECKING: from neptune.metadata_containers import MetadataContainer diff --git a/src/neptune/attributes/series/file_series.py b/src/neptune/attributes/series/file_series.py index 0c79f2f70..f441857e6 100644 --- a/src/neptune/attributes/series/file_series.py +++ b/src/neptune/attributes/series/file_series.py @@ -38,8 +38,8 @@ from neptune.internal.types.file_types import FileType from neptune.internal.utils import base64_encode from neptune.internal.utils.limits import image_size_exceeds_limit_for_logging -from neptune.new.types import File -from neptune.new.types.series.file_series import FileSeries as FileSeriesVal +from neptune.types import File +from neptune.types.series.file_series import FileSeries as FileSeriesVal Val = FileSeriesVal Data = File diff --git a/src/neptune/attributes/series/float_series.py b/src/neptune/attributes/series/float_series.py index 8c1f3e7cb..02fcb48b4 100644 --- a/src/neptune/attributes/series/float_series.py +++ b/src/neptune/attributes/series/float_series.py @@ -32,7 +32,7 @@ ) from neptune.internal.utils import verify_type from neptune.internal.utils.logger import logger -from neptune.new.types.series.float_series import FloatSeries as FloatSeriesVal +from neptune.types.series.float_series import FloatSeries as FloatSeriesVal Val = FloatSeriesVal Data = Union[float, int] diff --git a/src/neptune/attributes/series/series.py b/src/neptune/attributes/series/series.py index 15159f650..1b75eef4e 100644 --- a/src/neptune/attributes/series/series.py +++ b/src/neptune/attributes/series/series.py @@ -36,7 +36,7 @@ verify_type, ) from neptune.internal.utils.iteration import get_batches -from neptune.new.types.series.series import Series as SeriesVal +from neptune.types.series.series import Series as SeriesVal ValTV = TypeVar("ValTV", bound=SeriesVal) DataTV = TypeVar("DataTV") diff --git a/src/neptune/attributes/series/string_series.py b/src/neptune/attributes/series/string_series.py index cd51f7441..91a2f52b3 100644 --- a/src/neptune/attributes/series/string_series.py +++ b/src/neptune/attributes/series/string_series.py @@ -33,8 +33,8 @@ ) from neptune.internal.utils.logger import logger from neptune.internal.utils.paths import path_to_str -from neptune.new.types.series.string_series import MAX_STRING_SERIES_VALUE_LENGTH -from neptune.new.types.series.string_series import StringSeries as StringSeriesVal +from neptune.types.series.string_series import MAX_STRING_SERIES_VALUE_LENGTH +from neptune.types.series.string_series import StringSeries as StringSeriesVal if TYPE_CHECKING: from neptune.metadata_containers import MetadataContainer diff --git a/src/neptune/attributes/sets/string_set.py b/src/neptune/attributes/sets/string_set.py index 38d8d3b16..438ba979b 100644 --- a/src/neptune/attributes/sets/string_set.py +++ b/src/neptune/attributes/sets/string_set.py @@ -32,7 +32,7 @@ verify_collection_type, verify_type, ) -from neptune.new.types.sets.string_set import StringSet as StringSetVal +from neptune.types.sets.string_set import StringSet as StringSetVal class StringSet(Set): diff --git a/src/neptune/handler.py b/src/neptune/handler.py index 533d1b55f..112b6389f 100644 --- a/src/neptune/handler.py +++ b/src/neptune/handler.py @@ -64,9 +64,9 @@ NeptuneCannotChangeStageManually, NeptuneUserApiInputException, ) -from neptune.new.types.atoms.file import File as FileVal -from neptune.new.types.type_casting import cast_value_for_extend -from neptune.new.types.value_copy import ValueCopy +from neptune.types.atoms.file import File as FileVal +from neptune.types.type_casting import cast_value_for_extend +from neptune.types.value_copy import ValueCopy if TYPE_CHECKING: from neptune.metadata_containers import MetadataContainer @@ -238,7 +238,7 @@ def upload(self, value, wait: bool = False) -> None: Explicitely create File value object - >>> from neptune.new.types import File + >>> from neptune.types import File >>> run["dataset/data_sample"].upload(File("sample_data.csv")) You may also want to check `upload docs page`_. diff --git a/src/neptune/internal/backends/factory.py b/src/neptune/internal/backends/factory.py index beb0dafc6..f92cbb413 100644 --- a/src/neptune/internal/backends/factory.py +++ b/src/neptune/internal/backends/factory.py @@ -18,7 +18,7 @@ from typing import Optional from neptune.internal.credentials import Credentials -from neptune.new.types.mode import Mode +from neptune.types.mode import Mode from .hosted_neptune_backend import HostedNeptuneBackend from .neptune_backend import NeptuneBackend diff --git a/src/neptune/internal/backends/hosted_neptune_backend.py b/src/neptune/internal/backends/hosted_neptune_backend.py index f5ff2e413..553330250 100644 --- a/src/neptune/internal/backends/hosted_neptune_backend.py +++ b/src/neptune/internal/backends/hosted_neptune_backend.py @@ -134,7 +134,7 @@ from neptune.internal.utils.paths import path_to_str from neptune.internal.websockets.websockets_factory import WebsocketsFactory from neptune.management.exceptions import ObjectNotFound -from neptune.new.types.atoms import GitRef +from neptune.types.atoms import GitRef from neptune.version import version as neptune_client_version if TYPE_CHECKING: diff --git a/src/neptune/internal/backends/neptune_backend.py b/src/neptune/internal/backends/neptune_backend.py index cb838fb45..ef387cb0e 100644 --- a/src/neptune/internal/backends/neptune_backend.py +++ b/src/neptune/internal/backends/neptune_backend.py @@ -56,7 +56,7 @@ ) from neptune.internal.operation import Operation from neptune.internal.websockets.websockets_factory import WebsocketsFactory -from neptune.new.types.atoms import GitRef +from neptune.types.atoms import GitRef class NeptuneBackend: diff --git a/src/neptune/internal/backends/neptune_backend_mock.py b/src/neptune/internal/backends/neptune_backend_mock.py index 656b9f592..327f1eadb 100644 --- a/src/neptune/internal/backends/neptune_backend_mock.py +++ b/src/neptune/internal/backends/neptune_backend_mock.py @@ -111,24 +111,24 @@ from neptune.internal.utils.generic_attribute_mapper import NoValue from neptune.internal.utils.paths import path_to_str from neptune.metadata_containers import Model -from neptune.new.types import ( +from neptune.types import ( Boolean, Integer, ) -from neptune.new.types.atoms import GitRef -from neptune.new.types.atoms.artifact import Artifact -from neptune.new.types.atoms.datetime import Datetime -from neptune.new.types.atoms.file import File -from neptune.new.types.atoms.float import Float -from neptune.new.types.atoms.string import String -from neptune.new.types.file_set import FileSet -from neptune.new.types.namespace import Namespace -from neptune.new.types.series.file_series import FileSeries -from neptune.new.types.series.float_series import FloatSeries -from neptune.new.types.series.string_series import StringSeries -from neptune.new.types.sets.string_set import StringSet -from neptune.new.types.value import Value -from neptune.new.types.value_visitor import ValueVisitor +from neptune.types.atoms import GitRef +from neptune.types.atoms.artifact import Artifact +from neptune.types.atoms.datetime import Datetime +from neptune.types.atoms.file import File +from neptune.types.atoms.float import Float +from neptune.types.atoms.string import String +from neptune.types.file_set import FileSet +from neptune.types.namespace import Namespace +from neptune.types.series.file_series import FileSeries +from neptune.types.series.float_series import FloatSeries +from neptune.types.series.string_series import StringSeries +from neptune.types.sets.string_set import StringSet +from neptune.types.value import Value +from neptune.types.value_visitor import ValueVisitor Val = TypeVar("Val", bound=Value) diff --git a/src/neptune/internal/hardware/hardware_metric_reporting_job.py b/src/neptune/internal/hardware/hardware_metric_reporting_job.py index 8f2cd83ea..b56fc74dc 100644 --- a/src/neptune/internal/hardware/hardware_metric_reporting_job.py +++ b/src/neptune/internal/hardware/hardware_metric_reporting_job.py @@ -36,7 +36,7 @@ from neptune.internal.background_job import BackgroundJob from neptune.internal.hardware.gpu.gpu_monitor import GPUMonitor from neptune.internal.threading.daemon import Daemon -from neptune.new.types.series import FloatSeries +from neptune.types.series import FloatSeries if TYPE_CHECKING: from neptune.metadata_containers import MetadataContainer diff --git a/src/neptune/internal/init/__init__.py b/src/neptune/internal/init/__init__.py index 31c394339..3f2a821ee 100644 --- a/src/neptune/internal/init/__init__.py +++ b/src/neptune/internal/init/__init__.py @@ -33,7 +33,7 @@ ) from neptune.internal.init.run import init_run from neptune.internal.utils.deprecation import deprecated -from neptune.new.types.mode import Mode +from neptune.types.mode import Mode RunMode = Mode diff --git a/src/neptune/internal/init/model.py b/src/neptune/internal/init/model.py index 6dd2399b9..1863ec860 100644 --- a/src/neptune/internal/init/model.py +++ b/src/neptune/internal/init/model.py @@ -43,7 +43,7 @@ from neptune.internal.utils.deprecation import deprecated_parameter from neptune.internal.utils.ping_background_job import PingBackgroundJob from neptune.metadata_containers import Model -from neptune.new.types.mode import Mode +from neptune.types.mode import Mode @deprecated_parameter(deprecated_kwarg_name="model", required_kwarg_name="with_id") diff --git a/src/neptune/internal/init/model_version.py b/src/neptune/internal/init/model_version.py index 2ccf92975..c5e559d79 100644 --- a/src/neptune/internal/init/model_version.py +++ b/src/neptune/internal/init/model_version.py @@ -44,7 +44,7 @@ Model, ModelVersion, ) -from neptune.new.types.mode import Mode +from neptune.types.mode import Mode @deprecated_parameter(deprecated_kwarg_name="version", required_kwarg_name="with_id") diff --git a/src/neptune/internal/init/project.py b/src/neptune/internal/init/project.py index 07b8ccc27..281bdf8ec 100644 --- a/src/neptune/internal/init/project.py +++ b/src/neptune/internal/init/project.py @@ -34,7 +34,7 @@ deprecated_parameter, ) from neptune.metadata_containers import Project -from neptune.new.types.mode import Mode +from neptune.types.mode import Mode @deprecated_parameter(deprecated_kwarg_name="name", required_kwarg_name="project") diff --git a/src/neptune/internal/init/run.py b/src/neptune/internal/init/run.py index 98be3b0dc..1cd76cf58 100644 --- a/src/neptune/internal/init/run.py +++ b/src/neptune/internal/init/run.py @@ -70,8 +70,8 @@ from neptune.internal.utils.traceback_job import TracebackJob from neptune.internal.websockets.websocket_signals_background_job import WebsocketSignalsBackgroundJob from neptune.metadata_containers import Run -from neptune.new.types.mode import Mode -from neptune.new.types.series.string_series import StringSeries +from neptune.types.mode import Mode +from neptune.types.series.string_series import StringSeries LEGACY_KWARGS = ("project_qualified_name", "backend") diff --git a/src/neptune/internal/operation.py b/src/neptune/internal/operation.py index 31386a668..26a0fe2a6 100644 --- a/src/neptune/internal/operation.py +++ b/src/neptune/internal/operation.py @@ -33,7 +33,7 @@ from neptune.exceptions import MalformedOperation from neptune.internal.container_type import ContainerType from neptune.internal.types.file_types import FileType -from neptune.new.types.atoms.file import File +from neptune.types.atoms.file import File if TYPE_CHECKING: from neptune.attributes.attribute import Attribute diff --git a/src/neptune/internal/operation_processors/factory.py b/src/neptune/internal/operation_processors/factory.py index 88f876b26..d3f5167a5 100644 --- a/src/neptune/internal/operation_processors/factory.py +++ b/src/neptune/internal/operation_processors/factory.py @@ -21,7 +21,7 @@ from neptune.internal.backends.neptune_backend import NeptuneBackend from neptune.internal.container_type import ContainerType from neptune.internal.id_formats import UniqueId -from neptune.new.types.mode import Mode +from neptune.types.mode import Mode from .async_operation_processor import AsyncOperationProcessor from .offline_operation_processor import OfflineOperationProcessor diff --git a/src/neptune/internal/types/file_types.py b/src/neptune/internal/types/file_types.py index 0fde7eef9..704e952f0 100644 --- a/src/neptune/internal/types/file_types.py +++ b/src/neptune/internal/types/file_types.py @@ -45,7 +45,7 @@ class FileType(enum.Enum): class FileComposite(abc.ABC): """ - Composite class defining behaviour of neptune.new.types.atoms.file.File + Composite class defining behaviour of neptune.types.atoms.file.File """ file_type: FileType = None diff --git a/src/neptune/internal/utils/git.py b/src/neptune/internal/utils/git.py index cd773d09a..171c456f0 100644 --- a/src/neptune/internal/utils/git.py +++ b/src/neptune/internal/utils/git.py @@ -20,7 +20,7 @@ import warnings from typing import Optional -from neptune.new.types.atoms import GitRef +from neptune.types.atoms import GitRef from neptune.vendor.lib_programname import get_path_executed_script _logger = logging.getLogger(__name__) diff --git a/src/neptune/internal/value_to_attribute_visitor.py b/src/neptune/internal/value_to_attribute_visitor.py index 0bb15aadc..666e9179e 100644 --- a/src/neptune/internal/value_to_attribute_visitor.py +++ b/src/neptune/internal/value_to_attribute_visitor.py @@ -36,23 +36,23 @@ from neptune.attributes.series.string_series import StringSeries as StringSeriesAttr from neptune.attributes.sets.string_set import StringSet as StringSetAttr from neptune.exceptions import OperationNotSupported -from neptune.new.types import ( +from neptune.types import ( Boolean, Integer, ) -from neptune.new.types.atoms import GitRef -from neptune.new.types.atoms.artifact import Artifact -from neptune.new.types.atoms.datetime import Datetime -from neptune.new.types.atoms.file import File -from neptune.new.types.atoms.float import Float -from neptune.new.types.atoms.string import String -from neptune.new.types.file_set import FileSet -from neptune.new.types.namespace import Namespace -from neptune.new.types.series.file_series import FileSeries -from neptune.new.types.series.float_series import FloatSeries -from neptune.new.types.series.string_series import StringSeries -from neptune.new.types.sets.string_set import StringSet -from neptune.new.types.value_visitor import ValueVisitor +from neptune.types.atoms import GitRef +from neptune.types.atoms.artifact import Artifact +from neptune.types.atoms.datetime import Datetime +from neptune.types.atoms.file import File +from neptune.types.atoms.float import Float +from neptune.types.atoms.string import String +from neptune.types.file_set import FileSet +from neptune.types.namespace import Namespace +from neptune.types.series.file_series import FileSeries +from neptune.types.series.float_series import FloatSeries +from neptune.types.series.string_series import StringSeries +from neptune.types.sets.string_set import StringSet +from neptune.types.value_visitor import ValueVisitor if TYPE_CHECKING: from neptune.metadata_containers import MetadataContainer diff --git a/src/neptune/metadata_containers/metadata_container.py b/src/neptune/metadata_containers/metadata_container.py index 5eae18a1f..abdf5e125 100644 --- a/src/neptune/metadata_containers/metadata_container.py +++ b/src/neptune/metadata_containers/metadata_container.py @@ -69,8 +69,8 @@ from neptune.internal.utils.uncaught_exception_handler import instance as uncaught_exception_handler from neptune.internal.value_to_attribute_visitor import ValueToAttributeVisitor from neptune.metadata_containers.metadata_containers_table import Table -from neptune.new.types.mode import Mode -from neptune.new.types.type_casting import cast_value +from neptune.types.mode import Mode +from neptune.types.type_casting import cast_value def ensure_not_stopped(fun): diff --git a/src/neptune/metadata_containers/model_version.py b/src/neptune/metadata_containers/model_version.py index 7e3c0da02..b710191c4 100644 --- a/src/neptune/metadata_containers/model_version.py +++ b/src/neptune/metadata_containers/model_version.py @@ -20,7 +20,7 @@ from neptune.internal.container_type import ContainerType from neptune.internal.operation_processors.offline_operation_processor import OfflineOperationProcessor from neptune.metadata_containers import MetadataContainer -from neptune.new.types.model_version_stage import ModelVersionStage +from neptune.types.model_version_stage import ModelVersionStage class ModelVersion(MetadataContainer): diff --git a/src/neptune/metadata_containers/project.py b/src/neptune/metadata_containers/project.py index df417fcf5..b4e0740e9 100644 --- a/src/neptune/metadata_containers/project.py +++ b/src/neptune/metadata_containers/project.py @@ -42,7 +42,7 @@ from neptune.internal.utils import as_list from neptune.metadata_containers import MetadataContainer from neptune.metadata_containers.metadata_containers_table import Table -from neptune.new.types.mode import Mode +from neptune.types.mode import Mode class Project(MetadataContainer): diff --git a/src/neptune/metadata_containers/run.py b/src/neptune/metadata_containers/run.py index 6c6e1fe9b..6ea646221 100644 --- a/src/neptune/metadata_containers/run.py +++ b/src/neptune/metadata_containers/run.py @@ -33,7 +33,7 @@ from neptune.internal.operation_processors.operation_processor import OperationProcessor from neptune.internal.utils.deprecation import deprecated from neptune.metadata_containers import MetadataContainer -from neptune.new.types.mode import Mode +from neptune.types.mode import Mode class Run(MetadataContainer): diff --git a/src/neptune/new/run.py b/src/neptune/new/run.py index 5f7f31b11..9d1d95d1a 100644 --- a/src/neptune/new/run.py +++ b/src/neptune/new/run.py @@ -44,12 +44,12 @@ NeptunePossibleLegacyUsageException, ) from neptune.new.handler import Handler -from neptune.new.types import ( +from neptune.types import ( Boolean, Integer, ) -from neptune.new.types.atoms.datetime import Datetime -from neptune.new.types.atoms.float import Float -from neptune.new.types.atoms.string import String -from neptune.new.types.namespace import Namespace -from neptune.new.types.value import Value +from neptune.types.atoms.datetime import Datetime +from neptune.types.atoms.float import Float +from neptune.types.atoms.string import String +from neptune.types.namespace import Namespace +from neptune.types.value import Value diff --git a/src/neptune/new/types/__init__.py b/src/neptune/types/__init__.py similarity index 100% rename from src/neptune/new/types/__init__.py rename to src/neptune/types/__init__.py diff --git a/src/neptune/new/types/atoms/__init__.py b/src/neptune/types/atoms/__init__.py similarity index 100% rename from src/neptune/new/types/atoms/__init__.py rename to src/neptune/types/atoms/__init__.py diff --git a/src/neptune/new/types/atoms/artifact.py b/src/neptune/types/atoms/artifact.py similarity index 92% rename from src/neptune/new/types/atoms/artifact.py rename to src/neptune/types/atoms/artifact.py index e52ea0f12..bf5c19e34 100644 --- a/src/neptune/new/types/atoms/artifact.py +++ b/src/neptune/types/atoms/artifact.py @@ -23,10 +23,10 @@ ) from neptune.internal.artifacts.file_hasher import FileHasher -from neptune.new.types.atoms.atom import Atom +from neptune.types.atoms.atom import Atom if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/atoms/atom.py b/src/neptune/types/atoms/atom.py similarity index 89% rename from src/neptune/new/types/atoms/atom.py rename to src/neptune/types/atoms/atom.py index dec933322..7c0e4771a 100644 --- a/src/neptune/new/types/atoms/atom.py +++ b/src/neptune/types/atoms/atom.py @@ -21,10 +21,10 @@ TypeVar, ) -from neptune.new.types.value import Value +from neptune.types.value import Value if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/atoms/boolean.py b/src/neptune/types/atoms/boolean.py similarity index 91% rename from src/neptune/new/types/atoms/boolean.py rename to src/neptune/types/atoms/boolean.py index 71c1a1419..4a25b208a 100644 --- a/src/neptune/new/types/atoms/boolean.py +++ b/src/neptune/types/atoms/boolean.py @@ -22,10 +22,10 @@ ) from neptune.internal.utils.stringify_value import extract_if_stringify_value -from neptune.new.types.atoms.atom import Atom +from neptune.types.atoms.atom import Atom if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/atoms/datetime.py b/src/neptune/types/atoms/datetime.py similarity index 92% rename from src/neptune/new/types/atoms/datetime.py rename to src/neptune/types/atoms/datetime.py index e60e755ed..42b81e020 100644 --- a/src/neptune/new/types/atoms/datetime.py +++ b/src/neptune/types/atoms/datetime.py @@ -23,10 +23,10 @@ ) from neptune.internal.utils.stringify_value import extract_if_stringify_value -from neptune.new.types.atoms.atom import Atom +from neptune.types.atoms.atom import Atom if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/atoms/file.py b/src/neptune/types/atoms/file.py similarity index 97% rename from src/neptune/new/types/atoms/file.py rename to src/neptune/types/atoms/file.py index 228244e06..8bddbb8a4 100644 --- a/src/neptune/new/types/atoms/file.py +++ b/src/neptune/types/atoms/file.py @@ -44,10 +44,10 @@ is_pil_image, is_plotly_figure, ) -from neptune.new.types.atoms.atom import Atom +from neptune.types.atoms.atom import Atom if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") @@ -185,7 +185,7 @@ def as_image(image) -> "File": Examples: >>> import neptune.new as neptune - >>> from neptune.new.types import File + >>> from neptune.types import File >>> run = neptune.init_run() Convert NumPy array to File value object and upload it @@ -226,7 +226,7 @@ def as_html(chart) -> "File": Examples: >>> import neptune.new as neptune - >>> from neptune.new.types import File + >>> from neptune.types import File >>> run = neptune.init_run() Convert Pandas DataFrame to File value object and upload it @@ -266,7 +266,7 @@ def as_pickle(obj) -> "File": Examples: >>> import neptune.new as neptune - >>> from neptune.new.types import File + >>> from neptune.types import File >>> run = neptune.init_run() Pickle model object and upload it diff --git a/src/neptune/new/types/atoms/float.py b/src/neptune/types/atoms/float.py similarity index 91% rename from src/neptune/new/types/atoms/float.py rename to src/neptune/types/atoms/float.py index 808105d50..179ba6ef0 100644 --- a/src/neptune/new/types/atoms/float.py +++ b/src/neptune/types/atoms/float.py @@ -22,10 +22,10 @@ ) from neptune.internal.utils.stringify_value import extract_if_stringify_value -from neptune.new.types.atoms.atom import Atom +from neptune.types.atoms.atom import Atom if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/atoms/git_ref.py b/src/neptune/types/atoms/git_ref.py similarity index 91% rename from src/neptune/new/types/atoms/git_ref.py rename to src/neptune/types/atoms/git_ref.py index 761789c77..aeabd1c1f 100644 --- a/src/neptune/new/types/atoms/git_ref.py +++ b/src/neptune/types/atoms/git_ref.py @@ -24,10 +24,10 @@ TypeVar, ) -from neptune.new.types.atoms.atom import Atom +from neptune.types.atoms.atom import Atom if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/atoms/integer.py b/src/neptune/types/atoms/integer.py similarity index 91% rename from src/neptune/new/types/atoms/integer.py rename to src/neptune/types/atoms/integer.py index 64992ba51..9e293a47c 100644 --- a/src/neptune/new/types/atoms/integer.py +++ b/src/neptune/types/atoms/integer.py @@ -22,10 +22,10 @@ ) from neptune.internal.utils.stringify_value import extract_if_stringify_value -from neptune.new.types.atoms.atom import Atom +from neptune.types.atoms.atom import Atom if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/atoms/string.py b/src/neptune/types/atoms/string.py similarity index 93% rename from src/neptune/new/types/atoms/string.py rename to src/neptune/types/atoms/string.py index db6fcf269..3c6f644ae 100644 --- a/src/neptune/new/types/atoms/string.py +++ b/src/neptune/types/atoms/string.py @@ -26,10 +26,10 @@ is_string, is_stringify_value, ) -from neptune.new.types.atoms.atom import Atom +from neptune.types.atoms.atom import Atom if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/file_set.py b/src/neptune/types/file_set.py similarity index 93% rename from src/neptune/new/types/file_set.py rename to src/neptune/types/file_set.py index 902e48b80..c8ff1fa02 100644 --- a/src/neptune/new/types/file_set.py +++ b/src/neptune/types/file_set.py @@ -29,10 +29,10 @@ verify_collection_type, verify_type, ) -from neptune.new.types.value import Value +from neptune.types.value import Value if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/mode.py b/src/neptune/types/mode.py similarity index 100% rename from src/neptune/new/types/mode.py rename to src/neptune/types/mode.py diff --git a/src/neptune/new/types/model_version_stage.py b/src/neptune/types/model_version_stage.py similarity index 100% rename from src/neptune/new/types/model_version_stage.py rename to src/neptune/types/model_version_stage.py diff --git a/src/neptune/new/types/namespace.py b/src/neptune/types/namespace.py similarity index 91% rename from src/neptune/new/types/namespace.py rename to src/neptune/types/namespace.py index 70d9e7d90..83077e3ba 100644 --- a/src/neptune/new/types/namespace.py +++ b/src/neptune/types/namespace.py @@ -21,10 +21,10 @@ TypeVar, ) -from neptune.new.types.value import Value +from neptune.types.value import Value if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/series/__init__.py b/src/neptune/types/series/__init__.py similarity index 100% rename from src/neptune/new/types/series/__init__.py rename to src/neptune/types/series/__init__.py diff --git a/src/neptune/new/types/series/file_series.py b/src/neptune/types/series/file_series.py similarity index 91% rename from src/neptune/new/types/series/file_series.py rename to src/neptune/types/series/file_series.py index 78243cb3e..1f6f642ef 100644 --- a/src/neptune/new/types/series/file_series.py +++ b/src/neptune/types/series/file_series.py @@ -24,11 +24,11 @@ from neptune.internal.utils import is_collection from neptune.internal.utils.logger import logger from neptune.internal.utils.stringify_value import extract_if_stringify_value -from neptune.new.types import File -from neptune.new.types.series.series import Series +from neptune.types import File +from neptune.types.series.series import Series if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/series/float_series.py b/src/neptune/types/series/float_series.py similarity index 94% rename from src/neptune/new/types/series/float_series.py rename to src/neptune/types/series/float_series.py index 84d62a2d7..f90cf8306 100644 --- a/src/neptune/new/types/series/float_series.py +++ b/src/neptune/types/series/float_series.py @@ -24,10 +24,10 @@ from neptune.internal.utils import is_collection from neptune.internal.utils.stringify_value import extract_if_stringify_value -from neptune.new.types.series.series import Series +from neptune.types.series.series import Series if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/series/series.py b/src/neptune/types/series/series.py similarity index 90% rename from src/neptune/new/types/series/series.py rename to src/neptune/types/series/series.py index d484c82ee..911e15faf 100644 --- a/src/neptune/new/types/series/series.py +++ b/src/neptune/types/series/series.py @@ -21,10 +21,10 @@ TypeVar, ) -from neptune.new.types.value import Value +from neptune.types.value import Value if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/series/series_value.py b/src/neptune/types/series/series_value.py similarity index 100% rename from src/neptune/new/types/series/series_value.py rename to src/neptune/types/series/series_value.py diff --git a/src/neptune/new/types/series/string_series.py b/src/neptune/types/series/string_series.py similarity index 94% rename from src/neptune/new/types/series/string_series.py rename to src/neptune/types/series/string_series.py index be55b15cc..e2aed73a8 100644 --- a/src/neptune/new/types/series/string_series.py +++ b/src/neptune/types/series/string_series.py @@ -25,10 +25,10 @@ is_collection, is_stringify_value, ) -from neptune.new.types.series.series import Series +from neptune.types.series.series import Series if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/sets/__init__.py b/src/neptune/types/sets/__init__.py similarity index 100% rename from src/neptune/new/types/sets/__init__.py rename to src/neptune/types/sets/__init__.py diff --git a/src/neptune/new/types/sets/set.py b/src/neptune/types/sets/set.py similarity index 89% rename from src/neptune/new/types/sets/set.py rename to src/neptune/types/sets/set.py index 0d99002ec..15715f206 100644 --- a/src/neptune/new/types/sets/set.py +++ b/src/neptune/types/sets/set.py @@ -21,10 +21,10 @@ TypeVar, ) -from neptune.new.types.value import Value +from neptune.types.value import Value if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/sets/string_set.py b/src/neptune/types/sets/string_set.py similarity index 90% rename from src/neptune/new/types/sets/string_set.py rename to src/neptune/types/sets/string_set.py index 8a07b8462..6e945c2e5 100644 --- a/src/neptune/new/types/sets/string_set.py +++ b/src/neptune/types/sets/string_set.py @@ -21,10 +21,10 @@ TypeVar, ) -from neptune.new.types.sets.set import Set +from neptune.types.sets.set import Set if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/type_casting.py b/src/neptune/types/type_casting.py similarity index 90% rename from src/neptune/new/types/type_casting.py rename to src/neptune/types/type_casting.py index fb9ab305f..ed753583c 100644 --- a/src/neptune/new/types/type_casting.py +++ b/src/neptune/types/type_casting.py @@ -34,23 +34,23 @@ is_string_like, is_stringify_value, ) -from neptune.new.types import ( +from neptune.types import ( Boolean, File, Integer, ) -from neptune.new.types.atoms.datetime import Datetime -from neptune.new.types.atoms.float import Float -from neptune.new.types.atoms.string import String -from neptune.new.types.namespace import Namespace -from neptune.new.types.series import ( +from neptune.types.atoms.datetime import Datetime +from neptune.types.atoms.float import Float +from neptune.types.atoms.string import String +from neptune.types.namespace import Namespace +from neptune.types.series import ( FileSeries, FloatSeries, StringSeries, ) -from neptune.new.types.series.series import Series -from neptune.new.types.value import Value -from neptune.new.types.value_copy import ValueCopy +from neptune.types.series.series import Series +from neptune.types.value import Value +from neptune.types.value_copy import ValueCopy def cast_value(value: Any) -> Value: diff --git a/src/neptune/new/types/value.py b/src/neptune/types/value.py similarity index 93% rename from src/neptune/new/types/value.py rename to src/neptune/types/value.py index c0853ffa0..c98affb5d 100644 --- a/src/neptune/new/types/value.py +++ b/src/neptune/types/value.py @@ -22,7 +22,7 @@ ) if TYPE_CHECKING: - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/value_copy.py b/src/neptune/types/value_copy.py similarity index 93% rename from src/neptune/new/types/value_copy.py rename to src/neptune/types/value_copy.py index fd1b43542..5eaddfbd4 100644 --- a/src/neptune/new/types/value_copy.py +++ b/src/neptune/types/value_copy.py @@ -22,11 +22,11 @@ ) from neptune.internal.utils.paths import parse_path -from neptune.new.types.value import Value +from neptune.types.value import Value if TYPE_CHECKING: from neptune.metadata_containers import Handler - from neptune.new.types.value_visitor import ValueVisitor + from neptune.types.value_visitor import ValueVisitor Ret = TypeVar("Ret") diff --git a/src/neptune/new/types/value_visitor.py b/src/neptune/types/value_visitor.py similarity index 74% rename from src/neptune/new/types/value_visitor.py rename to src/neptune/types/value_visitor.py index dab5e8dd5..b78a7a0e2 100644 --- a/src/neptune/new/types/value_visitor.py +++ b/src/neptune/types/value_visitor.py @@ -23,21 +23,21 @@ ) from neptune.attributes.attribute import Attribute -from neptune.new.types.atoms import GitRef -from neptune.new.types.atoms.artifact import Artifact -from neptune.new.types.atoms.boolean import Boolean -from neptune.new.types.atoms.datetime import Datetime -from neptune.new.types.atoms.file import File -from neptune.new.types.atoms.float import Float -from neptune.new.types.atoms.integer import Integer -from neptune.new.types.atoms.string import String -from neptune.new.types.file_set import FileSet -from neptune.new.types.namespace import Namespace -from neptune.new.types.series.file_series import FileSeries -from neptune.new.types.series.float_series import FloatSeries -from neptune.new.types.series.string_series import StringSeries -from neptune.new.types.sets.string_set import StringSet -from neptune.new.types.value import Value +from neptune.types.atoms import GitRef +from neptune.types.atoms.artifact import Artifact +from neptune.types.atoms.boolean import Boolean +from neptune.types.atoms.datetime import Datetime +from neptune.types.atoms.file import File +from neptune.types.atoms.float import Float +from neptune.types.atoms.integer import Integer +from neptune.types.atoms.string import String +from neptune.types.file_set import FileSet +from neptune.types.namespace import Namespace +from neptune.types.series.file_series import FileSeries +from neptune.types.series.float_series import FloatSeries +from neptune.types.series.string_series import StringSeries +from neptune.types.sets.string_set import StringSet +from neptune.types.value import Value Ret = TypeVar("Ret") From dcac08b35cca9e16b9d84a3d330fb995c0b621dd Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 15:29:02 +0100 Subject: [PATCH 21/33] tests structure --- .../unit/neptune/{new => attributes}/__init__.py | 0 .../attributes => attributes/atoms}/__init__.py | 0 .../{new => }/attributes/atoms/test_artifact.py | 0 .../attributes/atoms/test_artifact_hash.py | 0 .../{new => }/attributes/atoms/test_datetime.py | 0 .../{new => }/attributes/atoms/test_file.py | 0 .../{new => }/attributes/atoms/test_float.py | 0 .../{new => }/attributes/atoms/test_string.py | 0 .../atoms => attributes/series}/__init__.py | 0 .../attributes/series/test_file_series.py | 0 .../attributes/series/test_float_series.py | 0 .../{new => }/attributes/series/test_series.py | 0 .../attributes/series/test_string_series.py | 0 .../series => attributes/sets}/__init__.py | 0 .../{new => }/attributes/sets/test_file_set.py | 0 .../{new => }/attributes/sets/test_string_set.py | 0 .../{new => }/attributes/test_attribute_base.py | 0 .../{new => }/attributes/test_attribute_utils.py | 0 .../unit/neptune/{new => }/backend_test_mixin.py | 0 tests/unit/neptune/{new => }/cli/__init__.py | 0 tests/unit/neptune/{new => }/cli/test_clear.py | 0 tests/unit/neptune/{new => }/cli/test_status.py | 0 tests/unit/neptune/{new => }/cli/test_sync.py | 0 tests/unit/neptune/{new => }/cli/test_utils.py | 0 tests/unit/neptune/{new => }/cli/utils.py | 0 tests/unit/neptune/{new => }/client/__init__.py | 0 .../client/abstract_experiment_test_mixin.py | 0 .../{new => }/client/abstract_tables_test.py | 0 tests/unit/neptune/{new => }/client/test_model.py | 0 .../neptune/{new => }/client/test_model_tables.py | 0 .../{new => }/client/test_model_version.py | 0 .../{new => }/client/test_model_version_tables.py | 0 .../unit/neptune/{new => }/client/test_project.py | 0 tests/unit/neptune/{new => }/client/test_run.py | 0 .../neptune/{new => }/client/test_run_tables.py | 0 .../{new/attributes/sets => internal}/__init__.py | 0 .../{new => }/internal/artifacts/__init__.py | 0 .../internal/artifacts/drivers/__init__.py | 0 .../internal/artifacts/drivers/test_local.py | 0 .../internal/artifacts/drivers/test_s3.py | 0 .../internal/artifacts/test_file_hasher.py | 0 .../internal/artifacts/test_serializer.py | 0 .../{new => }/internal/artifacts/test_types.py | 0 .../neptune/{new => }/internal/artifacts/utils.py | 0 .../internal => internal/backends}/__init__.py | 0 .../backends/test_hosted_artifact_operations.py | 0 .../internal/backends/test_hosted_client.py | 0 .../backends/test_hosted_file_operations.py | 0 .../backends/test_hosted_neptune_backend.py | 0 .../backends/test_neptune_backend_mock.py | 0 .../{new => }/internal/backends/test_nql.py | 0 .../backends/test_operations_preprocessor.py | 0 .../backends/test_swagger_client_wrapper.py | 0 .../{new => }/internal/backends/test_utils.py | 0 .../internal/test_container_structure.py | 0 .../{new => }/internal/test_credentials.py | 0 .../neptune/{new => }/internal/test_disk_queue.py | 0 .../neptune/{new => }/internal/test_operations.py | 0 .../neptune/{new => }/internal/test_streams.py | 0 .../backends => internal/utils}/__init__.py | 0 .../{new => }/internal/utils/test_deprecation.py | 0 .../{new => }/internal/utils/test_images.py | 0 .../{new => }/internal/utils/test_iteration.py | 0 .../internal/utils/test_json_file_splitter.py | 0 .../{new => }/internal/utils/test_utils.py | 0 tests/unit/neptune/new/internal/utils/__init__.py | 15 --------------- tests/unit/neptune/{new => }/test_experiment.py | 0 tests/unit/neptune/{new => }/test_handler.py | 0 tests/unit/neptune/{new => }/test_imports.py | 0 tests/unit/neptune/{new => }/test_log_handler.py | 0 .../{new => }/test_stringify_unsupported.py | 0 tests/unit/neptune/{new => }/types/__init__.py | 0 .../neptune/{new => }/types/atoms/__init__.py | 0 .../neptune/{new => }/types/atoms/test_file.py | 0 .../neptune/{new => }/types/test_file_casting.py | 0 tests/unit/neptune/{new => }/utils/__init__.py | 0 .../{new => }/utils/api_experiments_factory.py | 0 .../unit/neptune/{new => }/utils/file_helpers.py | 0 .../unit/neptune/{new => }/websockets/__init__.py | 0 .../test_websockets_signals_background_job.py | 0 80 files changed, 15 deletions(-) rename tests/unit/neptune/{new => attributes}/__init__.py (100%) rename tests/unit/neptune/{new/attributes => attributes/atoms}/__init__.py (100%) rename tests/unit/neptune/{new => }/attributes/atoms/test_artifact.py (100%) rename tests/unit/neptune/{new => }/attributes/atoms/test_artifact_hash.py (100%) rename tests/unit/neptune/{new => }/attributes/atoms/test_datetime.py (100%) rename tests/unit/neptune/{new => }/attributes/atoms/test_file.py (100%) rename tests/unit/neptune/{new => }/attributes/atoms/test_float.py (100%) rename tests/unit/neptune/{new => }/attributes/atoms/test_string.py (100%) rename tests/unit/neptune/{new/attributes/atoms => attributes/series}/__init__.py (100%) rename tests/unit/neptune/{new => }/attributes/series/test_file_series.py (100%) rename tests/unit/neptune/{new => }/attributes/series/test_float_series.py (100%) rename tests/unit/neptune/{new => }/attributes/series/test_series.py (100%) rename tests/unit/neptune/{new => }/attributes/series/test_string_series.py (100%) rename tests/unit/neptune/{new/attributes/series => attributes/sets}/__init__.py (100%) rename tests/unit/neptune/{new => }/attributes/sets/test_file_set.py (100%) rename tests/unit/neptune/{new => }/attributes/sets/test_string_set.py (100%) rename tests/unit/neptune/{new => }/attributes/test_attribute_base.py (100%) rename tests/unit/neptune/{new => }/attributes/test_attribute_utils.py (100%) rename tests/unit/neptune/{new => }/backend_test_mixin.py (100%) rename tests/unit/neptune/{new => }/cli/__init__.py (100%) rename tests/unit/neptune/{new => }/cli/test_clear.py (100%) rename tests/unit/neptune/{new => }/cli/test_status.py (100%) rename tests/unit/neptune/{new => }/cli/test_sync.py (100%) rename tests/unit/neptune/{new => }/cli/test_utils.py (100%) rename tests/unit/neptune/{new => }/cli/utils.py (100%) rename tests/unit/neptune/{new => }/client/__init__.py (100%) rename tests/unit/neptune/{new => }/client/abstract_experiment_test_mixin.py (100%) rename tests/unit/neptune/{new => }/client/abstract_tables_test.py (100%) rename tests/unit/neptune/{new => }/client/test_model.py (100%) rename tests/unit/neptune/{new => }/client/test_model_tables.py (100%) rename tests/unit/neptune/{new => }/client/test_model_version.py (100%) rename tests/unit/neptune/{new => }/client/test_model_version_tables.py (100%) rename tests/unit/neptune/{new => }/client/test_project.py (100%) rename tests/unit/neptune/{new => }/client/test_run.py (100%) rename tests/unit/neptune/{new => }/client/test_run_tables.py (100%) rename tests/unit/neptune/{new/attributes/sets => internal}/__init__.py (100%) rename tests/unit/neptune/{new => }/internal/artifacts/__init__.py (100%) rename tests/unit/neptune/{new => }/internal/artifacts/drivers/__init__.py (100%) rename tests/unit/neptune/{new => }/internal/artifacts/drivers/test_local.py (100%) rename tests/unit/neptune/{new => }/internal/artifacts/drivers/test_s3.py (100%) rename tests/unit/neptune/{new => }/internal/artifacts/test_file_hasher.py (100%) rename tests/unit/neptune/{new => }/internal/artifacts/test_serializer.py (100%) rename tests/unit/neptune/{new => }/internal/artifacts/test_types.py (100%) rename tests/unit/neptune/{new => }/internal/artifacts/utils.py (100%) rename tests/unit/neptune/{new/internal => internal/backends}/__init__.py (100%) rename tests/unit/neptune/{new => }/internal/backends/test_hosted_artifact_operations.py (100%) rename tests/unit/neptune/{new => }/internal/backends/test_hosted_client.py (100%) rename tests/unit/neptune/{new => }/internal/backends/test_hosted_file_operations.py (100%) rename tests/unit/neptune/{new => }/internal/backends/test_hosted_neptune_backend.py (100%) rename tests/unit/neptune/{new => }/internal/backends/test_neptune_backend_mock.py (100%) rename tests/unit/neptune/{new => }/internal/backends/test_nql.py (100%) rename tests/unit/neptune/{new => }/internal/backends/test_operations_preprocessor.py (100%) rename tests/unit/neptune/{new => }/internal/backends/test_swagger_client_wrapper.py (100%) rename tests/unit/neptune/{new => }/internal/backends/test_utils.py (100%) rename tests/unit/neptune/{new => }/internal/test_container_structure.py (100%) rename tests/unit/neptune/{new => }/internal/test_credentials.py (100%) rename tests/unit/neptune/{new => }/internal/test_disk_queue.py (100%) rename tests/unit/neptune/{new => }/internal/test_operations.py (100%) rename tests/unit/neptune/{new => }/internal/test_streams.py (100%) rename tests/unit/neptune/{new/internal/backends => internal/utils}/__init__.py (100%) rename tests/unit/neptune/{new => }/internal/utils/test_deprecation.py (100%) rename tests/unit/neptune/{new => }/internal/utils/test_images.py (100%) rename tests/unit/neptune/{new => }/internal/utils/test_iteration.py (100%) rename tests/unit/neptune/{new => }/internal/utils/test_json_file_splitter.py (100%) rename tests/unit/neptune/{new => }/internal/utils/test_utils.py (100%) delete mode 100644 tests/unit/neptune/new/internal/utils/__init__.py rename tests/unit/neptune/{new => }/test_experiment.py (100%) rename tests/unit/neptune/{new => }/test_handler.py (100%) rename tests/unit/neptune/{new => }/test_imports.py (100%) rename tests/unit/neptune/{new => }/test_log_handler.py (100%) rename tests/unit/neptune/{new => }/test_stringify_unsupported.py (100%) rename tests/unit/neptune/{new => }/types/__init__.py (100%) rename tests/unit/neptune/{new => }/types/atoms/__init__.py (100%) rename tests/unit/neptune/{new => }/types/atoms/test_file.py (100%) rename tests/unit/neptune/{new => }/types/test_file_casting.py (100%) rename tests/unit/neptune/{new => }/utils/__init__.py (100%) rename tests/unit/neptune/{new => }/utils/api_experiments_factory.py (100%) rename tests/unit/neptune/{new => }/utils/file_helpers.py (100%) rename tests/unit/neptune/{new => }/websockets/__init__.py (100%) rename tests/unit/neptune/{new => }/websockets/test_websockets_signals_background_job.py (100%) diff --git a/tests/unit/neptune/new/__init__.py b/tests/unit/neptune/attributes/__init__.py similarity index 100% rename from tests/unit/neptune/new/__init__.py rename to tests/unit/neptune/attributes/__init__.py diff --git a/tests/unit/neptune/new/attributes/__init__.py b/tests/unit/neptune/attributes/atoms/__init__.py similarity index 100% rename from tests/unit/neptune/new/attributes/__init__.py rename to tests/unit/neptune/attributes/atoms/__init__.py diff --git a/tests/unit/neptune/new/attributes/atoms/test_artifact.py b/tests/unit/neptune/attributes/atoms/test_artifact.py similarity index 100% rename from tests/unit/neptune/new/attributes/atoms/test_artifact.py rename to tests/unit/neptune/attributes/atoms/test_artifact.py diff --git a/tests/unit/neptune/new/attributes/atoms/test_artifact_hash.py b/tests/unit/neptune/attributes/atoms/test_artifact_hash.py similarity index 100% rename from tests/unit/neptune/new/attributes/atoms/test_artifact_hash.py rename to tests/unit/neptune/attributes/atoms/test_artifact_hash.py diff --git a/tests/unit/neptune/new/attributes/atoms/test_datetime.py b/tests/unit/neptune/attributes/atoms/test_datetime.py similarity index 100% rename from tests/unit/neptune/new/attributes/atoms/test_datetime.py rename to tests/unit/neptune/attributes/atoms/test_datetime.py diff --git a/tests/unit/neptune/new/attributes/atoms/test_file.py b/tests/unit/neptune/attributes/atoms/test_file.py similarity index 100% rename from tests/unit/neptune/new/attributes/atoms/test_file.py rename to tests/unit/neptune/attributes/atoms/test_file.py diff --git a/tests/unit/neptune/new/attributes/atoms/test_float.py b/tests/unit/neptune/attributes/atoms/test_float.py similarity index 100% rename from tests/unit/neptune/new/attributes/atoms/test_float.py rename to tests/unit/neptune/attributes/atoms/test_float.py diff --git a/tests/unit/neptune/new/attributes/atoms/test_string.py b/tests/unit/neptune/attributes/atoms/test_string.py similarity index 100% rename from tests/unit/neptune/new/attributes/atoms/test_string.py rename to tests/unit/neptune/attributes/atoms/test_string.py diff --git a/tests/unit/neptune/new/attributes/atoms/__init__.py b/tests/unit/neptune/attributes/series/__init__.py similarity index 100% rename from tests/unit/neptune/new/attributes/atoms/__init__.py rename to tests/unit/neptune/attributes/series/__init__.py diff --git a/tests/unit/neptune/new/attributes/series/test_file_series.py b/tests/unit/neptune/attributes/series/test_file_series.py similarity index 100% rename from tests/unit/neptune/new/attributes/series/test_file_series.py rename to tests/unit/neptune/attributes/series/test_file_series.py diff --git a/tests/unit/neptune/new/attributes/series/test_float_series.py b/tests/unit/neptune/attributes/series/test_float_series.py similarity index 100% rename from tests/unit/neptune/new/attributes/series/test_float_series.py rename to tests/unit/neptune/attributes/series/test_float_series.py diff --git a/tests/unit/neptune/new/attributes/series/test_series.py b/tests/unit/neptune/attributes/series/test_series.py similarity index 100% rename from tests/unit/neptune/new/attributes/series/test_series.py rename to tests/unit/neptune/attributes/series/test_series.py diff --git a/tests/unit/neptune/new/attributes/series/test_string_series.py b/tests/unit/neptune/attributes/series/test_string_series.py similarity index 100% rename from tests/unit/neptune/new/attributes/series/test_string_series.py rename to tests/unit/neptune/attributes/series/test_string_series.py diff --git a/tests/unit/neptune/new/attributes/series/__init__.py b/tests/unit/neptune/attributes/sets/__init__.py similarity index 100% rename from tests/unit/neptune/new/attributes/series/__init__.py rename to tests/unit/neptune/attributes/sets/__init__.py diff --git a/tests/unit/neptune/new/attributes/sets/test_file_set.py b/tests/unit/neptune/attributes/sets/test_file_set.py similarity index 100% rename from tests/unit/neptune/new/attributes/sets/test_file_set.py rename to tests/unit/neptune/attributes/sets/test_file_set.py diff --git a/tests/unit/neptune/new/attributes/sets/test_string_set.py b/tests/unit/neptune/attributes/sets/test_string_set.py similarity index 100% rename from tests/unit/neptune/new/attributes/sets/test_string_set.py rename to tests/unit/neptune/attributes/sets/test_string_set.py diff --git a/tests/unit/neptune/new/attributes/test_attribute_base.py b/tests/unit/neptune/attributes/test_attribute_base.py similarity index 100% rename from tests/unit/neptune/new/attributes/test_attribute_base.py rename to tests/unit/neptune/attributes/test_attribute_base.py diff --git a/tests/unit/neptune/new/attributes/test_attribute_utils.py b/tests/unit/neptune/attributes/test_attribute_utils.py similarity index 100% rename from tests/unit/neptune/new/attributes/test_attribute_utils.py rename to tests/unit/neptune/attributes/test_attribute_utils.py diff --git a/tests/unit/neptune/new/backend_test_mixin.py b/tests/unit/neptune/backend_test_mixin.py similarity index 100% rename from tests/unit/neptune/new/backend_test_mixin.py rename to tests/unit/neptune/backend_test_mixin.py diff --git a/tests/unit/neptune/new/cli/__init__.py b/tests/unit/neptune/cli/__init__.py similarity index 100% rename from tests/unit/neptune/new/cli/__init__.py rename to tests/unit/neptune/cli/__init__.py diff --git a/tests/unit/neptune/new/cli/test_clear.py b/tests/unit/neptune/cli/test_clear.py similarity index 100% rename from tests/unit/neptune/new/cli/test_clear.py rename to tests/unit/neptune/cli/test_clear.py diff --git a/tests/unit/neptune/new/cli/test_status.py b/tests/unit/neptune/cli/test_status.py similarity index 100% rename from tests/unit/neptune/new/cli/test_status.py rename to tests/unit/neptune/cli/test_status.py diff --git a/tests/unit/neptune/new/cli/test_sync.py b/tests/unit/neptune/cli/test_sync.py similarity index 100% rename from tests/unit/neptune/new/cli/test_sync.py rename to tests/unit/neptune/cli/test_sync.py diff --git a/tests/unit/neptune/new/cli/test_utils.py b/tests/unit/neptune/cli/test_utils.py similarity index 100% rename from tests/unit/neptune/new/cli/test_utils.py rename to tests/unit/neptune/cli/test_utils.py diff --git a/tests/unit/neptune/new/cli/utils.py b/tests/unit/neptune/cli/utils.py similarity index 100% rename from tests/unit/neptune/new/cli/utils.py rename to tests/unit/neptune/cli/utils.py diff --git a/tests/unit/neptune/new/client/__init__.py b/tests/unit/neptune/client/__init__.py similarity index 100% rename from tests/unit/neptune/new/client/__init__.py rename to tests/unit/neptune/client/__init__.py diff --git a/tests/unit/neptune/new/client/abstract_experiment_test_mixin.py b/tests/unit/neptune/client/abstract_experiment_test_mixin.py similarity index 100% rename from tests/unit/neptune/new/client/abstract_experiment_test_mixin.py rename to tests/unit/neptune/client/abstract_experiment_test_mixin.py diff --git a/tests/unit/neptune/new/client/abstract_tables_test.py b/tests/unit/neptune/client/abstract_tables_test.py similarity index 100% rename from tests/unit/neptune/new/client/abstract_tables_test.py rename to tests/unit/neptune/client/abstract_tables_test.py diff --git a/tests/unit/neptune/new/client/test_model.py b/tests/unit/neptune/client/test_model.py similarity index 100% rename from tests/unit/neptune/new/client/test_model.py rename to tests/unit/neptune/client/test_model.py diff --git a/tests/unit/neptune/new/client/test_model_tables.py b/tests/unit/neptune/client/test_model_tables.py similarity index 100% rename from tests/unit/neptune/new/client/test_model_tables.py rename to tests/unit/neptune/client/test_model_tables.py diff --git a/tests/unit/neptune/new/client/test_model_version.py b/tests/unit/neptune/client/test_model_version.py similarity index 100% rename from tests/unit/neptune/new/client/test_model_version.py rename to tests/unit/neptune/client/test_model_version.py diff --git a/tests/unit/neptune/new/client/test_model_version_tables.py b/tests/unit/neptune/client/test_model_version_tables.py similarity index 100% rename from tests/unit/neptune/new/client/test_model_version_tables.py rename to tests/unit/neptune/client/test_model_version_tables.py diff --git a/tests/unit/neptune/new/client/test_project.py b/tests/unit/neptune/client/test_project.py similarity index 100% rename from tests/unit/neptune/new/client/test_project.py rename to tests/unit/neptune/client/test_project.py diff --git a/tests/unit/neptune/new/client/test_run.py b/tests/unit/neptune/client/test_run.py similarity index 100% rename from tests/unit/neptune/new/client/test_run.py rename to tests/unit/neptune/client/test_run.py diff --git a/tests/unit/neptune/new/client/test_run_tables.py b/tests/unit/neptune/client/test_run_tables.py similarity index 100% rename from tests/unit/neptune/new/client/test_run_tables.py rename to tests/unit/neptune/client/test_run_tables.py diff --git a/tests/unit/neptune/new/attributes/sets/__init__.py b/tests/unit/neptune/internal/__init__.py similarity index 100% rename from tests/unit/neptune/new/attributes/sets/__init__.py rename to tests/unit/neptune/internal/__init__.py diff --git a/tests/unit/neptune/new/internal/artifacts/__init__.py b/tests/unit/neptune/internal/artifacts/__init__.py similarity index 100% rename from tests/unit/neptune/new/internal/artifacts/__init__.py rename to tests/unit/neptune/internal/artifacts/__init__.py diff --git a/tests/unit/neptune/new/internal/artifacts/drivers/__init__.py b/tests/unit/neptune/internal/artifacts/drivers/__init__.py similarity index 100% rename from tests/unit/neptune/new/internal/artifacts/drivers/__init__.py rename to tests/unit/neptune/internal/artifacts/drivers/__init__.py diff --git a/tests/unit/neptune/new/internal/artifacts/drivers/test_local.py b/tests/unit/neptune/internal/artifacts/drivers/test_local.py similarity index 100% rename from tests/unit/neptune/new/internal/artifacts/drivers/test_local.py rename to tests/unit/neptune/internal/artifacts/drivers/test_local.py diff --git a/tests/unit/neptune/new/internal/artifacts/drivers/test_s3.py b/tests/unit/neptune/internal/artifacts/drivers/test_s3.py similarity index 100% rename from tests/unit/neptune/new/internal/artifacts/drivers/test_s3.py rename to tests/unit/neptune/internal/artifacts/drivers/test_s3.py diff --git a/tests/unit/neptune/new/internal/artifacts/test_file_hasher.py b/tests/unit/neptune/internal/artifacts/test_file_hasher.py similarity index 100% rename from tests/unit/neptune/new/internal/artifacts/test_file_hasher.py rename to tests/unit/neptune/internal/artifacts/test_file_hasher.py diff --git a/tests/unit/neptune/new/internal/artifacts/test_serializer.py b/tests/unit/neptune/internal/artifacts/test_serializer.py similarity index 100% rename from tests/unit/neptune/new/internal/artifacts/test_serializer.py rename to tests/unit/neptune/internal/artifacts/test_serializer.py diff --git a/tests/unit/neptune/new/internal/artifacts/test_types.py b/tests/unit/neptune/internal/artifacts/test_types.py similarity index 100% rename from tests/unit/neptune/new/internal/artifacts/test_types.py rename to tests/unit/neptune/internal/artifacts/test_types.py diff --git a/tests/unit/neptune/new/internal/artifacts/utils.py b/tests/unit/neptune/internal/artifacts/utils.py similarity index 100% rename from tests/unit/neptune/new/internal/artifacts/utils.py rename to tests/unit/neptune/internal/artifacts/utils.py diff --git a/tests/unit/neptune/new/internal/__init__.py b/tests/unit/neptune/internal/backends/__init__.py similarity index 100% rename from tests/unit/neptune/new/internal/__init__.py rename to tests/unit/neptune/internal/backends/__init__.py diff --git a/tests/unit/neptune/new/internal/backends/test_hosted_artifact_operations.py b/tests/unit/neptune/internal/backends/test_hosted_artifact_operations.py similarity index 100% rename from tests/unit/neptune/new/internal/backends/test_hosted_artifact_operations.py rename to tests/unit/neptune/internal/backends/test_hosted_artifact_operations.py diff --git a/tests/unit/neptune/new/internal/backends/test_hosted_client.py b/tests/unit/neptune/internal/backends/test_hosted_client.py similarity index 100% rename from tests/unit/neptune/new/internal/backends/test_hosted_client.py rename to tests/unit/neptune/internal/backends/test_hosted_client.py diff --git a/tests/unit/neptune/new/internal/backends/test_hosted_file_operations.py b/tests/unit/neptune/internal/backends/test_hosted_file_operations.py similarity index 100% rename from tests/unit/neptune/new/internal/backends/test_hosted_file_operations.py rename to tests/unit/neptune/internal/backends/test_hosted_file_operations.py diff --git a/tests/unit/neptune/new/internal/backends/test_hosted_neptune_backend.py b/tests/unit/neptune/internal/backends/test_hosted_neptune_backend.py similarity index 100% rename from tests/unit/neptune/new/internal/backends/test_hosted_neptune_backend.py rename to tests/unit/neptune/internal/backends/test_hosted_neptune_backend.py diff --git a/tests/unit/neptune/new/internal/backends/test_neptune_backend_mock.py b/tests/unit/neptune/internal/backends/test_neptune_backend_mock.py similarity index 100% rename from tests/unit/neptune/new/internal/backends/test_neptune_backend_mock.py rename to tests/unit/neptune/internal/backends/test_neptune_backend_mock.py diff --git a/tests/unit/neptune/new/internal/backends/test_nql.py b/tests/unit/neptune/internal/backends/test_nql.py similarity index 100% rename from tests/unit/neptune/new/internal/backends/test_nql.py rename to tests/unit/neptune/internal/backends/test_nql.py diff --git a/tests/unit/neptune/new/internal/backends/test_operations_preprocessor.py b/tests/unit/neptune/internal/backends/test_operations_preprocessor.py similarity index 100% rename from tests/unit/neptune/new/internal/backends/test_operations_preprocessor.py rename to tests/unit/neptune/internal/backends/test_operations_preprocessor.py diff --git a/tests/unit/neptune/new/internal/backends/test_swagger_client_wrapper.py b/tests/unit/neptune/internal/backends/test_swagger_client_wrapper.py similarity index 100% rename from tests/unit/neptune/new/internal/backends/test_swagger_client_wrapper.py rename to tests/unit/neptune/internal/backends/test_swagger_client_wrapper.py diff --git a/tests/unit/neptune/new/internal/backends/test_utils.py b/tests/unit/neptune/internal/backends/test_utils.py similarity index 100% rename from tests/unit/neptune/new/internal/backends/test_utils.py rename to tests/unit/neptune/internal/backends/test_utils.py diff --git a/tests/unit/neptune/new/internal/test_container_structure.py b/tests/unit/neptune/internal/test_container_structure.py similarity index 100% rename from tests/unit/neptune/new/internal/test_container_structure.py rename to tests/unit/neptune/internal/test_container_structure.py diff --git a/tests/unit/neptune/new/internal/test_credentials.py b/tests/unit/neptune/internal/test_credentials.py similarity index 100% rename from tests/unit/neptune/new/internal/test_credentials.py rename to tests/unit/neptune/internal/test_credentials.py diff --git a/tests/unit/neptune/new/internal/test_disk_queue.py b/tests/unit/neptune/internal/test_disk_queue.py similarity index 100% rename from tests/unit/neptune/new/internal/test_disk_queue.py rename to tests/unit/neptune/internal/test_disk_queue.py diff --git a/tests/unit/neptune/new/internal/test_operations.py b/tests/unit/neptune/internal/test_operations.py similarity index 100% rename from tests/unit/neptune/new/internal/test_operations.py rename to tests/unit/neptune/internal/test_operations.py diff --git a/tests/unit/neptune/new/internal/test_streams.py b/tests/unit/neptune/internal/test_streams.py similarity index 100% rename from tests/unit/neptune/new/internal/test_streams.py rename to tests/unit/neptune/internal/test_streams.py diff --git a/tests/unit/neptune/new/internal/backends/__init__.py b/tests/unit/neptune/internal/utils/__init__.py similarity index 100% rename from tests/unit/neptune/new/internal/backends/__init__.py rename to tests/unit/neptune/internal/utils/__init__.py diff --git a/tests/unit/neptune/new/internal/utils/test_deprecation.py b/tests/unit/neptune/internal/utils/test_deprecation.py similarity index 100% rename from tests/unit/neptune/new/internal/utils/test_deprecation.py rename to tests/unit/neptune/internal/utils/test_deprecation.py diff --git a/tests/unit/neptune/new/internal/utils/test_images.py b/tests/unit/neptune/internal/utils/test_images.py similarity index 100% rename from tests/unit/neptune/new/internal/utils/test_images.py rename to tests/unit/neptune/internal/utils/test_images.py diff --git a/tests/unit/neptune/new/internal/utils/test_iteration.py b/tests/unit/neptune/internal/utils/test_iteration.py similarity index 100% rename from tests/unit/neptune/new/internal/utils/test_iteration.py rename to tests/unit/neptune/internal/utils/test_iteration.py diff --git a/tests/unit/neptune/new/internal/utils/test_json_file_splitter.py b/tests/unit/neptune/internal/utils/test_json_file_splitter.py similarity index 100% rename from tests/unit/neptune/new/internal/utils/test_json_file_splitter.py rename to tests/unit/neptune/internal/utils/test_json_file_splitter.py diff --git a/tests/unit/neptune/new/internal/utils/test_utils.py b/tests/unit/neptune/internal/utils/test_utils.py similarity index 100% rename from tests/unit/neptune/new/internal/utils/test_utils.py rename to tests/unit/neptune/internal/utils/test_utils.py diff --git a/tests/unit/neptune/new/internal/utils/__init__.py b/tests/unit/neptune/new/internal/utils/__init__.py deleted file mode 100644 index 63b30720b..000000000 --- a/tests/unit/neptune/new/internal/utils/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -# Copyright (c) 2020, Neptune Labs Sp. z o.o. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/tests/unit/neptune/new/test_experiment.py b/tests/unit/neptune/test_experiment.py similarity index 100% rename from tests/unit/neptune/new/test_experiment.py rename to tests/unit/neptune/test_experiment.py diff --git a/tests/unit/neptune/new/test_handler.py b/tests/unit/neptune/test_handler.py similarity index 100% rename from tests/unit/neptune/new/test_handler.py rename to tests/unit/neptune/test_handler.py diff --git a/tests/unit/neptune/new/test_imports.py b/tests/unit/neptune/test_imports.py similarity index 100% rename from tests/unit/neptune/new/test_imports.py rename to tests/unit/neptune/test_imports.py diff --git a/tests/unit/neptune/new/test_log_handler.py b/tests/unit/neptune/test_log_handler.py similarity index 100% rename from tests/unit/neptune/new/test_log_handler.py rename to tests/unit/neptune/test_log_handler.py diff --git a/tests/unit/neptune/new/test_stringify_unsupported.py b/tests/unit/neptune/test_stringify_unsupported.py similarity index 100% rename from tests/unit/neptune/new/test_stringify_unsupported.py rename to tests/unit/neptune/test_stringify_unsupported.py diff --git a/tests/unit/neptune/new/types/__init__.py b/tests/unit/neptune/types/__init__.py similarity index 100% rename from tests/unit/neptune/new/types/__init__.py rename to tests/unit/neptune/types/__init__.py diff --git a/tests/unit/neptune/new/types/atoms/__init__.py b/tests/unit/neptune/types/atoms/__init__.py similarity index 100% rename from tests/unit/neptune/new/types/atoms/__init__.py rename to tests/unit/neptune/types/atoms/__init__.py diff --git a/tests/unit/neptune/new/types/atoms/test_file.py b/tests/unit/neptune/types/atoms/test_file.py similarity index 100% rename from tests/unit/neptune/new/types/atoms/test_file.py rename to tests/unit/neptune/types/atoms/test_file.py diff --git a/tests/unit/neptune/new/types/test_file_casting.py b/tests/unit/neptune/types/test_file_casting.py similarity index 100% rename from tests/unit/neptune/new/types/test_file_casting.py rename to tests/unit/neptune/types/test_file_casting.py diff --git a/tests/unit/neptune/new/utils/__init__.py b/tests/unit/neptune/utils/__init__.py similarity index 100% rename from tests/unit/neptune/new/utils/__init__.py rename to tests/unit/neptune/utils/__init__.py diff --git a/tests/unit/neptune/new/utils/api_experiments_factory.py b/tests/unit/neptune/utils/api_experiments_factory.py similarity index 100% rename from tests/unit/neptune/new/utils/api_experiments_factory.py rename to tests/unit/neptune/utils/api_experiments_factory.py diff --git a/tests/unit/neptune/new/utils/file_helpers.py b/tests/unit/neptune/utils/file_helpers.py similarity index 100% rename from tests/unit/neptune/new/utils/file_helpers.py rename to tests/unit/neptune/utils/file_helpers.py diff --git a/tests/unit/neptune/new/websockets/__init__.py b/tests/unit/neptune/websockets/__init__.py similarity index 100% rename from tests/unit/neptune/new/websockets/__init__.py rename to tests/unit/neptune/websockets/__init__.py diff --git a/tests/unit/neptune/new/websockets/test_websockets_signals_background_job.py b/tests/unit/neptune/websockets/test_websockets_signals_background_job.py similarity index 100% rename from tests/unit/neptune/new/websockets/test_websockets_signals_background_job.py rename to tests/unit/neptune/websockets/test_websockets_signals_background_job.py From 2fb93addefcf4daa77342bd9c43a9da8a95145be Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 15:30:25 +0100 Subject: [PATCH 22/33] rename in tests --- tests/e2e/conftest.py | 4 +- tests/e2e/integrations/test_huggingface.py | 2 +- tests/e2e/integrations/test_lightning.py | 2 +- tests/e2e/integrations/test_zenml.py | 2 +- tests/e2e/management/test_management.py | 4 +- tests/e2e/standard/test_artifacts.py | 2 +- tests/e2e/standard/test_base.py | 2 +- tests/e2e/standard/test_cli.py | 6 +- tests/e2e/standard/test_copy.py | 2 +- tests/e2e/standard/test_fetch_tables.py | 4 +- tests/e2e/standard/test_files.py | 12 +- tests/e2e/standard/test_init.py | 8 +- tests/e2e/standard/test_multiple.py | 2 +- tests/e2e/standard/test_series.py | 2 +- tests/e2e/standard/test_stage_transitions.py | 4 +- tests/e2e/utils.py | 4 +- tests/unit/neptune/__init__.py | 15 -- .../neptune/attributes/atoms/test_artifact.py | 16 +-- .../attributes/atoms/test_artifact_hash.py | 8 +- .../neptune/attributes/atoms/test_datetime.py | 6 +- .../neptune/attributes/atoms/test_file.py | 12 +- .../neptune/attributes/atoms/test_float.py | 6 +- .../neptune/attributes/atoms/test_string.py | 6 +- .../attributes/series/test_file_series.py | 16 +-- .../attributes/series/test_float_series.py | 4 +- .../neptune/attributes/series/test_series.py | 8 +- .../attributes/series/test_string_series.py | 4 +- .../neptune/attributes/sets/test_file_set.py | 6 +- .../attributes/sets/test_string_set.py | 6 +- .../neptune/attributes/test_attribute_base.py | 14 +- .../attributes/test_attribute_utils.py | 6 +- tests/unit/neptune/cli/test_clear.py | 12 +- tests/unit/neptune/cli/test_status.py | 10 +- tests/unit/neptune/cli/test_sync.py | 10 +- tests/unit/neptune/cli/test_utils.py | 4 +- tests/unit/neptune/cli/utils.py | 16 +-- .../client/abstract_experiment_test_mixin.py | 2 +- .../neptune/client/abstract_tables_test.py | 16 +-- tests/unit/neptune/client/test_model.py | 32 ++--- .../unit/neptune/client/test_model_tables.py | 8 +- .../unit/neptune/client/test_model_version.py | 36 ++--- .../client/test_model_version_tables.py | 8 +- tests/unit/neptune/client/test_project.py | 22 +-- tests/unit/neptune/client/test_run.py | 54 +++---- tests/unit/neptune/client/test_run_tables.py | 8 +- .../internal/artifacts/drivers/test_local.py | 8 +- .../internal/artifacts/drivers/test_s3.py | 8 +- .../internal/artifacts/test_file_hasher.py | 4 +- .../internal/artifacts/test_serializer.py | 2 +- .../neptune/internal/artifacts/test_types.py | 4 +- .../test_hosted_artifact_operations.py | 36 ++--- .../internal/backends/test_hosted_client.py | 26 ++-- .../backends/test_hosted_file_operations.py | 36 ++--- .../backends/test_hosted_neptune_backend.py | 42 +++--- .../backends/test_neptune_backend_mock.py | 10 +- .../neptune/internal/backends/test_nql.py | 2 +- .../backends/test_operations_preprocessor.py | 8 +- .../backends/test_swagger_client_wrapper.py | 2 +- .../neptune/internal/backends/test_utils.py | 12 +- .../internal/test_container_structure.py | 10 +- .../unit/neptune/internal/test_credentials.py | 4 +- .../unit/neptune/internal/test_disk_queue.py | 2 +- .../unit/neptune/internal/test_operations.py | 4 +- tests/unit/neptune/internal/test_streams.py | 4 +- .../internal/utils/test_deprecation.py | 4 +- .../neptune/internal/utils/test_images.py | 2 +- .../neptune/internal/utils/test_iteration.py | 2 +- .../internal/utils/test_json_file_splitter.py | 4 +- .../unit/neptune/internal/utils/test_utils.py | 2 +- .../legacy/test_alpha_integration_backend.py | 4 +- .../neptune/management/internal/test_api.py | 10 +- tests/unit/neptune/test_experiment.py | 14 +- tests/unit/neptune/test_handler.py | 50 +++---- tests/unit/neptune/test_imports.py | 132 +++++++++--------- tests/unit/neptune/test_log_handler.py | 6 +- .../neptune/test_stringify_unsupported.py | 6 +- tests/unit/neptune/types/atoms/test_file.py | 8 +- tests/unit/neptune/types/test_file_casting.py | 8 +- .../neptune/utils/api_experiments_factory.py | 6 +- .../test_websockets_signals_background_job.py | 6 +- 80 files changed, 453 insertions(+), 468 deletions(-) diff --git a/tests/e2e/conftest.py b/tests/e2e/conftest.py index 17865c43f..4014a7304 100644 --- a/tests/e2e/conftest.py +++ b/tests/e2e/conftest.py @@ -20,14 +20,14 @@ import pytest from faker import Faker +from neptune import init_project +from neptune.internal.utils.s3 import get_boto_s3_client from neptune.management import ( add_project_member, add_project_service_account, create_project, ) from neptune.management.internal.utils import normalize_project_name -from neptune.new import init_project -from neptune.new.internal.utils.s3 import get_boto_s3_client from tests.e2e.utils import ( Environment, RawEnvironment, diff --git a/tests/e2e/integrations/test_huggingface.py b/tests/e2e/integrations/test_huggingface.py index af25561a3..5c5057286 100644 --- a/tests/e2e/integrations/test_huggingface.py +++ b/tests/e2e/integrations/test_huggingface.py @@ -33,7 +33,7 @@ ) from transformers.utils import logging -from neptune.new import init_run +from neptune import init_run from tests.e2e.base import BaseE2ETest from tests.e2e.utils import ( catch_time, diff --git a/tests/e2e/integrations/test_lightning.py b/tests/e2e/integrations/test_lightning.py index dfe585390..519eb935a 100644 --- a/tests/e2e/integrations/test_lightning.py +++ b/tests/e2e/integrations/test_lightning.py @@ -30,7 +30,7 @@ Dataset, ) -import neptune.new as neptune +import neptune from tests.e2e.base import BaseE2ETest LIGHTNING_ECOSYSTEM_ENV_PROJECT = "NEPTUNE_LIGHTNING_ECOSYSTEM_CI_PROJECT" diff --git a/tests/e2e/integrations/test_zenml.py b/tests/e2e/integrations/test_zenml.py index 2fcae4c7d..bc94e0334 100644 --- a/tests/e2e/integrations/test_zenml.py +++ b/tests/e2e/integrations/test_zenml.py @@ -5,7 +5,7 @@ from sklearn.model_selection import train_test_split from sklearn.svm import SVC -import neptune.new as neptune +import neptune from tests.e2e.base import BaseE2ETest zenml = pytest.importorskip("zenml") diff --git a/tests/e2e/management/test_management.py b/tests/e2e/management/test_management.py index a36c293cd..6b128255e 100644 --- a/tests/e2e/management/test_management.py +++ b/tests/e2e/management/test_management.py @@ -18,6 +18,8 @@ import pytest +from neptune import init_model_version +from neptune.internal.container_type import ContainerType from neptune.management import ( add_project_member, add_project_service_account, @@ -34,8 +36,6 @@ ) from neptune.management.exceptions import UserNotExistsOrWithoutAccess from neptune.management.internal.utils import normalize_project_name -from neptune.new import init_model_version -from neptune.new.internal.container_type import ContainerType from tests.e2e.base import ( BaseE2ETest, fake, diff --git a/tests/e2e/standard/test_artifacts.py b/tests/e2e/standard/test_artifacts.py index 3dacd270a..4c0850582 100644 --- a/tests/e2e/standard/test_artifacts.py +++ b/tests/e2e/standard/test_artifacts.py @@ -23,7 +23,7 @@ import pytest -from neptune.new.metadata_containers import MetadataContainer +from neptune.metadata_containers import MetadataContainer from tests.e2e.base import ( AVAILABLE_CONTAINERS, BaseE2ETest, diff --git a/tests/e2e/standard/test_base.py b/tests/e2e/standard/test_base.py index 7bf515ca3..e4b60901c 100644 --- a/tests/e2e/standard/test_base.py +++ b/tests/e2e/standard/test_base.py @@ -21,7 +21,7 @@ import pytest -from neptune.new.metadata_containers import MetadataContainer +from neptune.metadata_containers import MetadataContainer from tests.e2e.base import ( AVAILABLE_CONTAINERS, BaseE2ETest, diff --git a/tests/e2e/standard/test_cli.py b/tests/e2e/standard/test_cli.py index c1aeac6de..d09ac89ca 100644 --- a/tests/e2e/standard/test_cli.py +++ b/tests/e2e/standard/test_cli.py @@ -21,10 +21,10 @@ import pytest from click.testing import CliRunner -import neptune.new as neptune +import neptune +from neptune.cli import sync from neptune.common.exceptions import NeptuneException -from neptune.new.cli import sync -from src.neptune.new.cli.commands import clear +from src.neptune.cli.commands import clear from tests.e2e.base import ( AVAILABLE_CONTAINERS, BaseE2ETest, diff --git a/tests/e2e/standard/test_copy.py b/tests/e2e/standard/test_copy.py index 34f24470d..83e71aedf 100644 --- a/tests/e2e/standard/test_copy.py +++ b/tests/e2e/standard/test_copy.py @@ -18,7 +18,7 @@ import pytest -from neptune.new.metadata_containers import MetadataContainer +from neptune.metadata_containers import MetadataContainer from tests.e2e.base import ( AVAILABLE_CONTAINERS, BaseE2ETest, diff --git a/tests/e2e/standard/test_fetch_tables.py b/tests/e2e/standard/test_fetch_tables.py index ef380c59e..73dcf7486 100644 --- a/tests/e2e/standard/test_fetch_tables.py +++ b/tests/e2e/standard/test_fetch_tables.py @@ -19,8 +19,8 @@ import pytest -import neptune.new as neptune -from neptune.new.metadata_containers import Model +import neptune +from neptune.metadata_containers import Model from tests.e2e.base import ( BaseE2ETest, fake, diff --git a/tests/e2e/standard/test_files.py b/tests/e2e/standard/test_files.py index d424279fc..7aab7e3d4 100644 --- a/tests/e2e/standard/test_files.py +++ b/tests/e2e/standard/test_files.py @@ -24,15 +24,15 @@ import pytest -from neptune.new.internal.backends import hosted_file_operations -from neptune.new.internal.backends.api_model import ( +from neptune.internal.backends import hosted_file_operations +from neptune.internal.backends.api_model import ( MultipartConfig, OptionalFeatures, ) -from neptune.new.internal.backends.hosted_neptune_backend import HostedNeptuneBackend -from neptune.new.internal.types.file_types import FileType -from neptune.new.metadata_containers import MetadataContainer -from neptune.new.types import ( +from neptune.internal.backends.hosted_neptune_backend import HostedNeptuneBackend +from neptune.internal.types.file_types import FileType +from neptune.metadata_containers import MetadataContainer +from neptune.types import ( File, FileSet, ) diff --git a/tests/e2e/standard/test_init.py b/tests/e2e/standard/test_init.py index db56b2c63..acff10ec6 100644 --- a/tests/e2e/standard/test_init.py +++ b/tests/e2e/standard/test_init.py @@ -15,10 +15,10 @@ # import pytest -import neptune.new as neptune -from neptune.new.exceptions import NeptuneModelKeyAlreadyExistsError -from neptune.new.metadata_containers import Model -from neptune.new.project import Project +import neptune +from neptune.exceptions import NeptuneModelKeyAlreadyExistsError +from neptune.metadata_containers import Model +from neptune.project import Project from tests.e2e.base import ( AVAILABLE_CONTAINERS, BaseE2ETest, diff --git a/tests/e2e/standard/test_multiple.py b/tests/e2e/standard/test_multiple.py index 1dc6aff31..90239b2f6 100644 --- a/tests/e2e/standard/test_multiple.py +++ b/tests/e2e/standard/test_multiple.py @@ -18,7 +18,7 @@ import pytest -import neptune.new as neptune +import neptune from tests.e2e.base import ( BaseE2ETest, fake, diff --git a/tests/e2e/standard/test_series.py b/tests/e2e/standard/test_series.py index 59cf4b173..6a6ad40a3 100644 --- a/tests/e2e/standard/test_series.py +++ b/tests/e2e/standard/test_series.py @@ -18,7 +18,7 @@ import pytest from PIL import Image -from neptune.new.metadata_containers import MetadataContainer +from neptune.metadata_containers import MetadataContainer from tests.e2e.base import ( AVAILABLE_CONTAINERS, BaseE2ETest, diff --git a/tests/e2e/standard/test_stage_transitions.py b/tests/e2e/standard/test_stage_transitions.py index 6cc00cd9c..63036831c 100644 --- a/tests/e2e/standard/test_stage_transitions.py +++ b/tests/e2e/standard/test_stage_transitions.py @@ -15,8 +15,8 @@ # import pytest -from neptune.new.exceptions import NeptuneCannotChangeStageManually -from neptune.new.metadata_containers import ModelVersion +from neptune.exceptions import NeptuneCannotChangeStageManually +from neptune.metadata_containers import ModelVersion from tests.e2e.base import BaseE2ETest diff --git a/tests/e2e/utils.py b/tests/e2e/utils.py index 90ea798af..f46d41aa5 100644 --- a/tests/e2e/utils.py +++ b/tests/e2e/utils.py @@ -42,8 +42,8 @@ from PIL import Image from PIL.PngImagePlugin import PngImageFile -import neptune.new as neptune -from neptune.new.internal.container_type import ContainerType +import neptune +from neptune.internal.container_type import ContainerType from tests.e2e.exceptions import MissingEnvironmentVariable diff --git a/tests/unit/neptune/__init__.py b/tests/unit/neptune/__init__.py index 62a86a5be..e69de29bb 100644 --- a/tests/unit/neptune/__init__.py +++ b/tests/unit/neptune/__init__.py @@ -1,15 +0,0 @@ -# -# Copyright (c) 2019, Neptune Labs Sp. z o.o. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/tests/unit/neptune/attributes/atoms/test_artifact.py b/tests/unit/neptune/attributes/atoms/test_artifact.py index 28e604cca..4d62d4ead 100644 --- a/tests/unit/neptune/attributes/atoms/test_artifact.py +++ b/tests/unit/neptune/attributes/atoms/test_artifact.py @@ -24,18 +24,18 @@ call, ) -from neptune.new.attributes.atoms.artifact import Artifact -from neptune.new.exceptions import NeptuneUnhandledArtifactTypeException -from neptune.new.internal.artifacts.types import ( +from neptune.attributes.atoms.artifact import Artifact +from neptune.exceptions import NeptuneUnhandledArtifactTypeException +from neptune.internal.artifacts.types import ( ArtifactDriver, ArtifactDriversMap, ArtifactFileData, ) -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.operation import TrackFilesToArtifact -from neptune.new.internal.utils.paths import path_to_str -from neptune.new.types.atoms.artifact import Artifact as ArtifactAttr -from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase +from neptune.internal.container_type import ContainerType +from neptune.internal.operation import TrackFilesToArtifact +from neptune.internal.utils.paths import path_to_str +from neptune.types.atoms.artifact import Artifact as ArtifactAttr +from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase class TestArtifact(TestAttributeBase): diff --git a/tests/unit/neptune/attributes/atoms/test_artifact_hash.py b/tests/unit/neptune/attributes/atoms/test_artifact_hash.py index d2fe06ad2..926e227c9 100644 --- a/tests/unit/neptune/attributes/atoms/test_artifact_hash.py +++ b/tests/unit/neptune/attributes/atoms/test_artifact_hash.py @@ -15,10 +15,10 @@ # from mock import MagicMock -from neptune.new.attributes.atoms.artifact import Artifact -from neptune.new.internal.operation import AssignArtifact -from neptune.new.types.atoms.artifact import Artifact as ArtifactVal -from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase +from neptune.attributes.atoms.artifact import Artifact +from neptune.internal.operation import AssignArtifact +from neptune.types.atoms.artifact import Artifact as ArtifactVal +from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase class TestArtifactHash(TestAttributeBase): diff --git a/tests/unit/neptune/attributes/atoms/test_datetime.py b/tests/unit/neptune/attributes/atoms/test_datetime.py index 65f48d032..0e16fe700 100644 --- a/tests/unit/neptune/attributes/atoms/test_datetime.py +++ b/tests/unit/neptune/attributes/atoms/test_datetime.py @@ -18,12 +18,12 @@ from mock import MagicMock -from neptune.new.attributes.atoms.datetime import ( +from neptune.attributes.atoms.datetime import ( Datetime, DatetimeVal, ) -from neptune.new.internal.operation import AssignDatetime -from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase +from neptune.internal.operation import AssignDatetime +from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase class TestDatetime(TestAttributeBase): diff --git a/tests/unit/neptune/attributes/atoms/test_file.py b/tests/unit/neptune/attributes/atoms/test_file.py index 6a284b525..fed714fa1 100644 --- a/tests/unit/neptune/attributes/atoms/test_file.py +++ b/tests/unit/neptune/attributes/atoms/test_file.py @@ -24,22 +24,22 @@ from mock import MagicMock -from neptune.common.utils import IS_WINDOWS -from neptune.new.attributes.atoms.file import ( +from neptune.attributes.atoms.file import ( File, FileVal, ) -from neptune.new.attributes.file_set import ( +from neptune.attributes.file_set import ( FileSet, FileSetVal, ) -from neptune.new.internal.operation import ( +from neptune.common.utils import IS_WINDOWS +from neptune.internal.operation import ( UploadFile, UploadFileSet, ) -from neptune.new.internal.types.file_types import FileType +from neptune.internal.types.file_types import FileType from tests.e2e.utils import tmp_context -from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase class TestFile(TestAttributeBase): diff --git a/tests/unit/neptune/attributes/atoms/test_float.py b/tests/unit/neptune/attributes/atoms/test_float.py index 3945d1b67..0c31db2b2 100644 --- a/tests/unit/neptune/attributes/atoms/test_float.py +++ b/tests/unit/neptune/attributes/atoms/test_float.py @@ -15,12 +15,12 @@ # from mock import MagicMock -from neptune.new.attributes.atoms.float import ( +from neptune.attributes.atoms.float import ( Float, FloatVal, ) -from neptune.new.internal.operation import AssignFloat -from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase +from neptune.internal.operation import AssignFloat +from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase class TestFloat(TestAttributeBase): diff --git a/tests/unit/neptune/attributes/atoms/test_string.py b/tests/unit/neptune/attributes/atoms/test_string.py index 555c9e1cf..46dd99f66 100644 --- a/tests/unit/neptune/attributes/atoms/test_string.py +++ b/tests/unit/neptune/attributes/atoms/test_string.py @@ -15,12 +15,12 @@ # from mock import MagicMock -from neptune.new.attributes.atoms.string import ( +from neptune.attributes.atoms.string import ( String, StringVal, ) -from neptune.new.internal.operation import AssignString -from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase +from neptune.internal.operation import AssignString +from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase class TestString(TestAttributeBase): diff --git a/tests/unit/neptune/attributes/series/test_file_series.py b/tests/unit/neptune/attributes/series/test_file_series.py index f400d99a2..a4c0dd6b8 100644 --- a/tests/unit/neptune/attributes/series/test_file_series.py +++ b/tests/unit/neptune/attributes/series/test_file_series.py @@ -24,17 +24,17 @@ patch, ) -from neptune.new.attributes.series.file_series import FileSeries -from neptune.new.exceptions import OperationNotSupported -from neptune.new.internal.operation import ( +from neptune.attributes.series.file_series import FileSeries +from neptune.exceptions import OperationNotSupported +from neptune.internal.operation import ( ClearImageLog, ImageValue, LogImages, ) -from neptune.new.internal.utils import base64_encode -from neptune.new.types import File -from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase -from tests.unit.neptune.new.utils.file_helpers import create_file +from neptune.internal.utils import base64_encode +from neptune.types import File +from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.utils.file_helpers import create_file @patch("time.time", new=TestAttributeBase._now) @@ -212,7 +212,7 @@ def test_assign_raise_not_image(self): with self.assertRaises(OperationNotSupported): attr.assign([stream]) - @mock.patch("neptune.new.internal.utils.limits._LOGGED_IMAGE_SIZE_LIMIT_MB", (10**-3)) + @mock.patch("neptune.internal.utils.limits._LOGGED_IMAGE_SIZE_LIMIT_MB", (10**-3)) def test_image_limit(self): """Test if we prohibit logging images greater than mocked 1KB limit size""" # given diff --git a/tests/unit/neptune/attributes/series/test_float_series.py b/tests/unit/neptune/attributes/series/test_float_series.py index 9922b6e75..7722fd302 100644 --- a/tests/unit/neptune/attributes/series/test_float_series.py +++ b/tests/unit/neptune/attributes/series/test_float_series.py @@ -18,8 +18,8 @@ patch, ) -from neptune.new.attributes.series.float_series import FloatSeries -from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase +from neptune.attributes.series.float_series import FloatSeries +from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase @patch("time.time", new=TestAttributeBase._now) diff --git a/tests/unit/neptune/attributes/series/test_series.py b/tests/unit/neptune/attributes/series/test_series.py index 46e8cd272..4c60ffe3f 100644 --- a/tests/unit/neptune/attributes/series/test_series.py +++ b/tests/unit/neptune/attributes/series/test_series.py @@ -19,21 +19,21 @@ patch, ) -from neptune.new.attributes.series.float_series import ( +from neptune.attributes.series.float_series import ( FloatSeries, FloatSeriesVal, ) -from neptune.new.attributes.series.string_series import ( +from neptune.attributes.series.string_series import ( StringSeries, StringSeriesVal, ) -from neptune.new.internal.operation import ( +from neptune.internal.operation import ( ClearFloatLog, ClearStringLog, ConfigFloatSeries, LogFloats, ) -from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase @patch("time.time", new=TestAttributeBase._now) diff --git a/tests/unit/neptune/attributes/series/test_string_series.py b/tests/unit/neptune/attributes/series/test_string_series.py index 8407dd625..a2df7b1c0 100644 --- a/tests/unit/neptune/attributes/series/test_string_series.py +++ b/tests/unit/neptune/attributes/series/test_string_series.py @@ -18,8 +18,8 @@ patch, ) -from neptune.new.attributes.series.string_series import StringSeries -from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase +from neptune.attributes.series.string_series import StringSeries +from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase @patch("time.time", new=TestAttributeBase._now) diff --git a/tests/unit/neptune/attributes/sets/test_file_set.py b/tests/unit/neptune/attributes/sets/test_file_set.py index 83282deb7..103411729 100644 --- a/tests/unit/neptune/attributes/sets/test_file_set.py +++ b/tests/unit/neptune/attributes/sets/test_file_set.py @@ -17,12 +17,12 @@ from mock import MagicMock -from neptune.new.attributes.file_set import FileSet -from neptune.new.internal.operation import ( +from neptune.attributes.file_set import FileSet +from neptune.internal.operation import ( DeleteFiles, UploadFileSet, ) -from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase class TestFileSet(TestAttributeBase): diff --git a/tests/unit/neptune/attributes/sets/test_string_set.py b/tests/unit/neptune/attributes/sets/test_string_set.py index c7e13802b..c30cfae32 100644 --- a/tests/unit/neptune/attributes/sets/test_string_set.py +++ b/tests/unit/neptune/attributes/sets/test_string_set.py @@ -18,16 +18,16 @@ call, ) -from neptune.new.attributes.sets.string_set import ( +from neptune.attributes.sets.string_set import ( StringSet, StringSetVal, ) -from neptune.new.internal.operation import ( +from neptune.internal.operation import ( AddStrings, ClearStringSet, RemoveStrings, ) -from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase class TestStringSet(TestAttributeBase): diff --git a/tests/unit/neptune/attributes/test_attribute_base.py b/tests/unit/neptune/attributes/test_attribute_base.py index f57e7a916..34ee433c7 100644 --- a/tests/unit/neptune/attributes/test_attribute_base.py +++ b/tests/unit/neptune/attributes/test_attribute_base.py @@ -22,13 +22,13 @@ from mock import MagicMock -from neptune.new.internal.backends.neptune_backend_mock import NeptuneBackendMock -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.id_formats import UniqueId -from neptune.new.internal.operation_processors.operation_processor import OperationProcessor -from neptune.new.internal.operation_processors.sync_operation_processor import SyncOperationProcessor -from neptune.new.metadata_containers import Run -from neptune.new.types.mode import Mode +from neptune.internal.backends.neptune_backend_mock import NeptuneBackendMock +from neptune.internal.container_type import ContainerType +from neptune.internal.id_formats import UniqueId +from neptune.internal.operation_processors.operation_processor import OperationProcessor +from neptune.internal.operation_processors.sync_operation_processor import SyncOperationProcessor +from neptune.metadata_containers import Run +from neptune.types.mode import Mode _now = time.time() diff --git a/tests/unit/neptune/attributes/test_attribute_utils.py b/tests/unit/neptune/attributes/test_attribute_utils.py index 17bd9be44..4bbfc7735 100644 --- a/tests/unit/neptune/attributes/test_attribute_utils.py +++ b/tests/unit/neptune/attributes/test_attribute_utils.py @@ -16,9 +16,9 @@ import unittest from unittest.mock import MagicMock -from neptune.new.attributes import create_attribute_from_type -from neptune.new.attributes.attribute import Attribute -from neptune.new.internal.backends.api_model import AttributeType +from neptune.attributes import create_attribute_from_type +from neptune.attributes.attribute import Attribute +from neptune.internal.backends.api_model import AttributeType class TestAttributeUtils(unittest.TestCase): diff --git a/tests/unit/neptune/cli/test_clear.py b/tests/unit/neptune/cli/test_clear.py index 43a47c028..dfedb89b2 100644 --- a/tests/unit/neptune/cli/test_clear.py +++ b/tests/unit/neptune/cli/test_clear.py @@ -18,16 +18,16 @@ import pytest -from neptune.new.cli.clear import ClearRunner -from neptune.new.cli.utils import get_qualified_name -from neptune.new.constants import ( +from neptune.cli.clear import ClearRunner +from neptune.cli.utils import get_qualified_name +from neptune.constants import ( ASYNC_DIRECTORY, OFFLINE_DIRECTORY, SYNC_DIRECTORY, ) -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.operation import Operation -from tests.unit.neptune.new.cli.utils import ( +from neptune.internal.container_type import ContainerType +from neptune.internal.operation import Operation +from tests.unit.neptune.cli.utils import ( generate_get_metadata_container, prepare_metadata_container, ) diff --git a/tests/unit/neptune/cli/test_status.py b/tests/unit/neptune/cli/test_status.py index ff3f7d437..68809bde3 100644 --- a/tests/unit/neptune/cli/test_status.py +++ b/tests/unit/neptune/cli/test_status.py @@ -17,11 +17,11 @@ import pytest -from neptune.new.cli.status import StatusRunner -from neptune.new.cli.utils import get_qualified_name -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.operation import Operation -from tests.unit.neptune.new.cli.utils import ( +from neptune.cli.status import StatusRunner +from neptune.cli.utils import get_qualified_name +from neptune.internal.container_type import ContainerType +from neptune.internal.operation import Operation +from tests.unit.neptune.cli.utils import ( generate_get_metadata_container, prepare_metadata_container, ) diff --git a/tests/unit/neptune/cli/test_sync.py b/tests/unit/neptune/cli/test_sync.py index 4ed37ea51..7fdaee1c2 100644 --- a/tests/unit/neptune/cli/test_sync.py +++ b/tests/unit/neptune/cli/test_sync.py @@ -18,11 +18,11 @@ import pytest -from neptune.new.cli.sync import SyncRunner -from neptune.new.cli.utils import get_qualified_name -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.operation import Operation -from tests.unit.neptune.new.cli.utils import ( +from neptune.cli.sync import SyncRunner +from neptune.cli.utils import get_qualified_name +from neptune.internal.container_type import ContainerType +from neptune.internal.operation import Operation +from tests.unit.neptune.cli.utils import ( execute_operations, generate_get_metadata_container, prepare_deprecated_run, diff --git a/tests/unit/neptune/cli/test_utils.py b/tests/unit/neptune/cli/test_utils.py index 33835d47f..9b0bdc4a5 100644 --- a/tests/unit/neptune/cli/test_utils.py +++ b/tests/unit/neptune/cli/test_utils.py @@ -19,8 +19,8 @@ import pytest -from neptune.new.cli.utils import get_project -from neptune.new.exceptions import ProjectNotFound +from neptune.cli.utils import get_project +from neptune.exceptions import ProjectNotFound @pytest.fixture(name="backend") diff --git a/tests/unit/neptune/cli/utils.py b/tests/unit/neptune/cli/utils.py index 8874acb94..2ac3b61b5 100644 --- a/tests/unit/neptune/cli/utils.py +++ b/tests/unit/neptune/cli/utils.py @@ -18,17 +18,17 @@ from pathlib import Path from typing import Optional -from neptune.new.cli.utils import get_qualified_name -from neptune.new.constants import ( +from neptune.cli.utils import get_qualified_name +from neptune.constants import ( ASYNC_DIRECTORY, OFFLINE_DIRECTORY, ) -from neptune.new.exceptions import MetadataContainerNotFound -from neptune.new.internal.backends.api_model import ApiExperiment -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.disk_queue import DiskQueue -from neptune.new.internal.utils.sync_offset_file import SyncOffsetFile -from tests.unit.neptune.new.utils.api_experiments_factory import ( +from neptune.exceptions import MetadataContainerNotFound +from neptune.internal.backends.api_model import ApiExperiment +from neptune.internal.container_type import ContainerType +from neptune.internal.disk_queue import DiskQueue +from neptune.internal.utils.sync_offset_file import SyncOffsetFile +from tests.unit.neptune.utils.api_experiments_factory import ( api_metadata_container, api_run, ) diff --git a/tests/unit/neptune/client/abstract_experiment_test_mixin.py b/tests/unit/neptune/client/abstract_experiment_test_mixin.py index 7aab84401..0c4c33a03 100644 --- a/tests/unit/neptune/client/abstract_experiment_test_mixin.py +++ b/tests/unit/neptune/client/abstract_experiment_test_mixin.py @@ -20,7 +20,7 @@ from io import StringIO from unittest.mock import Mock -from neptune.new.exceptions import ( +from neptune.exceptions import ( MetadataInconsistency, MissingFieldException, NeptuneOfflineModeFetchException, diff --git a/tests/unit/neptune/client/abstract_tables_test.py b/tests/unit/neptune/client/abstract_tables_test.py index 61b98794a..680c8b817 100644 --- a/tests/unit/neptune/client/abstract_tables_test.py +++ b/tests/unit/neptune/client/abstract_tables_test.py @@ -24,30 +24,30 @@ patch, ) -from neptune.new import ANONYMOUS -from neptune.new.envs import ( +from neptune import ANONYMOUS +from neptune.envs import ( API_TOKEN_ENV_NAME, PROJECT_ENV_NAME, ) -from neptune.new.exceptions import MetadataInconsistency -from neptune.new.internal.backends.api_model import ( +from neptune.exceptions import MetadataInconsistency +from neptune.internal.backends.api_model import ( Attribute, AttributeType, AttributeWithProperties, LeaderboardEntry, ) -from neptune.new.internal.backends.neptune_backend_mock import NeptuneBackendMock -from neptune.new.metadata_containers.metadata_containers_table import ( +from neptune.internal.backends.neptune_backend_mock import NeptuneBackendMock +from neptune.metadata_containers.metadata_containers_table import ( Table, TableEntry, ) @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes", new=lambda _, _uuid, _type: [Attribute(path="test", type=AttributeType.STRING)], ) -@patch("neptune.new.internal.backends.factory.HostedNeptuneBackend", NeptuneBackendMock) +@patch("neptune.internal.backends.factory.HostedNeptuneBackend", NeptuneBackendMock) class AbstractTablesTestMixin: expected_container_type = None diff --git a/tests/unit/neptune/client/test_model.py b/tests/unit/neptune/client/test_model.py index a0834c81c..93e43c39e 100644 --- a/tests/unit/neptune/client/test_model.py +++ b/tests/unit/neptune/client/test_model.py @@ -18,33 +18,33 @@ from mock import patch -from neptune.common.exceptions import NeptuneException -from neptune.new import ( +from neptune import ( ANONYMOUS, init_model, ) -from neptune.new.attributes import String -from neptune.new.envs import ( +from neptune.attributes import String +from neptune.common.exceptions import NeptuneException +from neptune.envs import ( API_TOKEN_ENV_NAME, PROJECT_ENV_NAME, ) -from neptune.new.exceptions import ( +from neptune.exceptions import ( NeptuneParametersCollision, NeptuneWrongInitParametersException, ) -from neptune.new.internal.backends.api_model import ( +from neptune.internal.backends.api_model import ( Attribute, AttributeType, IntAttribute, ) -from neptune.new.internal.backends.neptune_backend_mock import NeptuneBackendMock -from tests.unit.neptune.new.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin -from tests.unit.neptune.new.utils.api_experiments_factory import api_model +from neptune.internal.backends.neptune_backend_mock import NeptuneBackendMock +from tests.unit.neptune.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin +from tests.unit.neptune.utils.api_experiments_factory import api_model AN_API_MODEL = api_model() -@patch("neptune.new.internal.backends.factory.HostedNeptuneBackend", NeptuneBackendMock) +@patch("neptune.internal.backends.factory.HostedNeptuneBackend", NeptuneBackendMock) class TestClientModel(AbstractExperimentTestMixin, unittest.TestCase): @staticmethod def call_init(**kwargs): @@ -60,15 +60,15 @@ def test_offline_mode(self): init_model(key="MOD", mode="offline") @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_metadata_container", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_metadata_container", new=lambda _, container_id, expected_container_type: AN_API_MODEL, ) @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes", new=lambda _, _uuid, _type: [Attribute("some/variable", AttributeType.INT)], ) @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_int_attribute", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_int_attribute", new=lambda _, _uuid, _type, _path: IntAttribute(42), ) def test_read_only_mode(self): @@ -80,7 +80,7 @@ def test_read_only_mode(self): self.assertEqual( caplog.output, [ - "WARNING:neptune.new.internal.operation_processors.read_only_operation_processor:" + "WARNING:neptune.internal.operation_processors.read_only_operation_processor:" "Client in read-only mode, nothing will be saved to server." ], ) @@ -89,11 +89,11 @@ def test_read_only_mode(self): self.assertNotIn(str(exp._id), os.listdir(".neptune")) @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_metadata_container", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_metadata_container", new=lambda _, container_id, expected_container_type: AN_API_MODEL, ) @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes", new=lambda _, _uuid, _type: [Attribute("test", AttributeType.STRING)], ) def test_resume(self): diff --git a/tests/unit/neptune/client/test_model_tables.py b/tests/unit/neptune/client/test_model_tables.py index 19405426c..750cc9d83 100644 --- a/tests/unit/neptune/client/test_model_tables.py +++ b/tests/unit/neptune/client/test_model_tables.py @@ -17,13 +17,13 @@ import unittest from typing import List -from neptune.new import init_project -from neptune.new.internal.container_type import ContainerType -from neptune.new.metadata_containers.metadata_containers_table import ( +from neptune import init_project +from neptune.internal.container_type import ContainerType +from neptune.metadata_containers.metadata_containers_table import ( Table, TableEntry, ) -from tests.unit.neptune.new.client.abstract_tables_test import AbstractTablesTestMixin +from tests.unit.neptune.client.abstract_tables_test import AbstractTablesTestMixin class TestModelTables(AbstractTablesTestMixin, unittest.TestCase): diff --git a/tests/unit/neptune/client/test_model_version.py b/tests/unit/neptune/client/test_model_version.py index 991484399..56121cd0e 100644 --- a/tests/unit/neptune/client/test_model_version.py +++ b/tests/unit/neptune/client/test_model_version.py @@ -18,31 +18,31 @@ from mock import patch -from neptune.common.exceptions import NeptuneException -from neptune.new import ( +from neptune import ( ANONYMOUS, init_model_version, ) -from neptune.new.attributes import String -from neptune.new.envs import ( +from neptune.attributes import String +from neptune.common.exceptions import NeptuneException +from neptune.envs import ( API_TOKEN_ENV_NAME, PROJECT_ENV_NAME, ) -from neptune.new.exceptions import ( +from neptune.exceptions import ( NeptuneOfflineModeChangeStageException, NeptuneParametersCollision, NeptuneWrongInitParametersException, ) -from neptune.new.internal.backends.api_model import ( +from neptune.internal.backends.api_model import ( Attribute, AttributeType, IntAttribute, StringAttribute, ) -from neptune.new.internal.backends.neptune_backend_mock import NeptuneBackendMock -from neptune.new.internal.container_type import ContainerType -from tests.unit.neptune.new.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin -from tests.unit.neptune.new.utils.api_experiments_factory import ( +from neptune.internal.backends.neptune_backend_mock import NeptuneBackendMock +from neptune.internal.container_type import ContainerType +from tests.unit.neptune.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin +from tests.unit.neptune.utils.api_experiments_factory import ( api_model, api_model_version, ) @@ -52,12 +52,12 @@ @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_metadata_container", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_metadata_container", new=lambda _, container_id, expected_container_type: AN_API_MODEL if expected_container_type == ContainerType.MODEL else AN_API_MODEL_VERSION, ) -@patch("neptune.new.internal.backends.factory.HostedNeptuneBackend", NeptuneBackendMock) +@patch("neptune.internal.backends.factory.HostedNeptuneBackend", NeptuneBackendMock) class TestClientModelVersion(AbstractExperimentTestMixin, unittest.TestCase): @staticmethod def call_init(**kwargs): @@ -73,18 +73,18 @@ def test_offline_mode(self): init_model_version(model="PRO-MOD", mode="offline") @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes", new=lambda _, _uuid, _type: [ Attribute("some/variable", AttributeType.INT), Attribute("sys/model_id", AttributeType.STRING), ], ) @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_int_attribute", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_int_attribute", new=lambda _, _uuid, _type, _path: IntAttribute(42), ) @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_string_attribute", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_string_attribute", new=lambda _, _uuid, _type, _path: StringAttribute("MDL"), ) def test_read_only_mode(self): @@ -95,7 +95,7 @@ def test_read_only_mode(self): self.assertEqual( caplog.output, [ - "WARNING:neptune.new.internal.operation_processors.read_only_operation_processor:" + "WARNING:neptune.internal.operation_processors.read_only_operation_processor:" "Client in read-only mode, nothing will be saved to server." ], ) @@ -104,14 +104,14 @@ def test_read_only_mode(self): self.assertNotIn(str(exp._id), os.listdir(".neptune")) @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes", new=lambda _, _uuid, _type: [ Attribute("test", AttributeType.STRING), Attribute("sys/model_id", AttributeType.STRING), ], ) @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_string_attribute", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_string_attribute", new=lambda _, _uuid, _type, _path: StringAttribute("MDL"), ) def test_resume(self): diff --git a/tests/unit/neptune/client/test_model_version_tables.py b/tests/unit/neptune/client/test_model_version_tables.py index 0690504a7..bfdb91c2c 100644 --- a/tests/unit/neptune/client/test_model_version_tables.py +++ b/tests/unit/neptune/client/test_model_version_tables.py @@ -17,13 +17,13 @@ import unittest from typing import List -from neptune.new import init_model -from neptune.new.internal.container_type import ContainerType -from neptune.new.metadata_containers.metadata_containers_table import ( +from neptune import init_model +from neptune.internal.container_type import ContainerType +from neptune.metadata_containers.metadata_containers_table import ( Table, TableEntry, ) -from tests.unit.neptune.new.client.abstract_tables_test import AbstractTablesTestMixin +from tests.unit.neptune.client.abstract_tables_test import AbstractTablesTestMixin class TestModelVersionTables(AbstractTablesTestMixin, unittest.TestCase): diff --git a/tests/unit/neptune/client/test_project.py b/tests/unit/neptune/client/test_project.py index eca7caa69..26d3e7710 100644 --- a/tests/unit/neptune/client/test_project.py +++ b/tests/unit/neptune/client/test_project.py @@ -18,30 +18,30 @@ from mock import patch -from neptune.common.exceptions import NeptuneException -from neptune.new import ( +from neptune import ( ANONYMOUS, init_project, ) -from neptune.new.envs import ( +from neptune.common.exceptions import NeptuneException +from neptune.envs import ( API_TOKEN_ENV_NAME, PROJECT_ENV_NAME, ) -from neptune.new.exceptions import NeptuneMissingProjectNameException -from neptune.new.internal.backends.api_model import ( +from neptune.exceptions import NeptuneMissingProjectNameException +from neptune.internal.backends.api_model import ( Attribute, AttributeType, IntAttribute, ) -from neptune.new.internal.backends.neptune_backend_mock import NeptuneBackendMock -from tests.unit.neptune.new.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin +from neptune.internal.backends.neptune_backend_mock import NeptuneBackendMock +from tests.unit.neptune.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes", new=lambda _, _uuid, _type: [Attribute("test", AttributeType.STRING)], ) -@patch("neptune.new.internal.backends.factory.HostedNeptuneBackend", NeptuneBackendMock) +@patch("neptune.internal.backends.factory.HostedNeptuneBackend", NeptuneBackendMock) class TestClientProject(AbstractExperimentTestMixin, unittest.TestCase): PROJECT_NAME = "organization/project" @@ -81,7 +81,7 @@ def test_project_name_env_var(self): self.assertEqual(13, project["some/variable"].fetch()) @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_int_attribute", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_int_attribute", new=lambda _, _uuid, _type, _path: IntAttribute(42), ) def test_read_only_mode(self): @@ -92,7 +92,7 @@ def test_read_only_mode(self): self.assertEqual( caplog.output, [ - "WARNING:neptune.new.internal.operation_processors.read_only_operation_processor:" + "WARNING:neptune.internal.operation_processors.read_only_operation_processor:" "Client in read-only mode, nothing will be saved to server." ], ) diff --git a/tests/unit/neptune/client/test_run.py b/tests/unit/neptune/client/test_run.py index b85e83782..fb7670835 100644 --- a/tests/unit/neptune/client/test_run.py +++ b/tests/unit/neptune/client/test_run.py @@ -18,35 +18,35 @@ from mock import patch -from neptune.common.utils import IS_WINDOWS -from neptune.new import ( +from neptune import ( ANONYMOUS, Run, get_last_run, init_run, ) -from neptune.new.attributes.atoms import String -from neptune.new.envs import ( +from neptune.attributes.atoms import String +from neptune.common.utils import IS_WINDOWS +from neptune.envs import ( API_TOKEN_ENV_NAME, PROJECT_ENV_NAME, ) -from neptune.new.exceptions import ( +from neptune.exceptions import ( MissingFieldException, NeptuneUninitializedException, ) -from neptune.new.internal.backends.api_model import ( +from neptune.internal.backends.api_model import ( Attribute, AttributeType, IntAttribute, ) -from neptune.new.internal.backends.neptune_backend_mock import NeptuneBackendMock -from tests.unit.neptune.new.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin -from tests.unit.neptune.new.utils.api_experiments_factory import api_run +from neptune.internal.backends.neptune_backend_mock import NeptuneBackendMock +from tests.unit.neptune.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin +from tests.unit.neptune.utils.api_experiments_factory import api_run AN_API_RUN = api_run() -@patch("neptune.new.internal.backends.factory.HostedNeptuneBackend", NeptuneBackendMock) +@patch("neptune.internal.backends.factory.HostedNeptuneBackend", NeptuneBackendMock) class TestClientRun(AbstractExperimentTestMixin, unittest.TestCase): @staticmethod def call_init(**kwargs): @@ -58,15 +58,15 @@ def setUpClass(cls) -> None: os.environ[API_TOKEN_ENV_NAME] = ANONYMOUS @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_metadata_container", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_metadata_container", new=lambda _, container_id, expected_container_type: AN_API_RUN, ) @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes", new=lambda _, _uuid, _type: [Attribute("some/variable", AttributeType.INT)], ) @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_int_attribute", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_int_attribute", new=lambda _, _uuid, _type, _path: IntAttribute(42), ) def test_read_only_mode(self): @@ -77,7 +77,7 @@ def test_read_only_mode(self): self.assertEqual( caplog.output, [ - "WARNING:neptune.new.internal.operation_processors.read_only_operation_processor:" + "WARNING:neptune.internal.operation_processors.read_only_operation_processor:" "Client in read-only mode, nothing will be saved to server." ], ) @@ -86,11 +86,11 @@ def test_read_only_mode(self): self.assertNotIn(str(exp._id), os.listdir(".neptune")) @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_metadata_container", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_metadata_container", new=lambda _, container_id, expected_container_type: AN_API_RUN, ) @patch( - "neptune.new.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes", + "neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes", new=lambda _, _uuid, _type: [Attribute("test", AttributeType.STRING)], ) def test_resume(self): @@ -98,17 +98,17 @@ def test_resume(self): self.assertEqual(exp._id, AN_API_RUN.id) self.assertIsInstance(exp.get_structure()["test"], String) - @patch("neptune.new.internal.utils.source_code.get_path_executed_script", lambda: "main.py") - @patch("neptune.new.internal.init.run.os.path.isfile", new=lambda file: "." in file) + @patch("neptune.internal.utils.source_code.get_path_executed_script", lambda: "main.py") + @patch("neptune.internal.init.run.os.path.isfile", new=lambda file: "." in file) @patch( - "neptune.new.internal.utils.glob", + "neptune.internal.utils.glob", new=lambda path, recursive=False: [path.replace("*", "file.txt")], ) @patch( - "neptune.new.internal.utils.os.path.abspath", + "neptune.internal.utils.os.path.abspath", new=lambda path: os.path.normpath(os.path.join("/home/user/main_dir", path)), ) - @patch("neptune.new.internal.utils.os.getcwd", new=lambda: "/home/user/main_dir") + @patch("neptune.internal.utils.os.getcwd", new=lambda: "/home/user/main_dir") @unittest.skipIf(IS_WINDOWS, "Linux/Mac test") def test_entrypoint(self): with init_run(mode="debug") as exp: @@ -127,7 +127,7 @@ def test_entrypoint(self): self.assertEqual(exp["source_code/entrypoint"].fetch(), "../main_dir/main.py") @patch("neptune.vendor.lib_programname.sys.argv", ["main.py"]) - @patch("neptune.new.internal.utils.source_code.is_ipython", new=lambda: True) + @patch("neptune.internal.utils.source_code.is_ipython", new=lambda: True) def test_entrypoint_in_interactive_python(self): with init_run(mode="debug") as exp: with self.assertRaises(MissingFieldException): @@ -145,15 +145,15 @@ def test_entrypoint_in_interactive_python(self): with self.assertRaises(MissingFieldException): exp["source_code/entrypoint"].fetch() - @patch("neptune.new.internal.utils.source_code.get_path_executed_script", lambda: "main.py") - @patch("neptune.new.internal.utils.source_code.get_common_root", new=lambda _: None) - @patch("neptune.new.internal.init.run.os.path.isfile", new=lambda file: "." in file) + @patch("neptune.internal.utils.source_code.get_path_executed_script", lambda: "main.py") + @patch("neptune.internal.utils.source_code.get_common_root", new=lambda _: None) + @patch("neptune.internal.init.run.os.path.isfile", new=lambda file: "." in file) @patch( - "neptune.new.internal.utils.glob", + "neptune.internal.utils.glob", new=lambda path, recursive=False: [path.replace("*", "file.txt")], ) @patch( - "neptune.new.internal.utils.os.path.abspath", + "neptune.internal.utils.os.path.abspath", new=lambda path: os.path.normpath(os.path.join("/home/user/main_dir", path)), ) def test_entrypoint_without_common_root(self): diff --git a/tests/unit/neptune/client/test_run_tables.py b/tests/unit/neptune/client/test_run_tables.py index 967eb4b9d..73f4d33c7 100644 --- a/tests/unit/neptune/client/test_run_tables.py +++ b/tests/unit/neptune/client/test_run_tables.py @@ -17,13 +17,13 @@ import unittest from typing import List -from neptune.new import init_project -from neptune.new.internal.container_type import ContainerType -from neptune.new.metadata_containers.metadata_containers_table import ( +from neptune import init_project +from neptune.internal.container_type import ContainerType +from neptune.metadata_containers.metadata_containers_table import ( Table, TableEntry, ) -from tests.unit.neptune.new.client.abstract_tables_test import AbstractTablesTestMixin +from tests.unit.neptune.client.abstract_tables_test import AbstractTablesTestMixin class TestRunTables(AbstractTablesTestMixin, unittest.TestCase): diff --git a/tests/unit/neptune/internal/artifacts/drivers/test_local.py b/tests/unit/neptune/internal/artifacts/drivers/test_local.py index 4028104af..b687861da 100644 --- a/tests/unit/neptune/internal/artifacts/drivers/test_local.py +++ b/tests/unit/neptune/internal/artifacts/drivers/test_local.py @@ -20,17 +20,17 @@ import unittest from pathlib import Path -from neptune.new.exceptions import ( +from neptune.exceptions import ( NeptuneLocalStorageAccessException, NeptuneUnsupportedArtifactFunctionalityException, ) -from neptune.new.internal.artifacts.drivers.local import LocalArtifactDriver -from neptune.new.internal.artifacts.types import ( +from neptune.internal.artifacts.drivers.local import LocalArtifactDriver +from neptune.internal.artifacts.types import ( ArtifactDriversMap, ArtifactFileData, ArtifactFileType, ) -from tests.unit.neptune.new.internal.artifacts.utils import md5 +from tests.unit.neptune.internal.artifacts.utils import md5 class TestLocalArtifactDrivers(unittest.TestCase): diff --git a/tests/unit/neptune/internal/artifacts/drivers/test_s3.py b/tests/unit/neptune/internal/artifacts/drivers/test_s3.py index 71507be2e..72b9eddc7 100644 --- a/tests/unit/neptune/internal/artifacts/drivers/test_s3.py +++ b/tests/unit/neptune/internal/artifacts/drivers/test_s3.py @@ -22,14 +22,14 @@ import freezegun from moto import mock_s3 -from neptune.new.exceptions import NeptuneUnsupportedArtifactFunctionalityException -from neptune.new.internal.artifacts.drivers.s3 import S3ArtifactDriver -from neptune.new.internal.artifacts.types import ( +from neptune.exceptions import NeptuneUnsupportedArtifactFunctionalityException +from neptune.internal.artifacts.drivers.s3 import S3ArtifactDriver +from neptune.internal.artifacts.types import ( ArtifactDriversMap, ArtifactFileData, ArtifactFileType, ) -from tests.unit.neptune.new.internal.artifacts.utils import md5 +from tests.unit.neptune.internal.artifacts.utils import md5 @mock_s3 diff --git a/tests/unit/neptune/internal/artifacts/test_file_hasher.py b/tests/unit/neptune/internal/artifacts/test_file_hasher.py index c5e1ab83a..b66ff753f 100644 --- a/tests/unit/neptune/internal/artifacts/test_file_hasher.py +++ b/tests/unit/neptune/internal/artifacts/test_file_hasher.py @@ -24,8 +24,8 @@ patch, ) -from neptune.new.internal.artifacts.file_hasher import FileHasher -from neptune.new.internal.artifacts.types import ArtifactFileData +from neptune.internal.artifacts.file_hasher import FileHasher +from neptune.internal.artifacts.types import ArtifactFileData class TestFileHasher(unittest.TestCase): diff --git a/tests/unit/neptune/internal/artifacts/test_serializer.py b/tests/unit/neptune/internal/artifacts/test_serializer.py index 3afdb0463..f634e609a 100644 --- a/tests/unit/neptune/internal/artifacts/test_serializer.py +++ b/tests/unit/neptune/internal/artifacts/test_serializer.py @@ -15,7 +15,7 @@ # import unittest -from neptune.new.internal.artifacts.types import ArtifactMetadataSerializer +from neptune.internal.artifacts.types import ArtifactMetadataSerializer class TestArtifactMetadataSerializer(unittest.TestCase): diff --git a/tests/unit/neptune/internal/artifacts/test_types.py b/tests/unit/neptune/internal/artifacts/test_types.py index 8b0bab7c9..cba4f9998 100644 --- a/tests/unit/neptune/internal/artifacts/test_types.py +++ b/tests/unit/neptune/internal/artifacts/test_types.py @@ -17,11 +17,11 @@ import unittest from urllib.parse import urlparse -from neptune.new.exceptions import ( +from neptune.exceptions import ( NeptuneUnhandledArtifactSchemeException, NeptuneUnhandledArtifactTypeException, ) -from neptune.new.internal.artifacts.types import ( +from neptune.internal.artifacts.types import ( ArtifactDriver, ArtifactDriversMap, ArtifactFileData, diff --git a/tests/unit/neptune/internal/backends/test_hosted_artifact_operations.py b/tests/unit/neptune/internal/backends/test_hosted_artifact_operations.py index 97be72377..a3a1f7e11 100644 --- a/tests/unit/neptune/internal/backends/test_hosted_artifact_operations.py +++ b/tests/unit/neptune/internal/backends/test_hosted_artifact_operations.py @@ -21,10 +21,10 @@ patch, ) -from neptune.new.exceptions import ArtifactUploadingError -from neptune.new.internal.artifacts.types import ArtifactFileData -from neptune.new.internal.backends.api_model import ArtifactModel -from neptune.new.internal.backends.hosted_artifact_operations import ( +from neptune.exceptions import ArtifactUploadingError +from neptune.internal.artifacts.types import ArtifactFileData +from neptune.internal.backends.api_model import ArtifactModel +from neptune.internal.backends.hosted_artifact_operations import ( track_to_existing_artifact, track_to_new_artifact, ) @@ -44,9 +44,9 @@ def setUp(self) -> None: self.project_id = str(uuid.uuid4()) self.parent_identifier = str(uuid.uuid4()) - @patch("neptune.new.internal.backends.hosted_artifact_operations._compute_artifact_hash") - @patch("neptune.new.internal.backends.hosted_artifact_operations._extract_file_list") - @patch("neptune.new.internal.backends.hosted_artifact_operations.create_new_artifact") + @patch("neptune.internal.backends.hosted_artifact_operations._compute_artifact_hash") + @patch("neptune.internal.backends.hosted_artifact_operations._extract_file_list") + @patch("neptune.internal.backends.hosted_artifact_operations.create_new_artifact") def test_track_to_new_artifact_calls_creation( self, create_new_artifact, _extract_file_list, _compute_artifact_hash ): @@ -75,10 +75,10 @@ def test_track_to_new_artifact_calls_creation( default_request_params={}, ) - @patch("neptune.new.internal.backends.hosted_artifact_operations._compute_artifact_hash") - @patch("neptune.new.internal.backends.hosted_artifact_operations._extract_file_list") - @patch("neptune.new.internal.backends.hosted_artifact_operations.create_new_artifact") - @patch("neptune.new.internal.backends.hosted_artifact_operations.upload_artifact_files_metadata") + @patch("neptune.internal.backends.hosted_artifact_operations._compute_artifact_hash") + @patch("neptune.internal.backends.hosted_artifact_operations._extract_file_list") + @patch("neptune.internal.backends.hosted_artifact_operations.create_new_artifact") + @patch("neptune.internal.backends.hosted_artifact_operations.upload_artifact_files_metadata") def test_track_to_new_artifact_calls_upload( self, upload_artifact_files_metadata, @@ -113,8 +113,8 @@ def test_track_to_new_artifact_calls_upload( default_request_params={}, ) - @patch("neptune.new.internal.backends.hosted_artifact_operations._compute_artifact_hash") - @patch("neptune.new.internal.backends.hosted_artifact_operations._extract_file_list") + @patch("neptune.internal.backends.hosted_artifact_operations._compute_artifact_hash") + @patch("neptune.internal.backends.hosted_artifact_operations._extract_file_list") def test_track_to_new_artifact_raises_exception(self, _extract_file_list, _compute_artifact_hash): # given swagger_mock = self._get_swagger_mock() @@ -132,9 +132,9 @@ def test_track_to_new_artifact_raises_exception(self, _extract_file_list, _compu default_request_params={}, ) - @patch("neptune.new.internal.backends.hosted_artifact_operations._compute_artifact_hash") - @patch("neptune.new.internal.backends.hosted_artifact_operations._extract_file_list") - @patch("neptune.new.internal.backends.hosted_artifact_operations.create_artifact_version") + @patch("neptune.internal.backends.hosted_artifact_operations._compute_artifact_hash") + @patch("neptune.internal.backends.hosted_artifact_operations._extract_file_list") + @patch("neptune.internal.backends.hosted_artifact_operations.create_artifact_version") def test_track_to_existing_artifact_calls_version( self, create_artifact_version, _extract_file_list, _compute_artifact_hash ): @@ -163,8 +163,8 @@ def test_track_to_existing_artifact_calls_version( default_request_params={}, ) - @patch("neptune.new.internal.backends.hosted_artifact_operations._compute_artifact_hash") - @patch("neptune.new.internal.backends.hosted_artifact_operations._extract_file_list") + @patch("neptune.internal.backends.hosted_artifact_operations._compute_artifact_hash") + @patch("neptune.internal.backends.hosted_artifact_operations._extract_file_list") def test_track_to_existing_artifact_raises_exception(self, _extract_file_list, _compute_artifact_hash): # given swagger_mock = self._get_swagger_mock() diff --git a/tests/unit/neptune/internal/backends/test_hosted_client.py b/tests/unit/neptune/internal/backends/test_hosted_client.py index d030cb2b0..44ea7c554 100644 --- a/tests/unit/neptune/internal/backends/test_hosted_client.py +++ b/tests/unit/neptune/internal/backends/test_hosted_client.py @@ -30,6 +30,15 @@ patch, ) +from neptune.internal.backends.hosted_client import ( + _get_token_client, + create_artifacts_client, + create_backend_client, + create_http_client_with_auth, + create_leaderboard_client, + get_client_config, +) +from neptune.internal.backends.utils import verify_host_resolution from neptune.management import ( MemberRole, add_project_member, @@ -50,17 +59,8 @@ UserNotExistsOrWithoutAccess, WorkspaceNotFound, ) -from neptune.new.internal.backends.hosted_client import ( - _get_token_client, - create_artifacts_client, - create_backend_client, - create_http_client_with_auth, - create_leaderboard_client, - get_client_config, -) -from neptune.new.internal.backends.utils import verify_host_resolution -from tests.unit.neptune.new.backend_test_mixin import BackendTestMixin -from tests.unit.neptune.new.utils import response_mock +from tests.unit.neptune.backend_test_mixin import BackendTestMixin +from tests.unit.neptune.utils import response_mock API_TOKEN = ( "eyJhcGlfYWRkcmVzcyI6Imh0dHBzOi8vYXBwLnN0YWdlLm5lcHR1bmUubWwiLCJ" @@ -68,8 +68,8 @@ ) -@patch("neptune.new.internal.backends.hosted_client.RequestsClient", new=MagicMock()) -@patch("neptune.new.internal.backends.hosted_client.NeptuneAuthenticator", new=MagicMock()) +@patch("neptune.internal.backends.hosted_client.RequestsClient", new=MagicMock()) +@patch("neptune.internal.backends.hosted_client.NeptuneAuthenticator", new=MagicMock()) @patch("bravado.client.SwaggerClient.from_url") @patch("platform.platform", new=lambda: "testPlatform") @patch("platform.python_version", new=lambda: "3.9.test") diff --git a/tests/unit/neptune/internal/backends/test_hosted_file_operations.py b/tests/unit/neptune/internal/backends/test_hosted_file_operations.py index 74a1e2466..cb85699e4 100644 --- a/tests/unit/neptune/internal/backends/test_hosted_file_operations.py +++ b/tests/unit/neptune/internal/backends/test_hosted_file_operations.py @@ -32,16 +32,16 @@ ) from neptune.common.utils import IS_WINDOWS -from neptune.new.internal.backends.api_model import ClientConfig -from neptune.new.internal.backends.hosted_file_operations import ( +from neptune.internal.backends.api_model import ClientConfig +from neptune.internal.backends.hosted_file_operations import ( _get_content_disposition_filename, download_file_attribute, download_file_set_attribute, upload_file_attribute, upload_file_set_attribute, ) -from tests.unit.neptune.new.backend_test_mixin import BackendTestMixin -from tests.unit.neptune.new.utils.file_helpers import create_file +from tests.unit.neptune.backend_test_mixin import BackendTestMixin +from tests.unit.neptune.utils.file_helpers import create_file def set_expected_result(endpoint: MagicMock, value: dict): @@ -95,8 +95,8 @@ def test_get_content_disposition_filename(self): # then self.assertEqual(filename, "sample.file") - @patch("neptune.new.internal.backends.hosted_file_operations._store_response_as_file") - @patch("neptune.new.internal.backends.hosted_file_operations._download_raw_data") + @patch("neptune.internal.backends.hosted_file_operations._store_response_as_file") + @patch("neptune.internal.backends.hosted_file_operations._download_raw_data") def test_download_file_attribute(self, download_raw, store_response_mock): # given swagger_mock = self._get_swagger_mock() @@ -119,10 +119,10 @@ def test_download_file_attribute(self, download_raw, store_response_mock): ) store_response_mock.assert_called_once_with(download_raw.return_value, None) - @patch("neptune.new.internal.backends.hosted_file_operations._store_response_as_file") - @patch("neptune.new.internal.backends.hosted_file_operations._download_raw_data") + @patch("neptune.internal.backends.hosted_file_operations._store_response_as_file") + @patch("neptune.internal.backends.hosted_file_operations._download_raw_data") @patch( - "neptune.new.internal.backends.hosted_file_operations._get_download_url", + "neptune.internal.backends.hosted_file_operations._get_download_url", new=lambda _, _id: "some_url", ) def test_download_file_set_attribute(self, download_raw, store_response_mock): @@ -150,7 +150,7 @@ def __init__(self, *args, **kwargs): self.multipart_config = client_config.multipart_config @unittest.skipIf(IS_WINDOWS, "Windows behaves strangely") - @patch("neptune.new.internal.backends.hosted_file_operations.upload_raw_data") + @patch("neptune.internal.backends.hosted_file_operations.upload_raw_data") def test_missing_files_or_directory(self, upload_raw_data_mock): # given exp_uuid = str(uuid.uuid4()) @@ -189,7 +189,7 @@ def test_missing_files_or_directory(self, upload_raw_data_mock): ) @unittest.skipIf(IS_WINDOWS, "Windows behaves strangely") - @patch("neptune.new.internal.backends.hosted_file_operations.upload_raw_data") + @patch("neptune.internal.backends.hosted_file_operations.upload_raw_data") def test_upload_small_file_attribute(self, upload_raw_data): # given exp_uuid = str(uuid.uuid4()) @@ -234,7 +234,7 @@ def test_upload_small_file_attribute(self, upload_raw_data): ) @unittest.skipIf(IS_WINDOWS, "Windows behaves strangely") - @patch("neptune.new.internal.backends.hosted_file_operations.upload_raw_data") + @patch("neptune.internal.backends.hosted_file_operations.upload_raw_data") def test_upload_big_file_attribute(self, upload_raw_data): # given exp_uuid = str(uuid.uuid4()) @@ -313,9 +313,9 @@ def test_upload_big_file_attribute(self, upload_raw_data): ) @unittest.skipIf(IS_WINDOWS, "Windows behaves strangely") - @patch("neptune.new.internal.backends.hosted_file_operations.upload_raw_data") + @patch("neptune.internal.backends.hosted_file_operations.upload_raw_data") @patch( - "neptune.new.internal.utils.glob", + "neptune.internal.utils.glob", new=lambda path, recursive=False: [path.replace("*", "file.txt")], ) def test_upload_single_small_file_in_file_set_attribute(self, upload_raw_data): @@ -361,9 +361,9 @@ def test_upload_single_small_file_in_file_set_attribute(self, upload_raw_data): ) @unittest.skipIf(IS_WINDOWS, "Windows behaves strangely") - @patch("neptune.new.internal.backends.hosted_file_operations.upload_raw_data") + @patch("neptune.internal.backends.hosted_file_operations.upload_raw_data") @patch( - "neptune.new.internal.utils.glob", + "neptune.internal.utils.glob", new=lambda path, recursive=False: [path.replace("*", "file.txt")], ) def test_upload_single_big_file_in_file_set_attribute(self, upload_raw_data): @@ -448,9 +448,9 @@ def test_upload_single_big_file_in_file_set_attribute(self, upload_raw_data): ) @unittest.skipIf(IS_WINDOWS, "Windows behaves strangely") - @patch("neptune.new.internal.backends.hosted_file_operations.upload_raw_data") + @patch("neptune.internal.backends.hosted_file_operations.upload_raw_data") @patch( - "neptune.new.internal.utils.glob", + "neptune.internal.utils.glob", new=lambda path, recursive=False: [path.replace("*", "file.txt")], ) def test_upload_multiple_files_in_file_set_attribute(self, upload_raw_data_mock): diff --git a/tests/unit/neptune/internal/backends/test_hosted_neptune_backend.py b/tests/unit/neptune/internal/backends/test_hosted_neptune_backend.py index 1529a650a..23c0d8fc0 100644 --- a/tests/unit/neptune/internal/backends/test_hosted_neptune_backend.py +++ b/tests/unit/neptune/internal/backends/test_hosted_neptune_backend.py @@ -29,14 +29,14 @@ ) from packaging.version import Version -from neptune.new.exceptions import ( +from neptune.exceptions import ( CannotResolveHostname, FileUploadError, MetadataInconsistency, NeptuneClientUpgradeRequiredError, NeptuneLimitExceedException, ) -from neptune.new.internal.backends.hosted_client import ( +from neptune.internal.backends.hosted_client import ( DEFAULT_REQUEST_KWARGS, _get_token_client, create_artifacts_client, @@ -45,21 +45,21 @@ create_leaderboard_client, get_client_config, ) -from neptune.new.internal.backends.hosted_neptune_backend import HostedNeptuneBackend -from neptune.new.internal.backends.swagger_client_wrapper import SwaggerClientWrapper -from neptune.new.internal.backends.utils import verify_host_resolution -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.credentials import Credentials -from neptune.new.internal.operation import ( +from neptune.internal.backends.hosted_neptune_backend import HostedNeptuneBackend +from neptune.internal.backends.swagger_client_wrapper import SwaggerClientWrapper +from neptune.internal.backends.utils import verify_host_resolution +from neptune.internal.container_type import ContainerType +from neptune.internal.credentials import Credentials +from neptune.internal.operation import ( AssignString, LogFloats, TrackFilesToArtifact, UploadFile, UploadFileContent, ) -from neptune.new.internal.utils import base64_encode -from tests.unit.neptune.new.backend_test_mixin import BackendTestMixin -from tests.unit.neptune.new.utils import response_mock +from neptune.internal.utils import base64_encode +from tests.unit.neptune.backend_test_mixin import BackendTestMixin +from tests.unit.neptune.utils import response_mock API_TOKEN = ( "eyJhcGlfYWRkcmVzcyI6Imh0dHBzOi8vYXBwLnN0YWdlLm5lcHR1bmUuYWkiLCJ" @@ -69,8 +69,8 @@ credentials = Credentials.from_token(API_TOKEN) -@patch("neptune.new.internal.backends.hosted_client.RequestsClient", new=MagicMock()) -@patch("neptune.new.internal.backends.hosted_client.NeptuneAuthenticator", new=MagicMock()) +@patch("neptune.internal.backends.hosted_client.RequestsClient", new=MagicMock()) +@patch("neptune.internal.backends.hosted_client.NeptuneAuthenticator", new=MagicMock()) @patch("bravado.client.SwaggerClient.from_url") @patch("platform.platform", new=lambda: "testPlatform") @patch("platform.python_version", new=lambda: "3.9.test") @@ -87,7 +87,7 @@ def setUp(self) -> None: self.container_types = [ContainerType.RUN, ContainerType.PROJECT] - @patch("neptune.new.internal.backends.hosted_neptune_backend.upload_file_attribute") + @patch("neptune.internal.backends.hosted_neptune_backend.upload_file_attribute") @patch("socket.gethostbyname", MagicMock(return_value="1.1.1.1")) def test_execute_operations(self, upload_mock, swagger_client_factory): # given @@ -216,7 +216,7 @@ def test_execute_operations(self, upload_mock, swagger_client_factory): result, ) - @patch("neptune.new.internal.backends.hosted_neptune_backend.upload_file_attribute") + @patch("neptune.internal.backends.hosted_neptune_backend.upload_file_attribute") @patch("socket.gethostbyname", MagicMock(return_value="1.1.1.1")) def test_upload_files_destination_path(self, upload_mock, swagger_client_factory): # given @@ -283,7 +283,7 @@ def test_upload_files_destination_path(self, upload_mock, swagger_client_factory any_order=True, ) - @patch("neptune.new.internal.backends.hosted_neptune_backend.track_to_new_artifact") + @patch("neptune.internal.backends.hosted_neptune_backend.track_to_new_artifact") @patch("socket.gethostbyname", MagicMock(return_value="1.1.1.1")) def test_track_to_new_artifact(self, track_to_new_artifact_mock, swagger_client_factory): # given @@ -371,7 +371,7 @@ def test_track_to_new_artifact(self, track_to_new_artifact_mock, swagger_client_ any_order=True, ) - @patch("neptune.new.internal.backends.hosted_neptune_backend.track_to_existing_artifact") + @patch("neptune.internal.backends.hosted_neptune_backend.track_to_existing_artifact") @patch("socket.gethostbyname", MagicMock(return_value="1.1.1.1")) def test_track_to_existing_artifact(self, track_to_existing_artifact_mock, swagger_client_factory): # given @@ -466,7 +466,7 @@ def test_track_to_existing_artifact(self, track_to_existing_artifact_mock, swagg ) @patch( - "neptune.new.internal.backends.hosted_client.neptune_client_version", + "neptune.internal.backends.hosted_client.neptune_client_version", Version("0.5.13"), ) @patch("socket.gethostbyname", MagicMock(return_value="1.1.1.1")) @@ -478,7 +478,7 @@ def test_min_compatible_version_ok(self, swagger_client_factory): HostedNeptuneBackend(credentials) @patch( - "neptune.new.internal.backends.hosted_client.neptune_client_version", + "neptune.internal.backends.hosted_client.neptune_client_version", Version("0.5.13"), ) @patch("socket.gethostbyname", MagicMock(return_value="1.1.1.1")) @@ -493,7 +493,7 @@ def test_min_compatible_version_fail(self, swagger_client_factory): self.assertTrue("minimum required version is >=0.5.14" in str(ex.exception)) @patch( - "neptune.new.internal.backends.hosted_client.neptune_client_version", + "neptune.internal.backends.hosted_client.neptune_client_version", Version("0.5.13"), ) @patch("socket.gethostbyname", MagicMock(return_value="1.1.1.1")) @@ -505,7 +505,7 @@ def test_max_compatible_version_ok(self, swagger_client_factory): HostedNeptuneBackend(credentials) @patch( - "neptune.new.internal.backends.hosted_client.neptune_client_version", + "neptune.internal.backends.hosted_client.neptune_client_version", Version("0.5.13"), ) @patch("socket.gethostbyname", MagicMock(return_value="1.1.1.1")) diff --git a/tests/unit/neptune/internal/backends/test_neptune_backend_mock.py b/tests/unit/neptune/internal/backends/test_neptune_backend_mock.py index 022e4832d..c9bf2b18a 100644 --- a/tests/unit/neptune/internal/backends/test_neptune_backend_mock.py +++ b/tests/unit/neptune/internal/backends/test_neptune_backend_mock.py @@ -19,11 +19,11 @@ from random import randint from time import time -from neptune.new.exceptions import ( +from neptune.exceptions import ( ContainerUUIDNotFound, MetadataInconsistency, ) -from neptune.new.internal.backends.api_model import ( +from neptune.internal.backends.api_model import ( DatetimeAttribute, FloatAttribute, FloatPointValue, @@ -35,9 +35,9 @@ StringSeriesValues, StringSetAttribute, ) -from neptune.new.internal.backends.neptune_backend_mock import NeptuneBackendMock -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.operation import ( +from neptune.internal.backends.neptune_backend_mock import NeptuneBackendMock +from neptune.internal.container_type import ContainerType +from neptune.internal.operation import ( AddStrings, AssignDatetime, AssignFloat, diff --git a/tests/unit/neptune/internal/backends/test_nql.py b/tests/unit/neptune/internal/backends/test_nql.py index f0c12bbea..e3905169d 100644 --- a/tests/unit/neptune/internal/backends/test_nql.py +++ b/tests/unit/neptune/internal/backends/test_nql.py @@ -15,7 +15,7 @@ # import unittest -from neptune.new.internal.backends.nql import ( +from neptune.internal.backends.nql import ( NQLAggregator, NQLAttributeOperator, NQLAttributeType, diff --git a/tests/unit/neptune/internal/backends/test_operations_preprocessor.py b/tests/unit/neptune/internal/backends/test_operations_preprocessor.py index f7cf554bd..4aa5f9206 100644 --- a/tests/unit/neptune/internal/backends/test_operations_preprocessor.py +++ b/tests/unit/neptune/internal/backends/test_operations_preprocessor.py @@ -16,9 +16,9 @@ import uuid -from neptune.new.exceptions import MetadataInconsistency -from neptune.new.internal.backends.operations_preprocessor import OperationsPreprocessor -from neptune.new.internal.operation import ( +from neptune.exceptions import MetadataInconsistency +from neptune.internal.backends.operations_preprocessor import OperationsPreprocessor +from neptune.internal.operation import ( AddStrings, AssignFloat, AssignString, @@ -34,7 +34,7 @@ TrackFilesToArtifact, UploadFileSet, ) -from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase FLog = LogFloats.ValueType SLog = LogStrings.ValueType diff --git a/tests/unit/neptune/internal/backends/test_swagger_client_wrapper.py b/tests/unit/neptune/internal/backends/test_swagger_client_wrapper.py index 5bf98a2b8..2cf848044 100644 --- a/tests/unit/neptune/internal/backends/test_swagger_client_wrapper.py +++ b/tests/unit/neptune/internal/backends/test_swagger_client_wrapper.py @@ -16,7 +16,7 @@ import unittest from unittest.mock import MagicMock -from neptune.new.internal.backends.swagger_client_wrapper import SwaggerClientWrapper +from neptune.internal.backends.swagger_client_wrapper import SwaggerClientWrapper class TestSwaggerClientWrapper(unittest.TestCase): diff --git a/tests/unit/neptune/internal/backends/test_utils.py b/tests/unit/neptune/internal/backends/test_utils.py index 2eae17b3c..cd47214e6 100644 --- a/tests/unit/neptune/internal/backends/test_utils.py +++ b/tests/unit/neptune/internal/backends/test_utils.py @@ -17,18 +17,18 @@ import uuid from unittest.mock import Mock -from neptune.new.attributes import ( +from neptune.attributes import ( Integer, String, ) -from neptune.new.exceptions import FetchAttributeNotFoundException -from neptune.new.internal import operation -from neptune.new.internal.backends.neptune_backend import NeptuneBackend -from neptune.new.internal.backends.utils import ( +from neptune.exceptions import FetchAttributeNotFoundException +from neptune.internal import operation +from neptune.internal.backends.neptune_backend import NeptuneBackend +from neptune.internal.backends.utils import ( ExecuteOperationsBatchingManager, build_operation_url, ) -from neptune.new.internal.container_type import ContainerType +from neptune.internal.container_type import ContainerType class TestNeptuneBackendMock(unittest.TestCase): diff --git a/tests/unit/neptune/internal/test_container_structure.py b/tests/unit/neptune/internal/test_container_structure.py index 92545f6cc..537169819 100644 --- a/tests/unit/neptune/internal/test_container_structure.py +++ b/tests/unit/neptune/internal/test_container_structure.py @@ -16,11 +16,11 @@ import unittest import uuid -from neptune.new.exceptions import MetadataInconsistency -from neptune.new.internal.backends.neptune_backend_mock import NeptuneBackendMock -from neptune.new.internal.container_structure import ContainerStructure -from neptune.new.internal.container_type import ContainerType -from neptune.new.types.value import Value +from neptune.exceptions import MetadataInconsistency +from neptune.internal.backends.neptune_backend_mock import NeptuneBackendMock +from neptune.internal.container_structure import ContainerStructure +from neptune.internal.container_type import ContainerType +from neptune.types.value import Value class TestRunStructure(unittest.TestCase): diff --git a/tests/unit/neptune/internal/test_credentials.py b/tests/unit/neptune/internal/test_credentials.py index 69bb3b8c5..b7ee1aa58 100644 --- a/tests/unit/neptune/internal/test_credentials.py +++ b/tests/unit/neptune/internal/test_credentials.py @@ -18,8 +18,8 @@ import unittest from neptune.common.exceptions import NeptuneInvalidApiTokenException -from neptune.new.envs import API_TOKEN_ENV_NAME -from neptune.new.internal.credentials import Credentials +from neptune.envs import API_TOKEN_ENV_NAME +from neptune.internal.credentials import Credentials API_TOKEN = ( "eyJhcGlfYWRkcmVzcyI6Imh0dHBzOi8vYXBwLnN0YWdlLm5lcHR1bmUubWwiLCJ" diff --git a/tests/unit/neptune/internal/test_disk_queue.py b/tests/unit/neptune/internal/test_disk_queue.py index b32ed1731..74bcb73ec 100644 --- a/tests/unit/neptune/internal/test_disk_queue.py +++ b/tests/unit/neptune/internal/test_disk_queue.py @@ -21,7 +21,7 @@ from pathlib import Path from tempfile import TemporaryDirectory -from neptune.new.internal.disk_queue import ( +from neptune.internal.disk_queue import ( DiskQueue, QueueElement, ) diff --git a/tests/unit/neptune/internal/test_operations.py b/tests/unit/neptune/internal/test_operations.py index b59bd2e5d..c23f5a1c0 100644 --- a/tests/unit/neptune/internal/test_operations.py +++ b/tests/unit/neptune/internal/test_operations.py @@ -18,8 +18,8 @@ import unittest import uuid -from neptune.new.attributes import Integer -from neptune.new.internal.operation import ( +from neptune.attributes import Integer +from neptune.internal.operation import ( AddStrings, AssignArtifact, AssignBool, diff --git a/tests/unit/neptune/internal/test_streams.py b/tests/unit/neptune/internal/test_streams.py index 444c6d586..98a754004 100644 --- a/tests/unit/neptune/internal/test_streams.py +++ b/tests/unit/neptune/internal/test_streams.py @@ -20,11 +20,11 @@ from io import StringIO from unittest.mock import MagicMock -from neptune.new.internal.streams.std_stream_capture_logger import ( +from neptune.internal.streams.std_stream_capture_logger import ( StdoutCaptureLogger, StdStreamCaptureLogger, ) -from neptune.new.logging import Logger as NeptuneLogger +from neptune.logging import Logger as NeptuneLogger class FakeLogger: diff --git a/tests/unit/neptune/internal/utils/test_deprecation.py b/tests/unit/neptune/internal/utils/test_deprecation.py index 6859c7115..989b84136 100644 --- a/tests/unit/neptune/internal/utils/test_deprecation.py +++ b/tests/unit/neptune/internal/utils/test_deprecation.py @@ -24,8 +24,8 @@ NeptuneDeprecationWarning, warn_once, ) -from neptune.new.exceptions import NeptuneParametersCollision -from neptune.new.internal.utils.deprecation import ( +from neptune.exceptions import NeptuneParametersCollision +from neptune.internal.utils.deprecation import ( deprecated, deprecated_parameter, ) diff --git a/tests/unit/neptune/internal/utils/test_images.py b/tests/unit/neptune/internal/utils/test_images.py index 0a5e1558d..47eb98ec0 100644 --- a/tests/unit/neptune/internal/utils/test_images.py +++ b/tests/unit/neptune/internal/utils/test_images.py @@ -36,7 +36,7 @@ IS_MACOS, IS_WINDOWS, ) -from neptune.new.internal.utils.images import ( +from neptune.internal.utils.images import ( get_html_content, get_image_content, ) diff --git a/tests/unit/neptune/internal/utils/test_iteration.py b/tests/unit/neptune/internal/utils/test_iteration.py index 05a053a90..8e9c82799 100644 --- a/tests/unit/neptune/internal/utils/test_iteration.py +++ b/tests/unit/neptune/internal/utils/test_iteration.py @@ -15,7 +15,7 @@ # import unittest -from neptune.new.internal.utils.iteration import get_batches +from neptune.internal.utils.iteration import get_batches class TestIterationUtils(unittest.TestCase): diff --git a/tests/unit/neptune/internal/utils/test_json_file_splitter.py b/tests/unit/neptune/internal/utils/test_json_file_splitter.py index b60bc832a..e6aff9e69 100644 --- a/tests/unit/neptune/internal/utils/test_json_file_splitter.py +++ b/tests/unit/neptune/internal/utils/test_json_file_splitter.py @@ -15,8 +15,8 @@ # import unittest -from neptune.new.internal.utils.json_file_splitter import JsonFileSplitter -from tests.unit.neptune.new.utils.file_helpers import create_file +from neptune.internal.utils.json_file_splitter import JsonFileSplitter +from tests.unit.neptune.utils.file_helpers import create_file class TestJsonFileSplitter(unittest.TestCase): diff --git a/tests/unit/neptune/internal/utils/test_utils.py b/tests/unit/neptune/internal/utils/test_utils.py index 719057309..5d18bb3c2 100644 --- a/tests/unit/neptune/internal/utils/test_utils.py +++ b/tests/unit/neptune/internal/utils/test_utils.py @@ -16,7 +16,7 @@ import unittest -from neptune.new.internal.utils import ( +from neptune.internal.utils import ( verify_collection_type, verify_type, ) diff --git a/tests/unit/neptune/legacy/test_alpha_integration_backend.py b/tests/unit/neptune/legacy/test_alpha_integration_backend.py index 069aa74ac..eb2a8ee8d 100644 --- a/tests/unit/neptune/legacy/test_alpha_integration_backend.py +++ b/tests/unit/neptune/legacy/test_alpha_integration_backend.py @@ -32,7 +32,7 @@ ChannelType, ChannelValue, ) -from tests.unit.neptune.new.backend_test_mixin import BackendTestMixin as AlphaBackendTestMixin +from tests.unit.neptune.backend_test_mixin import BackendTestMixin as AlphaBackendTestMixin API_TOKEN = ( "eyJhcGlfYWRkcmVzcyI6Imh0dHBzOi8vYWxwaGEuc3RhZ2UubmVwdHVuZS5haSIsImFwaV91cmwiOiJodHRwczovL2FscG" @@ -54,7 +54,7 @@ class TestAlphaIntegrationNeptuneBackend(unittest.TestCase, AlphaBackendTestMixi new=MagicMock, ) @mock.patch( - "neptune.new.internal.backends.hosted_client.NeptuneAuthenticator", + "neptune.internal.backends.hosted_client.NeptuneAuthenticator", new=MagicMock, ) @mock.patch("socket.gethostbyname", MagicMock(return_value="1.1.1.1")) diff --git a/tests/unit/neptune/management/internal/test_api.py b/tests/unit/neptune/management/internal/test_api.py index f5b13c271..fcca450de 100644 --- a/tests/unit/neptune/management/internal/test_api.py +++ b/tests/unit/neptune/management/internal/test_api.py @@ -19,15 +19,15 @@ from mock import patch +from neptune import ANONYMOUS from neptune.common.envs import API_TOKEN_ENV_NAME +from neptune.envs import PROJECT_ENV_NAME +from neptune.internal.backends.hosted_client import DEFAULT_REQUEST_KWARGS +from neptune.internal.backends.neptune_backend_mock import NeptuneBackendMock from neptune.management import trash_objects -from neptune.new import ANONYMOUS -from neptune.new.envs import PROJECT_ENV_NAME -from neptune.new.internal.backends.hosted_client import DEFAULT_REQUEST_KWARGS -from neptune.new.internal.backends.neptune_backend_mock import NeptuneBackendMock -@patch("neptune.new.internal.backends.factory.HostedNeptuneBackend", NeptuneBackendMock) +@patch("neptune.internal.backends.factory.HostedNeptuneBackend", NeptuneBackendMock) class TestTrashObjects(unittest.TestCase): PROJECT_NAME = "organization/project" diff --git a/tests/unit/neptune/test_experiment.py b/tests/unit/neptune/test_experiment.py index 6406acc4b..00ed0c832 100644 --- a/tests/unit/neptune/test_experiment.py +++ b/tests/unit/neptune/test_experiment.py @@ -17,7 +17,7 @@ import unittest from datetime import datetime -from neptune.new import ( +from neptune import ( ANONYMOUS, Run, init, @@ -26,11 +26,11 @@ init_project, init_run, ) -from neptune.new.envs import ( +from neptune.envs import ( API_TOKEN_ENV_NAME, PROJECT_ENV_NAME, ) -from neptune.new.exceptions import ( +from neptune.exceptions import ( InactiveModelException, InactiveModelVersionException, InactiveProjectException, @@ -38,14 +38,14 @@ MetadataInconsistency, NeptuneProtectedPathException, ) -from neptune.new.metadata_containers import ( +from neptune.metadata_containers import ( Model, ModelVersion, Project, ) -from neptune.new.types.atoms.float import Float -from neptune.new.types.atoms.string import String -from neptune.new.types.series import ( +from neptune.types.atoms.float import Float +from neptune.types.atoms.string import String +from neptune.types.series import ( FloatSeries, StringSeries, ) diff --git a/tests/unit/neptune/test_handler.py b/tests/unit/neptune/test_handler.py index 66d3ccca2..aff060dda 100644 --- a/tests/unit/neptune/test_handler.py +++ b/tests/unit/neptune/test_handler.py @@ -31,37 +31,37 @@ import PIL -from neptune.new import ( +from neptune import ( ANONYMOUS, init_run, ) -from neptune.new.attributes.atoms.boolean import Boolean -from neptune.new.attributes.atoms.datetime import Datetime -from neptune.new.attributes.atoms.file import File -from neptune.new.attributes.atoms.float import Float -from neptune.new.attributes.atoms.integer import Integer -from neptune.new.attributes.atoms.string import String -from neptune.new.attributes.series import FileSeries -from neptune.new.attributes.sets.string_set import StringSet -from neptune.new.envs import ( +from neptune.attributes.atoms.boolean import Boolean +from neptune.attributes.atoms.datetime import Datetime +from neptune.attributes.atoms.file import File +from neptune.attributes.atoms.float import Float +from neptune.attributes.atoms.integer import Integer +from neptune.attributes.atoms.string import String +from neptune.attributes.series import FileSeries +from neptune.attributes.sets.string_set import StringSet +from neptune.envs import ( API_TOKEN_ENV_NAME, PROJECT_ENV_NAME, ) -from neptune.new.exceptions import ( +from neptune.exceptions import ( FileNotFound, NeptuneUserApiInputException, ) -from neptune.new.types import File as FileVal -from neptune.new.types.atoms.artifact import Artifact -from neptune.new.types.atoms.datetime import Datetime as DatetimeVal -from neptune.new.types.atoms.float import Float as FloatVal -from neptune.new.types.atoms.string import String as StringVal -from neptune.new.types.namespace import Namespace as NamespaceVal -from neptune.new.types.series.file_series import FileSeries as FileSeriesVal -from neptune.new.types.series.float_series import FloatSeries as FloatSeriesVal -from neptune.new.types.series.string_series import StringSeries as StringSeriesVal -from neptune.new.types.sets.string_set import StringSet as StringSetVal -from tests.unit.neptune.new.utils.file_helpers import create_file +from neptune.types import File as FileVal +from neptune.types.atoms.artifact import Artifact +from neptune.types.atoms.datetime import Datetime as DatetimeVal +from neptune.types.atoms.float import Float as FloatVal +from neptune.types.atoms.string import String as StringVal +from neptune.types.namespace import Namespace as NamespaceVal +from neptune.types.series.file_series import FileSeries as FileSeriesVal +from neptune.types.series.float_series import FloatSeries as FloatSeriesVal +from neptune.types.series.string_series import StringSeries as StringSeriesVal +from neptune.types.sets.string_set import StringSet as StringSetVal +from tests.unit.neptune.utils.file_helpers import create_file class TestBaseAssign(unittest.TestCase): @@ -164,17 +164,17 @@ def test_save_download_binary_stream_to_default_destination(self): self.assertIsInstance(exp.get_structure()["some"]["num"]["attr_name"], File) with TemporaryDirectory() as temp_dir: - with patch("neptune.new.internal.backends.neptune_backend_mock.os.path.abspath") as abspath_mock: + with patch("neptune.internal.backends.neptune_backend_mock.os.path.abspath") as abspath_mock: abspath_mock.side_effect = lambda path: os.path.normpath(temp_dir + "/" + path) exp["some/num/attr_name"].download() with open(temp_dir + "/attr_name.bin", "rb") as file: self.assertEqual(file.read(), data) @patch( - "neptune.new.internal.utils.glob", + "neptune.internal.utils.glob", new=lambda path, recursive=False: [path.replace("*", "file.txt")], ) - @patch("neptune.new.internal.backends.neptune_backend_mock.ZipFile.write") + @patch("neptune.internal.backends.neptune_backend_mock.ZipFile.write") def test_save_files_download(self, zip_write_mock): with init_run(mode="debug", flush_period=0.5) as exp: exp["some/artifacts"].upload_files("path/to/file.txt") diff --git a/tests/unit/neptune/test_imports.py b/tests/unit/neptune/test_imports.py index 8bda8fe45..46c025937 100644 --- a/tests/unit/neptune/test_imports.py +++ b/tests/unit/neptune/test_imports.py @@ -18,48 +18,32 @@ # flake8: noqa import unittest -from neptune.management.exceptions import ( - AccessRevokedOnDeletion, - AccessRevokedOnMemberRemoval, - BadRequestException, - ConflictingWorkspaceName, - InvalidProjectName, - ManagementOperationFailure, - MissingWorkspaceName, - ProjectAlreadyExists, - ProjectNotFound, - ProjectsLimitReached, - UnsupportedValue, - UserAlreadyHasAccess, - UserNotExistsOrWithoutAccess, - WorkspaceNotFound, -) -from neptune.new.attributes.atoms.artifact import Artifact -from neptune.new.attributes.atoms.atom import Atom -from neptune.new.attributes.atoms.boolean import Boolean -from neptune.new.attributes.atoms.datetime import Datetime -from neptune.new.attributes.atoms.file import File -from neptune.new.attributes.atoms.float import Float -from neptune.new.attributes.atoms.git_ref import GitRef -from neptune.new.attributes.atoms.integer import Integer -from neptune.new.attributes.atoms.notebook_ref import NotebookRef -from neptune.new.attributes.atoms.run_state import RunState -from neptune.new.attributes.atoms.string import String -from neptune.new.attributes.attribute import Attribute -from neptune.new.attributes.file_set import FileSet -from neptune.new.attributes.namespace import ( +from neptune.attributes.atoms.artifact import Artifact +from neptune.attributes.atoms.atom import Atom +from neptune.attributes.atoms.boolean import Boolean +from neptune.attributes.atoms.datetime import Datetime +from neptune.attributes.atoms.file import File +from neptune.attributes.atoms.float import Float +from neptune.attributes.atoms.git_ref import GitRef +from neptune.attributes.atoms.integer import Integer +from neptune.attributes.atoms.notebook_ref import NotebookRef +from neptune.attributes.atoms.run_state import RunState +from neptune.attributes.atoms.string import String +from neptune.attributes.attribute import Attribute +from neptune.attributes.file_set import FileSet +from neptune.attributes.namespace import ( Namespace, NamespaceBuilder, ) -from neptune.new.attributes.series.fetchable_series import FetchableSeries -from neptune.new.attributes.series.file_series import FileSeries -from neptune.new.attributes.series.float_series import FloatSeries -from neptune.new.attributes.series.series import Series -from neptune.new.attributes.series.string_series import StringSeries -from neptune.new.attributes.sets.set import Set -from neptune.new.attributes.sets.string_set import StringSet -from neptune.new.attributes.utils import create_attribute_from_type -from neptune.new.exceptions import ( +from neptune.attributes.series.fetchable_series import FetchableSeries +from neptune.attributes.series.file_series import FileSeries +from neptune.attributes.series.float_series import FloatSeries +from neptune.attributes.series.series import Series +from neptune.attributes.series.string_series import StringSeries +from neptune.attributes.sets.set import Set +from neptune.attributes.sets.string_set import StringSet +from neptune.attributes.utils import create_attribute_from_type +from neptune.exceptions import ( AmbiguousProjectName, ArtifactNotFoundException, ArtifactUploadingError, @@ -111,11 +95,27 @@ RunUUIDNotFound, Unauthorized, ) -from neptune.new.handler import Handler -from neptune.new.integrations.python_logger import NeptuneHandler -from neptune.new.logging.logger import Logger -from neptune.new.project import Project -from neptune.new.run import ( +from neptune.handler import Handler +from neptune.integrations.python_logger import NeptuneHandler +from neptune.logging.logger import Logger +from neptune.management.exceptions import ( + AccessRevokedOnDeletion, + AccessRevokedOnMemberRemoval, + BadRequestException, + ConflictingWorkspaceName, + InvalidProjectName, + ManagementOperationFailure, + MissingWorkspaceName, + ProjectAlreadyExists, + ProjectNotFound, + ProjectsLimitReached, + UnsupportedValue, + UserAlreadyHasAccess, + UserNotExistsOrWithoutAccess, + WorkspaceNotFound, +) +from neptune.project import Project +from neptune.run import ( Attribute, Boolean, Datetime, @@ -133,7 +133,7 @@ String, Value, ) -from neptune.new.runs_table import ( +from neptune.runs_table import ( AttributeType, AttributeWithProperties, LeaderboardEntry, @@ -142,7 +142,7 @@ RunsTable, RunsTableEntry, ) -from neptune.new.sync import ( +from neptune.sync import ( ApiExperiment, CannotSynchronizeOfflineRunsWithoutProject, DiskQueue, @@ -156,26 +156,26 @@ ProjectNotFound, RunNotFound, ) -from neptune.new.types.atoms.artifact import Artifact -from neptune.new.types.atoms.atom import Atom -from neptune.new.types.atoms.boolean import Boolean -from neptune.new.types.atoms.datetime import Datetime -from neptune.new.types.atoms.file import File -from neptune.new.types.atoms.float import Float -from neptune.new.types.atoms.git_ref import GitRef -from neptune.new.types.atoms.integer import Integer -from neptune.new.types.atoms.string import String -from neptune.new.types.file_set import FileSet -from neptune.new.types.namespace import Namespace -from neptune.new.types.series.file_series import FileSeries -from neptune.new.types.series.float_series import FloatSeries -from neptune.new.types.series.series import Series -from neptune.new.types.series.series_value import SeriesValue -from neptune.new.types.series.string_series import StringSeries -from neptune.new.types.sets.set import Set -from neptune.new.types.sets.string_set import StringSet -from neptune.new.types.value import Value -from neptune.new.types.value_visitor import ValueVisitor +from neptune.types.atoms.artifact import Artifact +from neptune.types.atoms.atom import Atom +from neptune.types.atoms.boolean import Boolean +from neptune.types.atoms.datetime import Datetime +from neptune.types.atoms.file import File +from neptune.types.atoms.float import Float +from neptune.types.atoms.git_ref import GitRef +from neptune.types.atoms.integer import Integer +from neptune.types.atoms.string import String +from neptune.types.file_set import FileSet +from neptune.types.namespace import Namespace +from neptune.types.series.file_series import FileSeries +from neptune.types.series.float_series import FloatSeries +from neptune.types.series.series import Series +from neptune.types.series.series_value import SeriesValue +from neptune.types.series.string_series import StringSeries +from neptune.types.sets.set import Set +from neptune.types.sets.string_set import StringSet +from neptune.types.value import Value +from neptune.types.value_visitor import ValueVisitor class TestImports(unittest.TestCase): diff --git a/tests/unit/neptune/test_log_handler.py b/tests/unit/neptune/test_log_handler.py index 9a40f0b5e..caf1c54f6 100644 --- a/tests/unit/neptune/test_log_handler.py +++ b/tests/unit/neptune/test_log_handler.py @@ -17,15 +17,15 @@ import os import unittest -from neptune.new import ( +from neptune import ( ANONYMOUS, init_run, ) -from neptune.new.envs import ( +from neptune.envs import ( API_TOKEN_ENV_NAME, PROJECT_ENV_NAME, ) -from neptune.new.integrations.python_logger import NeptuneHandler +from neptune.integrations.python_logger import NeptuneHandler class TestLogHandler(unittest.TestCase): diff --git a/tests/unit/neptune/test_stringify_unsupported.py b/tests/unit/neptune/test_stringify_unsupported.py index b74ae6168..7b486b0f3 100644 --- a/tests/unit/neptune/test_stringify_unsupported.py +++ b/tests/unit/neptune/test_stringify_unsupported.py @@ -20,13 +20,13 @@ warns, ) +from neptune import init_run from neptune.common.deprecation import NeptuneDeprecationWarning -from neptune.new import init_run -from neptune.new.types import ( +from neptune.types import ( Boolean, String, ) -from neptune.new.utils import stringify_unsupported +from neptune.utils import stringify_unsupported class Obj: diff --git a/tests/unit/neptune/types/atoms/test_file.py b/tests/unit/neptune/types/atoms/test_file.py index af8890f32..f08c9cbdb 100644 --- a/tests/unit/neptune/types/atoms/test_file.py +++ b/tests/unit/neptune/types/atoms/test_file.py @@ -24,16 +24,16 @@ from bokeh.plotting import figure from PIL import Image -from neptune.new.exceptions import ( +from neptune.exceptions import ( NeptuneException, StreamAlreadyUsedException, ) -from neptune.new.internal.types.file_types import ( +from neptune.internal.types.file_types import ( FileType, InMemoryComposite, ) -from neptune.new.internal.utils.images import _get_pil_image_data -from neptune.new.types import File +from neptune.internal.utils.images import _get_pil_image_data +from neptune.types import File from tests.e2e.utils import tmp_context diff --git a/tests/unit/neptune/types/test_file_casting.py b/tests/unit/neptune/types/test_file_casting.py index 5c068512a..d17ca1572 100644 --- a/tests/unit/neptune/types/test_file_casting.py +++ b/tests/unit/neptune/types/test_file_casting.py @@ -19,7 +19,7 @@ from bokeh.plotting import figure from PIL import Image -from neptune.new.types import ( +from neptune.types import ( Datetime, File, Float, @@ -27,9 +27,9 @@ Integer, String, ) -from neptune.new.types.namespace import Namespace -from neptune.new.types.type_casting import cast_value -from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase +from neptune.types.namespace import Namespace +from neptune.types.type_casting import cast_value +from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase class TestTypeCasting(TestAttributeBase): diff --git a/tests/unit/neptune/utils/api_experiments_factory.py b/tests/unit/neptune/utils/api_experiments_factory.py index 7f391b861..819592de5 100644 --- a/tests/unit/neptune/utils/api_experiments_factory.py +++ b/tests/unit/neptune/utils/api_experiments_factory.py @@ -26,9 +26,9 @@ import uuid from random import randint -from neptune.new.internal.backends.api_model import ApiExperiment -from neptune.new.internal.container_type import ContainerType -from neptune.new.internal.id_formats import ( +from neptune.internal.backends.api_model import ApiExperiment +from neptune.internal.container_type import ContainerType +from neptune.internal.id_formats import ( SysId, UniqueId, ) diff --git a/tests/unit/neptune/websockets/test_websockets_signals_background_job.py b/tests/unit/neptune/websockets/test_websockets_signals_background_job.py index ed135c3d7..cdb71d9da 100644 --- a/tests/unit/neptune/websockets/test_websockets_signals_background_job.py +++ b/tests/unit/neptune/websockets/test_websockets_signals_background_job.py @@ -20,11 +20,11 @@ patch, ) -from neptune.new.internal.websockets.websocket_signals_background_job import WebsocketSignalsBackgroundJob +from neptune.internal.websockets.websocket_signals_background_job import WebsocketSignalsBackgroundJob class TestClient(unittest.TestCase): - @patch("neptune.new.internal.websockets.websocket_signals_background_job.process_killer") + @patch("neptune.internal.websockets.websocket_signals_background_job.process_killer") def test_listener_stop(self, process_killer): # given run, ws = MagicMock(), MagicMock() @@ -40,7 +40,7 @@ def test_listener_stop(self, process_killer): run.stop.assert_called_once_with(seconds=5) process_killer.kill_me.assert_called_once_with() - @patch("neptune.new.internal.websockets.websocket_signals_background_job.process_killer") + @patch("neptune.internal.websockets.websocket_signals_background_job.process_killer") def test_listener_abort(self, process_killer): # given run, ws = MagicMock(), MagicMock() From 57f8c03463f03d57a312fed9ccbf0c7020e25c94 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 15:46:44 +0100 Subject: [PATCH 23/33] Tests updated --- src/neptune/__init__.py | 2 +- src/neptune/exceptions.py | 8 +- src/neptune/handler.py | 18 +-- src/neptune/integrations/python_logger.py | 6 +- src/neptune/legacy/exceptions.py | 2 +- src/neptune/metadata_containers/model.py | 2 +- src/neptune/metadata_containers/project.py | 14 +- src/neptune/metadata_containers/run.py | 14 +- src/neptune/new/run.py | 8 +- src/neptune/new/runs_table.py | 5 +- src/neptune/types/atoms/file.py | 6 +- src/neptune/utils.py | 4 +- tests/unit/neptune/new/__init__.py | 0 .../neptune/{ => new}/attributes/__init__.py | 0 .../{ => new}/attributes/atoms/__init__.py | 0 .../attributes/atoms/test_artifact.py | 2 +- .../attributes/atoms/test_artifact_hash.py | 2 +- .../attributes/atoms/test_datetime.py | 2 +- .../{ => new}/attributes/atoms/test_file.py | 2 +- .../{ => new}/attributes/atoms/test_float.py | 2 +- .../{ => new}/attributes/atoms/test_string.py | 2 +- .../{ => new}/attributes/series/__init__.py | 0 .../attributes/series/test_file_series.py | 4 +- .../attributes/series/test_float_series.py | 2 +- .../attributes/series/test_series.py | 2 +- .../attributes/series/test_string_series.py | 2 +- .../{ => new}/attributes/sets/__init__.py | 0 .../attributes/sets/test_file_set.py | 2 +- .../attributes/sets/test_string_set.py | 2 +- .../attributes/test_attribute_base.py | 0 .../attributes/test_attribute_utils.py | 0 tests/unit/neptune/{ => new}/cli/__init__.py | 0 .../unit/neptune/{ => new}/cli/test_clear.py | 2 +- .../unit/neptune/{ => new}/cli/test_status.py | 2 +- tests/unit/neptune/{ => new}/cli/test_sync.py | 2 +- .../unit/neptune/{ => new}/cli/test_utils.py | 0 tests/unit/neptune/{ => new}/cli/utils.py | 2 +- .../unit/neptune/{ => new}/client/__init__.py | 0 .../client/abstract_experiment_test_mixin.py | 0 .../{ => new}/client/abstract_tables_test.py | 0 .../neptune/{ => new}/client/test_model.py | 4 +- .../{ => new}/client/test_model_tables.py | 2 +- .../{ => new}/client/test_model_version.py | 4 +- .../client/test_model_version_tables.py | 2 +- .../neptune/{ => new}/client/test_project.py | 2 +- .../unit/neptune/{ => new}/client/test_run.py | 4 +- .../{ => new}/client/test_run_tables.py | 2 +- .../neptune/{ => new}/internal/__init__.py | 0 .../{ => new}/internal/artifacts/__init__.py | 0 .../internal/artifacts/drivers/__init__.py | 0 .../internal/artifacts/drivers/test_local.py | 2 +- .../internal/artifacts/drivers/test_s3.py | 2 +- .../internal/artifacts/test_file_hasher.py | 0 .../internal/artifacts/test_serializer.py | 0 .../internal/artifacts/test_types.py | 0 .../{ => new}/internal/artifacts/utils.py | 0 .../{ => new}/internal/backends/__init__.py | 0 .../test_hosted_artifact_operations.py | 0 .../internal/backends/test_hosted_client.py | 2 +- .../backends/test_hosted_file_operations.py | 2 +- .../backends/test_hosted_neptune_backend.py | 2 +- .../backends/test_neptune_backend_mock.py | 0 .../{ => new}/internal/backends/test_nql.py | 0 .../backends/test_operations_preprocessor.py | 2 +- .../backends/test_swagger_client_wrapper.py | 0 .../{ => new}/internal/backends/test_utils.py | 0 .../internal/test_container_structure.py | 0 .../{ => new}/internal/test_credentials.py | 0 .../{ => new}/internal/test_disk_queue.py | 0 .../{ => new}/internal/test_operations.py | 0 .../{ => new}/internal/test_streams.py | 0 .../{ => new}/internal/utils/__init__.py | 0 .../internal/utils/test_deprecation.py | 0 .../{ => new}/internal/utils/test_images.py | 0 .../internal/utils/test_iteration.py | 0 .../internal/utils/test_json_file_splitter.py | 2 +- .../{ => new}/internal/utils/test_utils.py | 0 .../unit/neptune/{ => new}/test_experiment.py | 0 tests/unit/neptune/{ => new}/test_handler.py | 2 +- tests/unit/neptune/{ => new}/test_imports.py | 126 +++++++++++++++++- .../neptune/{ => new}/test_log_handler.py | 0 .../{ => new}/test_stringify_unsupported.py | 0 .../unit/neptune/{ => new}/types/__init__.py | 0 .../neptune/{ => new}/types/atoms/__init__.py | 0 .../{ => new}/types/atoms/test_file.py | 0 .../{ => new}/types/test_file_casting.py | 2 +- .../unit/neptune/{ => new}/utils/__init__.py | 0 .../utils/api_experiments_factory.py | 0 .../neptune/{ => new}/utils/file_helpers.py | 0 .../neptune/{ => new}/websockets/__init__.py | 0 .../test_websockets_signals_background_job.py | 0 91 files changed, 203 insertions(+), 84 deletions(-) create mode 100644 tests/unit/neptune/new/__init__.py rename tests/unit/neptune/{ => new}/attributes/__init__.py (100%) rename tests/unit/neptune/{ => new}/attributes/atoms/__init__.py (100%) rename tests/unit/neptune/{ => new}/attributes/atoms/test_artifact.py (98%) rename tests/unit/neptune/{ => new}/attributes/atoms/test_artifact_hash.py (96%) rename tests/unit/neptune/{ => new}/attributes/atoms/test_datetime.py (96%) rename tests/unit/neptune/{ => new}/attributes/atoms/test_file.py (98%) rename tests/unit/neptune/{ => new}/attributes/atoms/test_float.py (95%) rename tests/unit/neptune/{ => new}/attributes/atoms/test_string.py (94%) rename tests/unit/neptune/{ => new}/attributes/series/__init__.py (100%) rename tests/unit/neptune/{ => new}/attributes/series/test_file_series.py (98%) rename tests/unit/neptune/{ => new}/attributes/series/test_float_series.py (95%) rename tests/unit/neptune/{ => new}/attributes/series/test_series.py (98%) rename tests/unit/neptune/{ => new}/attributes/series/test_string_series.py (95%) rename tests/unit/neptune/{ => new}/attributes/sets/__init__.py (100%) rename tests/unit/neptune/{ => new}/attributes/sets/test_file_set.py (96%) rename tests/unit/neptune/{ => new}/attributes/sets/test_string_set.py (98%) rename tests/unit/neptune/{ => new}/attributes/test_attribute_base.py (100%) rename tests/unit/neptune/{ => new}/attributes/test_attribute_utils.py (100%) rename tests/unit/neptune/{ => new}/cli/__init__.py (100%) rename tests/unit/neptune/{ => new}/cli/test_clear.py (99%) rename tests/unit/neptune/{ => new}/cli/test_status.py (98%) rename tests/unit/neptune/{ => new}/cli/test_sync.py (99%) rename tests/unit/neptune/{ => new}/cli/test_utils.py (100%) rename tests/unit/neptune/{ => new}/cli/utils.py (98%) rename tests/unit/neptune/{ => new}/client/__init__.py (100%) rename tests/unit/neptune/{ => new}/client/abstract_experiment_test_mixin.py (100%) rename tests/unit/neptune/{ => new}/client/abstract_tables_test.py (100%) rename tests/unit/neptune/{ => new}/client/test_model.py (95%) rename tests/unit/neptune/{ => new}/client/test_model_tables.py (93%) rename tests/unit/neptune/{ => new}/client/test_model_version.py (97%) rename tests/unit/neptune/{ => new}/client/test_model_version_tables.py (93%) rename tests/unit/neptune/{ => new}/client/test_project.py (97%) rename tests/unit/neptune/{ => new}/client/test_run.py (97%) rename tests/unit/neptune/{ => new}/client/test_run_tables.py (93%) rename tests/unit/neptune/{ => new}/internal/__init__.py (100%) rename tests/unit/neptune/{ => new}/internal/artifacts/__init__.py (100%) rename tests/unit/neptune/{ => new}/internal/artifacts/drivers/__init__.py (100%) rename tests/unit/neptune/{ => new}/internal/artifacts/drivers/test_local.py (99%) rename tests/unit/neptune/{ => new}/internal/artifacts/drivers/test_s3.py (98%) rename tests/unit/neptune/{ => new}/internal/artifacts/test_file_hasher.py (100%) rename tests/unit/neptune/{ => new}/internal/artifacts/test_serializer.py (100%) rename tests/unit/neptune/{ => new}/internal/artifacts/test_types.py (100%) rename tests/unit/neptune/{ => new}/internal/artifacts/utils.py (100%) rename tests/unit/neptune/{ => new}/internal/backends/__init__.py (100%) rename tests/unit/neptune/{ => new}/internal/backends/test_hosted_artifact_operations.py (100%) rename tests/unit/neptune/{ => new}/internal/backends/test_hosted_client.py (99%) rename tests/unit/neptune/{ => new}/internal/backends/test_hosted_file_operations.py (99%) rename tests/unit/neptune/{ => new}/internal/backends/test_hosted_neptune_backend.py (99%) rename tests/unit/neptune/{ => new}/internal/backends/test_neptune_backend_mock.py (100%) rename tests/unit/neptune/{ => new}/internal/backends/test_nql.py (100%) rename tests/unit/neptune/{ => new}/internal/backends/test_operations_preprocessor.py (99%) rename tests/unit/neptune/{ => new}/internal/backends/test_swagger_client_wrapper.py (100%) rename tests/unit/neptune/{ => new}/internal/backends/test_utils.py (100%) rename tests/unit/neptune/{ => new}/internal/test_container_structure.py (100%) rename tests/unit/neptune/{ => new}/internal/test_credentials.py (100%) rename tests/unit/neptune/{ => new}/internal/test_disk_queue.py (100%) rename tests/unit/neptune/{ => new}/internal/test_operations.py (100%) rename tests/unit/neptune/{ => new}/internal/test_streams.py (100%) rename tests/unit/neptune/{ => new}/internal/utils/__init__.py (100%) rename tests/unit/neptune/{ => new}/internal/utils/test_deprecation.py (100%) rename tests/unit/neptune/{ => new}/internal/utils/test_images.py (100%) rename tests/unit/neptune/{ => new}/internal/utils/test_iteration.py (100%) rename tests/unit/neptune/{ => new}/internal/utils/test_json_file_splitter.py (98%) rename tests/unit/neptune/{ => new}/internal/utils/test_utils.py (100%) rename tests/unit/neptune/{ => new}/test_experiment.py (100%) rename tests/unit/neptune/{ => new}/test_handler.py (99%) rename tests/unit/neptune/{ => new}/test_imports.py (54%) rename tests/unit/neptune/{ => new}/test_log_handler.py (100%) rename tests/unit/neptune/{ => new}/test_stringify_unsupported.py (100%) rename tests/unit/neptune/{ => new}/types/__init__.py (100%) rename tests/unit/neptune/{ => new}/types/atoms/__init__.py (100%) rename tests/unit/neptune/{ => new}/types/atoms/test_file.py (100%) rename tests/unit/neptune/{ => new}/types/test_file_casting.py (96%) rename tests/unit/neptune/{ => new}/utils/__init__.py (100%) rename tests/unit/neptune/{ => new}/utils/api_experiments_factory.py (100%) rename tests/unit/neptune/{ => new}/utils/file_helpers.py (100%) rename tests/unit/neptune/{ => new}/websockets/__init__.py (100%) rename tests/unit/neptune/{ => new}/websockets/test_websockets_signals_background_job.py (100%) diff --git a/src/neptune/__init__.py b/src/neptune/__init__.py index ac57857e9..3a505e5e2 100644 --- a/src/neptune/__init__.py +++ b/src/neptune/__init__.py @@ -56,7 +56,7 @@ def get_last_run() -> Optional[Run]: ``Run``: object last created by neptune global object. Examples: - >>> import neptune.new as neptune + >>> import neptune >>> # Crate a new tracked run ... neptune.init_run(name='A new approach', source_files='**/*.py') diff --git a/src/neptune/exceptions.py b/src/neptune/exceptions.py index 62e9e06ba..1c20b3a6a 100644 --- a/src/neptune/exceptions.py +++ b/src/neptune/exceptions.py @@ -117,6 +117,10 @@ NeptuneSSLVerificationError, Unauthorized, ) +from neptune.envs import ( + CUSTOM_RUN_ID_ENV_NAME, + PROJECT_ENV_NAME, +) from neptune.internal.backends.api_model import ( Project, Workspace, @@ -124,8 +128,6 @@ from neptune.internal.container_type import ContainerType from neptune.internal.id_formats import QualifiedName from neptune.internal.utils import replace_patch_version -from neptune.new import envs -from neptune.new.envs import CUSTOM_RUN_ID_ENV_NAME class MetadataInconsistency(NeptuneException): @@ -393,7 +395,7 @@ def __init__( message=message, available_projects=available_projects, available_workspaces=available_workspaces, - env_project=envs.PROJECT_ENV_NAME, + env_project=PROJECT_ENV_NAME, ) diff --git a/src/neptune/handler.py b/src/neptune/handler.py index 112b6389f..3ae245e5a 100644 --- a/src/neptune/handler.py +++ b/src/neptune/handler.py @@ -42,6 +42,11 @@ # backwards compatibility from neptune.common.exceptions import NeptuneException # noqa: F401 +from neptune.exceptions import ( + MissingFieldException, + NeptuneCannotChangeStageManually, + NeptuneUserApiInputException, +) from neptune.internal.artifacts.types import ArtifactFileData from neptune.internal.utils import ( is_collection, @@ -59,11 +64,6 @@ parse_path, ) from neptune.internal.value_to_attribute_visitor import ValueToAttributeVisitor -from neptune.new.exceptions import ( - MissingFieldException, - NeptuneCannotChangeStageManually, - NeptuneUserApiInputException, -) from neptune.types.atoms.file import File as FileVal from neptune.types.type_casting import cast_value_for_extend from neptune.types.value_copy import ValueCopy @@ -183,7 +183,7 @@ def assign(self, value, wait: bool = False) -> None: Examples: Assigning values: - >>> import neptune.new as neptune + >>> import neptune >>> run = neptune.init_run() >>> # You can both use the Python assign operator (=) @@ -226,7 +226,7 @@ def upload(self, value, wait: bool = False) -> None: Defaults to `False`. Examples: - >>> import neptune.new as neptune + >>> import neptune >>> run = neptune.init_run() >>> # Upload example data @@ -374,7 +374,7 @@ def append( For details, see https://docs.neptune.ai/api/universal/#wait Examples: - >>> import neptune.new as neptune + >>> import neptune >>> run = neptune.init_run() >>> for epoch in range(n_epochs): ... ... # Your training loop @@ -424,7 +424,7 @@ def extend( Example: The following example reads a CSV file into a pandas DataFrame and extracts the values to create a Neptune series. - >>> import neptune.new as neptune + >>> import neptune >>> run = neptune.init_run() >>> for epoch in range(n_epochs): ... df = pandas.read_csv("time_series.csv") diff --git a/src/neptune/integrations/python_logger.py b/src/neptune/integrations/python_logger.py index fe25ed34d..f55cd72b5 100644 --- a/src/neptune/integrations/python_logger.py +++ b/src/neptune/integrations/python_logger.py @@ -19,9 +19,9 @@ import threading from neptune import Run +from neptune.internal.state import ContainerState from neptune.internal.utils import verify_type from neptune.logging import Logger -from neptune.new.run import RunState from neptune.version import version as neptune_client_version INTEGRATION_VERSION_KEY = "source_code/integrations/neptune-python-logger" @@ -40,7 +40,7 @@ class NeptuneHandler(logging.Handler): Examples: >>> import logging - >>> import neptune.new as neptune + >>> import neptune >>> from neptune.integrations.python_logger import NeptuneHandler >>> logger = logging.getLogger("root_experiment") @@ -73,7 +73,7 @@ def emit(self, record: logging.LogRecord) -> None: if not hasattr(self._thread_local, "inside_write"): self._thread_local.inside_write = False - if self._run._state == RunState.STARTED and not self._thread_local.inside_write: + if self._run._state == ContainerState.STARTED and not self._thread_local.inside_write: try: self._thread_local.inside_write = True message = self.format(record) diff --git a/src/neptune/legacy/exceptions.py b/src/neptune/legacy/exceptions.py index b228585b9..403eb6f40 100644 --- a/src/neptune/legacy/exceptions.py +++ b/src/neptune/legacy/exceptions.py @@ -340,7 +340,7 @@ def __init__(self): It seems you are trying to use the new Python API, but imported the legacy API. Simply update your import statement to: - {python}import neptune.new as neptune{end} + {python}import neptune{end} You may also want to check the following docs pages: - https://docs.neptune.ai/about/legacy/#migrating-to-neptunenew diff --git a/src/neptune/metadata_containers/model.py b/src/neptune/metadata_containers/model.py index 992a37809..8fdf5a88a 100644 --- a/src/neptune/metadata_containers/model.py +++ b/src/neptune/metadata_containers/model.py @@ -81,7 +81,7 @@ def fetch_model_versions_table(self, columns: Optional[Iterable[str]] = None) -> Use `to_pandas()` to convert it to a pandas DataFrame. Examples: - >>> import neptune.new as neptune + >>> import neptune >>> # Initialize model with the ID "CLS-FOREST" ... model = neptune.init_model(model="CLS-FOREST") diff --git a/src/neptune/metadata_containers/project.py b/src/neptune/metadata_containers/project.py index b4e0740e9..625c968f2 100644 --- a/src/neptune/metadata_containers/project.py +++ b/src/neptune/metadata_containers/project.py @@ -225,7 +225,7 @@ def fetch_runs_table( Use `to_pandas()` to convert the table to a pandas DataFrame. Examples: - >>> import neptune.new as neptune + >>> import neptune >>> # Fetch project "jackie/sandbox" ... project = neptune.init_project(mode="read-only", name="jackie/sandbox") @@ -291,7 +291,7 @@ def fetch_models_table(self, columns: Optional[Iterable[str]] = None) -> Table: Use `to_pandas()` to convert the table to a pandas DataFrame. Examples: - >>> import neptune.new as neptune + >>> import neptune >>> # Fetch project "jackie/sandbox" ... project = neptune.init_project(mode="read-only", name="jackie/sandbox") @@ -336,7 +336,7 @@ def assign(self, value, wait: bool = False) -> None: wait (bool, optional): If `True` the client will first wait to send all tracked metadata to the server. This makes the call synchronous. Defaults to `False`. Examples: - >>> import neptune.new as neptune + >>> import neptune >>> project = neptune.init_project(name="MY_WORKSPACE/MY_PROJECT") >>> # Assign multiple fields from a dictionary ... general_info = {"brief": URL_TO_PROJECT_BRIEF, "deadline": "2049-06-30"} @@ -361,7 +361,7 @@ def fetch(self) -> dict: Returns: `dict` containing all non-File Atom fields values. Examples: - >>> import neptune.new as neptune + >>> import neptune >>> project = neptune.init_project(name="MY_WORKSPACE/MY_PROJECT") >>> # Fetch all the project metrics >>> project_metrics = project["metrics"].fetch() @@ -383,7 +383,7 @@ def stop(self, seconds: Optional[Union[float, int]] = None) -> None: If `None` will wait for all tracking calls to finish. Defaults to `True`. Examples: If you are initializing the connection from a script you don't need to call `.stop()`: - >>> import neptune.new as neptune + >>> import neptune >>> project = neptune.init_project(name="MY_WORKSPACE/MY_PROJECT") >>> # Your code ... pass @@ -392,7 +392,7 @@ def stop(self, seconds: Optional[Union[float, int]] = None) -> None: If you are initializing multiple connection from one script it is a good practice to .stop() the unneeded connections. You can also use Context Managers - Neptune will automatically call .stop() on the destruction of Project context: - >>> import neptune.new as neptune + >>> import neptune >>> # If you are initializing multiple connections from the same script ... # stop the connection manually once not needed ... for project_name in projects: @@ -441,7 +441,7 @@ def pop(self, path: str, wait: bool = False) -> None: wait (bool, optional): If `True` the client will first wait to send all tracked metadata to the server. This makes the call synchronous. Defaults to `False`. Examples: - >>> import neptune.new as neptune + >>> import neptune >>> project = neptune.init_project(name="MY_WORKSPACE/MY_PROJECT") >>> # Delete a field along with it's data ... project.pop("datasets/v0.4") diff --git a/src/neptune/metadata_containers/run.py b/src/neptune/metadata_containers/run.py index 6ea646221..260d85a10 100644 --- a/src/neptune/metadata_containers/run.py +++ b/src/neptune/metadata_containers/run.py @@ -52,7 +52,7 @@ class Run(MetadataContainer): * and much more Examples: - >>> import neptune.new as neptune + >>> import neptune >>> # Create new experiment ... run = neptune.init_run('my_workspace/my_project') @@ -175,7 +175,7 @@ def assign(self, value, wait: bool = False) -> None: wait (bool, optional): If `True` the client will first wait to send all tracked metadata to the server. This makes the call synchronous. Defaults to `False`. Examples: - >>> import neptune.new as neptune + >>> import neptune >>> run = neptune.init_run() >>> # Assign multiple fields from a dictionary ... params = {"max_epochs": 10, "optimizer": "Adam"} @@ -201,7 +201,7 @@ def fetch(self) -> dict: Returns: `dict` containing all non-File Atom fields values. Examples: - >>> import neptune.new as neptune + >>> import neptune >>> resumed_run = neptune.init_run(with_id="HEL-3") >>> params = resumed_run['model/parameters'].fetch() >>> run_data = resumed_run.fetch() @@ -225,7 +225,7 @@ def stop(self, seconds: Optional[Union[float, int]] = None) -> None: If `None` will wait for all tracking calls to finish. Defaults to `True`. Examples: If you are creating tracked runs from the script you don't need to call `.stop()`: - >>> import neptune.new as neptune + >>> import neptune >>> run = neptune.init_run() >>> # Your training or monitoring code ... pass @@ -235,7 +235,7 @@ def stop(self, seconds: Optional[Union[float, int]] = None) -> None: to `.stop()` the finished tracked runs as every open run keeps an open connection with Neptune, monitors hardware usage, etc. You can also use Context Managers - Neptune will automatically call `.stop()` on the destruction of Run context: - >>> import neptune.new as neptune + >>> import neptune >>> # If you are running consecutive training jobs from the same script ... # stop the tracked runs manually at the end of single training job ... for config in configs: @@ -283,7 +283,7 @@ def pop(self, path: str, wait: bool = False) -> None: wait (bool, optional): If `True` the client will first wait to send all tracked metadata to the server. This makes the call synchronous. Defaults to `True`. Examples: - >>> import neptune.new as neptune + >>> import neptune >>> run = neptune.init_run() >>> run['parameters/learninggg_rata'] = 0.3 >>> # Delete a field along with it's data @@ -318,7 +318,7 @@ def sync(self, wait: bool = True) -> None: locally from memory, but will not wait for them to reach Neptune servers. Defaults to `True`. Examples: - >>> import neptune.new as neptune + >>> import neptune >>> # Connect to a run from Worker #3 ... worker_id = 3 >>> run = neptune.init_run(with_id='DIST-43', monitoring_namespace='monitoring/{}'.format(worker_id)) diff --git a/src/neptune/new/run.py b/src/neptune/new/run.py index 9d1d95d1a..f9ba94c59 100644 --- a/src/neptune/new/run.py +++ b/src/neptune/new/run.py @@ -36,14 +36,14 @@ from neptune.attributes.attribute import Attribute from neptune.attributes.namespace import Namespace as NamespaceAttr from neptune.attributes.namespace import NamespaceBuilder -from neptune.internal.state import ContainerState as RunState -from neptune.metadata_containers import Run -from neptune.new.exceptions import ( +from neptune.exceptions import ( InactiveRunException, MetadataInconsistency, NeptunePossibleLegacyUsageException, ) -from neptune.new.handler import Handler +from neptune.handler import Handler +from neptune.internal.state import ContainerState as RunState +from neptune.metadata_containers import Run from neptune.types import ( Boolean, Integer, diff --git a/src/neptune/new/runs_table.py b/src/neptune/new/runs_table.py index 761bf1338..a4fa3e611 100644 --- a/src/neptune/new/runs_table.py +++ b/src/neptune/new/runs_table.py @@ -25,6 +25,8 @@ "RunsTableEntry", ] +# backwards compatibility +from neptune.exceptions import MetadataInconsistency from neptune.internal.backends.api_model import ( AttributeType, AttributeWithProperties, @@ -37,6 +39,3 @@ ) from neptune.metadata_containers.metadata_containers_table import Table as RunsTable from neptune.metadata_containers.metadata_containers_table import TableEntry as RunsTableEntry - -# backwards compatibility -from neptune.new.exceptions import MetadataInconsistency diff --git a/src/neptune/types/atoms/file.py b/src/neptune/types/atoms/file.py index 8bddbb8a4..439c0dc28 100644 --- a/src/neptune/types/atoms/file.py +++ b/src/neptune/types/atoms/file.py @@ -184,7 +184,7 @@ def as_image(image) -> "File": ``File``: value object with converted image Examples: - >>> import neptune.new as neptune + >>> import neptune >>> from neptune.types import File >>> run = neptune.init_run() @@ -225,7 +225,7 @@ def as_html(chart) -> "File": ``File``: value object with converted object. Examples: - >>> import neptune.new as neptune + >>> import neptune >>> from neptune.types import File >>> run = neptune.init_run() @@ -265,7 +265,7 @@ def as_pickle(obj) -> "File": ``File``: value object with pickled object. Examples: - >>> import neptune.new as neptune + >>> import neptune >>> from neptune.types import File >>> run = neptune.init_run() diff --git a/src/neptune/utils.py b/src/neptune/utils.py index 850a5182f..5e48bd730 100644 --- a/src/neptune/utils.py +++ b/src/neptune/utils.py @@ -31,12 +31,12 @@ def stringify_unsupported(value: Any) -> Union[StringifyValue, Mapping, List, Tu Args: value (Any): A dictionary with values or a collection Example: - >>> import neptune.new as neptune + >>> import neptune >>> run = neptune.init_run() >>> complex_dict = {"tuple": ("hi", 1), "metric": 0.87} >>> run["complex_dict"] = complex_dict >>> # (as of 1.0.0) error - tuple is not a supported type - ... from neptune.new.utils import stringify_unsupported + ... from neptune.utils import stringify_unsupported >>> run["complex_dict"] = stringify_unsupported(complex_dict) For more information, see: diff --git a/tests/unit/neptune/new/__init__.py b/tests/unit/neptune/new/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/unit/neptune/attributes/__init__.py b/tests/unit/neptune/new/attributes/__init__.py similarity index 100% rename from tests/unit/neptune/attributes/__init__.py rename to tests/unit/neptune/new/attributes/__init__.py diff --git a/tests/unit/neptune/attributes/atoms/__init__.py b/tests/unit/neptune/new/attributes/atoms/__init__.py similarity index 100% rename from tests/unit/neptune/attributes/atoms/__init__.py rename to tests/unit/neptune/new/attributes/atoms/__init__.py diff --git a/tests/unit/neptune/attributes/atoms/test_artifact.py b/tests/unit/neptune/new/attributes/atoms/test_artifact.py similarity index 98% rename from tests/unit/neptune/attributes/atoms/test_artifact.py rename to tests/unit/neptune/new/attributes/atoms/test_artifact.py index 4d62d4ead..b3cf7ef9f 100644 --- a/tests/unit/neptune/attributes/atoms/test_artifact.py +++ b/tests/unit/neptune/new/attributes/atoms/test_artifact.py @@ -35,7 +35,7 @@ from neptune.internal.operation import TrackFilesToArtifact from neptune.internal.utils.paths import path_to_str from neptune.types.atoms.artifact import Artifact as ArtifactAttr -from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase class TestArtifact(TestAttributeBase): diff --git a/tests/unit/neptune/attributes/atoms/test_artifact_hash.py b/tests/unit/neptune/new/attributes/atoms/test_artifact_hash.py similarity index 96% rename from tests/unit/neptune/attributes/atoms/test_artifact_hash.py rename to tests/unit/neptune/new/attributes/atoms/test_artifact_hash.py index 926e227c9..a065512ec 100644 --- a/tests/unit/neptune/attributes/atoms/test_artifact_hash.py +++ b/tests/unit/neptune/new/attributes/atoms/test_artifact_hash.py @@ -18,7 +18,7 @@ from neptune.attributes.atoms.artifact import Artifact from neptune.internal.operation import AssignArtifact from neptune.types.atoms.artifact import Artifact as ArtifactVal -from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase class TestArtifactHash(TestAttributeBase): diff --git a/tests/unit/neptune/attributes/atoms/test_datetime.py b/tests/unit/neptune/new/attributes/atoms/test_datetime.py similarity index 96% rename from tests/unit/neptune/attributes/atoms/test_datetime.py rename to tests/unit/neptune/new/attributes/atoms/test_datetime.py index 0e16fe700..3ce25399d 100644 --- a/tests/unit/neptune/attributes/atoms/test_datetime.py +++ b/tests/unit/neptune/new/attributes/atoms/test_datetime.py @@ -23,7 +23,7 @@ DatetimeVal, ) from neptune.internal.operation import AssignDatetime -from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase class TestDatetime(TestAttributeBase): diff --git a/tests/unit/neptune/attributes/atoms/test_file.py b/tests/unit/neptune/new/attributes/atoms/test_file.py similarity index 98% rename from tests/unit/neptune/attributes/atoms/test_file.py rename to tests/unit/neptune/new/attributes/atoms/test_file.py index fed714fa1..51dc1042e 100644 --- a/tests/unit/neptune/attributes/atoms/test_file.py +++ b/tests/unit/neptune/new/attributes/atoms/test_file.py @@ -39,7 +39,7 @@ ) from neptune.internal.types.file_types import FileType from tests.e2e.utils import tmp_context -from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase class TestFile(TestAttributeBase): diff --git a/tests/unit/neptune/attributes/atoms/test_float.py b/tests/unit/neptune/new/attributes/atoms/test_float.py similarity index 95% rename from tests/unit/neptune/attributes/atoms/test_float.py rename to tests/unit/neptune/new/attributes/atoms/test_float.py index 0c31db2b2..e051984a1 100644 --- a/tests/unit/neptune/attributes/atoms/test_float.py +++ b/tests/unit/neptune/new/attributes/atoms/test_float.py @@ -20,7 +20,7 @@ FloatVal, ) from neptune.internal.operation import AssignFloat -from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase class TestFloat(TestAttributeBase): diff --git a/tests/unit/neptune/attributes/atoms/test_string.py b/tests/unit/neptune/new/attributes/atoms/test_string.py similarity index 94% rename from tests/unit/neptune/attributes/atoms/test_string.py rename to tests/unit/neptune/new/attributes/atoms/test_string.py index 46dd99f66..83c2d42a7 100644 --- a/tests/unit/neptune/attributes/atoms/test_string.py +++ b/tests/unit/neptune/new/attributes/atoms/test_string.py @@ -20,7 +20,7 @@ StringVal, ) from neptune.internal.operation import AssignString -from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase class TestString(TestAttributeBase): diff --git a/tests/unit/neptune/attributes/series/__init__.py b/tests/unit/neptune/new/attributes/series/__init__.py similarity index 100% rename from tests/unit/neptune/attributes/series/__init__.py rename to tests/unit/neptune/new/attributes/series/__init__.py diff --git a/tests/unit/neptune/attributes/series/test_file_series.py b/tests/unit/neptune/new/attributes/series/test_file_series.py similarity index 98% rename from tests/unit/neptune/attributes/series/test_file_series.py rename to tests/unit/neptune/new/attributes/series/test_file_series.py index a4c0dd6b8..5dd4b674d 100644 --- a/tests/unit/neptune/attributes/series/test_file_series.py +++ b/tests/unit/neptune/new/attributes/series/test_file_series.py @@ -33,8 +33,8 @@ ) from neptune.internal.utils import base64_encode from neptune.types import File -from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase -from tests.unit.neptune.utils.file_helpers import create_file +from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.new.utils.file_helpers import create_file @patch("time.time", new=TestAttributeBase._now) diff --git a/tests/unit/neptune/attributes/series/test_float_series.py b/tests/unit/neptune/new/attributes/series/test_float_series.py similarity index 95% rename from tests/unit/neptune/attributes/series/test_float_series.py rename to tests/unit/neptune/new/attributes/series/test_float_series.py index 7722fd302..442a1dc27 100644 --- a/tests/unit/neptune/attributes/series/test_float_series.py +++ b/tests/unit/neptune/new/attributes/series/test_float_series.py @@ -19,7 +19,7 @@ ) from neptune.attributes.series.float_series import FloatSeries -from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase @patch("time.time", new=TestAttributeBase._now) diff --git a/tests/unit/neptune/attributes/series/test_series.py b/tests/unit/neptune/new/attributes/series/test_series.py similarity index 98% rename from tests/unit/neptune/attributes/series/test_series.py rename to tests/unit/neptune/new/attributes/series/test_series.py index 4c60ffe3f..25b053f71 100644 --- a/tests/unit/neptune/attributes/series/test_series.py +++ b/tests/unit/neptune/new/attributes/series/test_series.py @@ -33,7 +33,7 @@ ConfigFloatSeries, LogFloats, ) -from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase @patch("time.time", new=TestAttributeBase._now) diff --git a/tests/unit/neptune/attributes/series/test_string_series.py b/tests/unit/neptune/new/attributes/series/test_string_series.py similarity index 95% rename from tests/unit/neptune/attributes/series/test_string_series.py rename to tests/unit/neptune/new/attributes/series/test_string_series.py index a2df7b1c0..4683fe93e 100644 --- a/tests/unit/neptune/attributes/series/test_string_series.py +++ b/tests/unit/neptune/new/attributes/series/test_string_series.py @@ -19,7 +19,7 @@ ) from neptune.attributes.series.string_series import StringSeries -from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase @patch("time.time", new=TestAttributeBase._now) diff --git a/tests/unit/neptune/attributes/sets/__init__.py b/tests/unit/neptune/new/attributes/sets/__init__.py similarity index 100% rename from tests/unit/neptune/attributes/sets/__init__.py rename to tests/unit/neptune/new/attributes/sets/__init__.py diff --git a/tests/unit/neptune/attributes/sets/test_file_set.py b/tests/unit/neptune/new/attributes/sets/test_file_set.py similarity index 96% rename from tests/unit/neptune/attributes/sets/test_file_set.py rename to tests/unit/neptune/new/attributes/sets/test_file_set.py index 103411729..8f009b64e 100644 --- a/tests/unit/neptune/attributes/sets/test_file_set.py +++ b/tests/unit/neptune/new/attributes/sets/test_file_set.py @@ -22,7 +22,7 @@ DeleteFiles, UploadFileSet, ) -from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase class TestFileSet(TestAttributeBase): diff --git a/tests/unit/neptune/attributes/sets/test_string_set.py b/tests/unit/neptune/new/attributes/sets/test_string_set.py similarity index 98% rename from tests/unit/neptune/attributes/sets/test_string_set.py rename to tests/unit/neptune/new/attributes/sets/test_string_set.py index c30cfae32..50784defe 100644 --- a/tests/unit/neptune/attributes/sets/test_string_set.py +++ b/tests/unit/neptune/new/attributes/sets/test_string_set.py @@ -27,7 +27,7 @@ ClearStringSet, RemoveStrings, ) -from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase class TestStringSet(TestAttributeBase): diff --git a/tests/unit/neptune/attributes/test_attribute_base.py b/tests/unit/neptune/new/attributes/test_attribute_base.py similarity index 100% rename from tests/unit/neptune/attributes/test_attribute_base.py rename to tests/unit/neptune/new/attributes/test_attribute_base.py diff --git a/tests/unit/neptune/attributes/test_attribute_utils.py b/tests/unit/neptune/new/attributes/test_attribute_utils.py similarity index 100% rename from tests/unit/neptune/attributes/test_attribute_utils.py rename to tests/unit/neptune/new/attributes/test_attribute_utils.py diff --git a/tests/unit/neptune/cli/__init__.py b/tests/unit/neptune/new/cli/__init__.py similarity index 100% rename from tests/unit/neptune/cli/__init__.py rename to tests/unit/neptune/new/cli/__init__.py diff --git a/tests/unit/neptune/cli/test_clear.py b/tests/unit/neptune/new/cli/test_clear.py similarity index 99% rename from tests/unit/neptune/cli/test_clear.py rename to tests/unit/neptune/new/cli/test_clear.py index dfedb89b2..6117b3194 100644 --- a/tests/unit/neptune/cli/test_clear.py +++ b/tests/unit/neptune/new/cli/test_clear.py @@ -27,7 +27,7 @@ ) from neptune.internal.container_type import ContainerType from neptune.internal.operation import Operation -from tests.unit.neptune.cli.utils import ( +from tests.unit.neptune.new.cli.utils import ( generate_get_metadata_container, prepare_metadata_container, ) diff --git a/tests/unit/neptune/cli/test_status.py b/tests/unit/neptune/new/cli/test_status.py similarity index 98% rename from tests/unit/neptune/cli/test_status.py rename to tests/unit/neptune/new/cli/test_status.py index 68809bde3..503e6f7ff 100644 --- a/tests/unit/neptune/cli/test_status.py +++ b/tests/unit/neptune/new/cli/test_status.py @@ -21,7 +21,7 @@ from neptune.cli.utils import get_qualified_name from neptune.internal.container_type import ContainerType from neptune.internal.operation import Operation -from tests.unit.neptune.cli.utils import ( +from tests.unit.neptune.new.cli.utils import ( generate_get_metadata_container, prepare_metadata_container, ) diff --git a/tests/unit/neptune/cli/test_sync.py b/tests/unit/neptune/new/cli/test_sync.py similarity index 99% rename from tests/unit/neptune/cli/test_sync.py rename to tests/unit/neptune/new/cli/test_sync.py index 7fdaee1c2..ce1b3c7c9 100644 --- a/tests/unit/neptune/cli/test_sync.py +++ b/tests/unit/neptune/new/cli/test_sync.py @@ -22,7 +22,7 @@ from neptune.cli.utils import get_qualified_name from neptune.internal.container_type import ContainerType from neptune.internal.operation import Operation -from tests.unit.neptune.cli.utils import ( +from tests.unit.neptune.new.cli.utils import ( execute_operations, generate_get_metadata_container, prepare_deprecated_run, diff --git a/tests/unit/neptune/cli/test_utils.py b/tests/unit/neptune/new/cli/test_utils.py similarity index 100% rename from tests/unit/neptune/cli/test_utils.py rename to tests/unit/neptune/new/cli/test_utils.py diff --git a/tests/unit/neptune/cli/utils.py b/tests/unit/neptune/new/cli/utils.py similarity index 98% rename from tests/unit/neptune/cli/utils.py rename to tests/unit/neptune/new/cli/utils.py index 2ac3b61b5..3d93e33de 100644 --- a/tests/unit/neptune/cli/utils.py +++ b/tests/unit/neptune/new/cli/utils.py @@ -28,7 +28,7 @@ from neptune.internal.container_type import ContainerType from neptune.internal.disk_queue import DiskQueue from neptune.internal.utils.sync_offset_file import SyncOffsetFile -from tests.unit.neptune.utils.api_experiments_factory import ( +from tests.unit.neptune.new.utils.api_experiments_factory import ( api_metadata_container, api_run, ) diff --git a/tests/unit/neptune/client/__init__.py b/tests/unit/neptune/new/client/__init__.py similarity index 100% rename from tests/unit/neptune/client/__init__.py rename to tests/unit/neptune/new/client/__init__.py diff --git a/tests/unit/neptune/client/abstract_experiment_test_mixin.py b/tests/unit/neptune/new/client/abstract_experiment_test_mixin.py similarity index 100% rename from tests/unit/neptune/client/abstract_experiment_test_mixin.py rename to tests/unit/neptune/new/client/abstract_experiment_test_mixin.py diff --git a/tests/unit/neptune/client/abstract_tables_test.py b/tests/unit/neptune/new/client/abstract_tables_test.py similarity index 100% rename from tests/unit/neptune/client/abstract_tables_test.py rename to tests/unit/neptune/new/client/abstract_tables_test.py diff --git a/tests/unit/neptune/client/test_model.py b/tests/unit/neptune/new/client/test_model.py similarity index 95% rename from tests/unit/neptune/client/test_model.py rename to tests/unit/neptune/new/client/test_model.py index 93e43c39e..3dac67d2c 100644 --- a/tests/unit/neptune/client/test_model.py +++ b/tests/unit/neptune/new/client/test_model.py @@ -38,8 +38,8 @@ IntAttribute, ) from neptune.internal.backends.neptune_backend_mock import NeptuneBackendMock -from tests.unit.neptune.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin -from tests.unit.neptune.utils.api_experiments_factory import api_model +from tests.unit.neptune.new.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin +from tests.unit.neptune.new.utils.api_experiments_factory import api_model AN_API_MODEL = api_model() diff --git a/tests/unit/neptune/client/test_model_tables.py b/tests/unit/neptune/new/client/test_model_tables.py similarity index 93% rename from tests/unit/neptune/client/test_model_tables.py rename to tests/unit/neptune/new/client/test_model_tables.py index 750cc9d83..18c56cc88 100644 --- a/tests/unit/neptune/client/test_model_tables.py +++ b/tests/unit/neptune/new/client/test_model_tables.py @@ -23,7 +23,7 @@ Table, TableEntry, ) -from tests.unit.neptune.client.abstract_tables_test import AbstractTablesTestMixin +from tests.unit.neptune.new.client.abstract_tables_test import AbstractTablesTestMixin class TestModelTables(AbstractTablesTestMixin, unittest.TestCase): diff --git a/tests/unit/neptune/client/test_model_version.py b/tests/unit/neptune/new/client/test_model_version.py similarity index 97% rename from tests/unit/neptune/client/test_model_version.py rename to tests/unit/neptune/new/client/test_model_version.py index 56121cd0e..cc10d29e1 100644 --- a/tests/unit/neptune/client/test_model_version.py +++ b/tests/unit/neptune/new/client/test_model_version.py @@ -41,8 +41,8 @@ ) from neptune.internal.backends.neptune_backend_mock import NeptuneBackendMock from neptune.internal.container_type import ContainerType -from tests.unit.neptune.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin -from tests.unit.neptune.utils.api_experiments_factory import ( +from tests.unit.neptune.new.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin +from tests.unit.neptune.new.utils.api_experiments_factory import ( api_model, api_model_version, ) diff --git a/tests/unit/neptune/client/test_model_version_tables.py b/tests/unit/neptune/new/client/test_model_version_tables.py similarity index 93% rename from tests/unit/neptune/client/test_model_version_tables.py rename to tests/unit/neptune/new/client/test_model_version_tables.py index bfdb91c2c..ba3ea856b 100644 --- a/tests/unit/neptune/client/test_model_version_tables.py +++ b/tests/unit/neptune/new/client/test_model_version_tables.py @@ -23,7 +23,7 @@ Table, TableEntry, ) -from tests.unit.neptune.client.abstract_tables_test import AbstractTablesTestMixin +from tests.unit.neptune.new.client.abstract_tables_test import AbstractTablesTestMixin class TestModelVersionTables(AbstractTablesTestMixin, unittest.TestCase): diff --git a/tests/unit/neptune/client/test_project.py b/tests/unit/neptune/new/client/test_project.py similarity index 97% rename from tests/unit/neptune/client/test_project.py rename to tests/unit/neptune/new/client/test_project.py index 26d3e7710..37cacfe0d 100644 --- a/tests/unit/neptune/client/test_project.py +++ b/tests/unit/neptune/new/client/test_project.py @@ -34,7 +34,7 @@ IntAttribute, ) from neptune.internal.backends.neptune_backend_mock import NeptuneBackendMock -from tests.unit.neptune.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin +from tests.unit.neptune.new.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin @patch( diff --git a/tests/unit/neptune/client/test_run.py b/tests/unit/neptune/new/client/test_run.py similarity index 97% rename from tests/unit/neptune/client/test_run.py rename to tests/unit/neptune/new/client/test_run.py index fb7670835..4c895d1f4 100644 --- a/tests/unit/neptune/client/test_run.py +++ b/tests/unit/neptune/new/client/test_run.py @@ -40,8 +40,8 @@ IntAttribute, ) from neptune.internal.backends.neptune_backend_mock import NeptuneBackendMock -from tests.unit.neptune.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin -from tests.unit.neptune.utils.api_experiments_factory import api_run +from tests.unit.neptune.new.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin +from tests.unit.neptune.new.utils.api_experiments_factory import api_run AN_API_RUN = api_run() diff --git a/tests/unit/neptune/client/test_run_tables.py b/tests/unit/neptune/new/client/test_run_tables.py similarity index 93% rename from tests/unit/neptune/client/test_run_tables.py rename to tests/unit/neptune/new/client/test_run_tables.py index 73f4d33c7..f97ae6046 100644 --- a/tests/unit/neptune/client/test_run_tables.py +++ b/tests/unit/neptune/new/client/test_run_tables.py @@ -23,7 +23,7 @@ Table, TableEntry, ) -from tests.unit.neptune.client.abstract_tables_test import AbstractTablesTestMixin +from tests.unit.neptune.new.client.abstract_tables_test import AbstractTablesTestMixin class TestRunTables(AbstractTablesTestMixin, unittest.TestCase): diff --git a/tests/unit/neptune/internal/__init__.py b/tests/unit/neptune/new/internal/__init__.py similarity index 100% rename from tests/unit/neptune/internal/__init__.py rename to tests/unit/neptune/new/internal/__init__.py diff --git a/tests/unit/neptune/internal/artifacts/__init__.py b/tests/unit/neptune/new/internal/artifacts/__init__.py similarity index 100% rename from tests/unit/neptune/internal/artifacts/__init__.py rename to tests/unit/neptune/new/internal/artifacts/__init__.py diff --git a/tests/unit/neptune/internal/artifacts/drivers/__init__.py b/tests/unit/neptune/new/internal/artifacts/drivers/__init__.py similarity index 100% rename from tests/unit/neptune/internal/artifacts/drivers/__init__.py rename to tests/unit/neptune/new/internal/artifacts/drivers/__init__.py diff --git a/tests/unit/neptune/internal/artifacts/drivers/test_local.py b/tests/unit/neptune/new/internal/artifacts/drivers/test_local.py similarity index 99% rename from tests/unit/neptune/internal/artifacts/drivers/test_local.py rename to tests/unit/neptune/new/internal/artifacts/drivers/test_local.py index b687861da..5db8e991e 100644 --- a/tests/unit/neptune/internal/artifacts/drivers/test_local.py +++ b/tests/unit/neptune/new/internal/artifacts/drivers/test_local.py @@ -30,7 +30,7 @@ ArtifactFileData, ArtifactFileType, ) -from tests.unit.neptune.internal.artifacts.utils import md5 +from tests.unit.neptune.new.internal.artifacts.utils import md5 class TestLocalArtifactDrivers(unittest.TestCase): diff --git a/tests/unit/neptune/internal/artifacts/drivers/test_s3.py b/tests/unit/neptune/new/internal/artifacts/drivers/test_s3.py similarity index 98% rename from tests/unit/neptune/internal/artifacts/drivers/test_s3.py rename to tests/unit/neptune/new/internal/artifacts/drivers/test_s3.py index 72b9eddc7..3708071ee 100644 --- a/tests/unit/neptune/internal/artifacts/drivers/test_s3.py +++ b/tests/unit/neptune/new/internal/artifacts/drivers/test_s3.py @@ -29,7 +29,7 @@ ArtifactFileData, ArtifactFileType, ) -from tests.unit.neptune.internal.artifacts.utils import md5 +from tests.unit.neptune.new.internal.artifacts.utils import md5 @mock_s3 diff --git a/tests/unit/neptune/internal/artifacts/test_file_hasher.py b/tests/unit/neptune/new/internal/artifacts/test_file_hasher.py similarity index 100% rename from tests/unit/neptune/internal/artifacts/test_file_hasher.py rename to tests/unit/neptune/new/internal/artifacts/test_file_hasher.py diff --git a/tests/unit/neptune/internal/artifacts/test_serializer.py b/tests/unit/neptune/new/internal/artifacts/test_serializer.py similarity index 100% rename from tests/unit/neptune/internal/artifacts/test_serializer.py rename to tests/unit/neptune/new/internal/artifacts/test_serializer.py diff --git a/tests/unit/neptune/internal/artifacts/test_types.py b/tests/unit/neptune/new/internal/artifacts/test_types.py similarity index 100% rename from tests/unit/neptune/internal/artifacts/test_types.py rename to tests/unit/neptune/new/internal/artifacts/test_types.py diff --git a/tests/unit/neptune/internal/artifacts/utils.py b/tests/unit/neptune/new/internal/artifacts/utils.py similarity index 100% rename from tests/unit/neptune/internal/artifacts/utils.py rename to tests/unit/neptune/new/internal/artifacts/utils.py diff --git a/tests/unit/neptune/internal/backends/__init__.py b/tests/unit/neptune/new/internal/backends/__init__.py similarity index 100% rename from tests/unit/neptune/internal/backends/__init__.py rename to tests/unit/neptune/new/internal/backends/__init__.py diff --git a/tests/unit/neptune/internal/backends/test_hosted_artifact_operations.py b/tests/unit/neptune/new/internal/backends/test_hosted_artifact_operations.py similarity index 100% rename from tests/unit/neptune/internal/backends/test_hosted_artifact_operations.py rename to tests/unit/neptune/new/internal/backends/test_hosted_artifact_operations.py diff --git a/tests/unit/neptune/internal/backends/test_hosted_client.py b/tests/unit/neptune/new/internal/backends/test_hosted_client.py similarity index 99% rename from tests/unit/neptune/internal/backends/test_hosted_client.py rename to tests/unit/neptune/new/internal/backends/test_hosted_client.py index 44ea7c554..1e40c2b17 100644 --- a/tests/unit/neptune/internal/backends/test_hosted_client.py +++ b/tests/unit/neptune/new/internal/backends/test_hosted_client.py @@ -60,7 +60,7 @@ WorkspaceNotFound, ) from tests.unit.neptune.backend_test_mixin import BackendTestMixin -from tests.unit.neptune.utils import response_mock +from tests.unit.neptune.new.utils import response_mock API_TOKEN = ( "eyJhcGlfYWRkcmVzcyI6Imh0dHBzOi8vYXBwLnN0YWdlLm5lcHR1bmUubWwiLCJ" diff --git a/tests/unit/neptune/internal/backends/test_hosted_file_operations.py b/tests/unit/neptune/new/internal/backends/test_hosted_file_operations.py similarity index 99% rename from tests/unit/neptune/internal/backends/test_hosted_file_operations.py rename to tests/unit/neptune/new/internal/backends/test_hosted_file_operations.py index cb85699e4..cc2443238 100644 --- a/tests/unit/neptune/internal/backends/test_hosted_file_operations.py +++ b/tests/unit/neptune/new/internal/backends/test_hosted_file_operations.py @@ -41,7 +41,7 @@ upload_file_set_attribute, ) from tests.unit.neptune.backend_test_mixin import BackendTestMixin -from tests.unit.neptune.utils.file_helpers import create_file +from tests.unit.neptune.new.utils.file_helpers import create_file def set_expected_result(endpoint: MagicMock, value: dict): diff --git a/tests/unit/neptune/internal/backends/test_hosted_neptune_backend.py b/tests/unit/neptune/new/internal/backends/test_hosted_neptune_backend.py similarity index 99% rename from tests/unit/neptune/internal/backends/test_hosted_neptune_backend.py rename to tests/unit/neptune/new/internal/backends/test_hosted_neptune_backend.py index 23c0d8fc0..c321da017 100644 --- a/tests/unit/neptune/internal/backends/test_hosted_neptune_backend.py +++ b/tests/unit/neptune/new/internal/backends/test_hosted_neptune_backend.py @@ -59,7 +59,7 @@ ) from neptune.internal.utils import base64_encode from tests.unit.neptune.backend_test_mixin import BackendTestMixin -from tests.unit.neptune.utils import response_mock +from tests.unit.neptune.new.utils import response_mock API_TOKEN = ( "eyJhcGlfYWRkcmVzcyI6Imh0dHBzOi8vYXBwLnN0YWdlLm5lcHR1bmUuYWkiLCJ" diff --git a/tests/unit/neptune/internal/backends/test_neptune_backend_mock.py b/tests/unit/neptune/new/internal/backends/test_neptune_backend_mock.py similarity index 100% rename from tests/unit/neptune/internal/backends/test_neptune_backend_mock.py rename to tests/unit/neptune/new/internal/backends/test_neptune_backend_mock.py diff --git a/tests/unit/neptune/internal/backends/test_nql.py b/tests/unit/neptune/new/internal/backends/test_nql.py similarity index 100% rename from tests/unit/neptune/internal/backends/test_nql.py rename to tests/unit/neptune/new/internal/backends/test_nql.py diff --git a/tests/unit/neptune/internal/backends/test_operations_preprocessor.py b/tests/unit/neptune/new/internal/backends/test_operations_preprocessor.py similarity index 99% rename from tests/unit/neptune/internal/backends/test_operations_preprocessor.py rename to tests/unit/neptune/new/internal/backends/test_operations_preprocessor.py index 4aa5f9206..042da27ae 100644 --- a/tests/unit/neptune/internal/backends/test_operations_preprocessor.py +++ b/tests/unit/neptune/new/internal/backends/test_operations_preprocessor.py @@ -34,7 +34,7 @@ TrackFilesToArtifact, UploadFileSet, ) -from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase FLog = LogFloats.ValueType SLog = LogStrings.ValueType diff --git a/tests/unit/neptune/internal/backends/test_swagger_client_wrapper.py b/tests/unit/neptune/new/internal/backends/test_swagger_client_wrapper.py similarity index 100% rename from tests/unit/neptune/internal/backends/test_swagger_client_wrapper.py rename to tests/unit/neptune/new/internal/backends/test_swagger_client_wrapper.py diff --git a/tests/unit/neptune/internal/backends/test_utils.py b/tests/unit/neptune/new/internal/backends/test_utils.py similarity index 100% rename from tests/unit/neptune/internal/backends/test_utils.py rename to tests/unit/neptune/new/internal/backends/test_utils.py diff --git a/tests/unit/neptune/internal/test_container_structure.py b/tests/unit/neptune/new/internal/test_container_structure.py similarity index 100% rename from tests/unit/neptune/internal/test_container_structure.py rename to tests/unit/neptune/new/internal/test_container_structure.py diff --git a/tests/unit/neptune/internal/test_credentials.py b/tests/unit/neptune/new/internal/test_credentials.py similarity index 100% rename from tests/unit/neptune/internal/test_credentials.py rename to tests/unit/neptune/new/internal/test_credentials.py diff --git a/tests/unit/neptune/internal/test_disk_queue.py b/tests/unit/neptune/new/internal/test_disk_queue.py similarity index 100% rename from tests/unit/neptune/internal/test_disk_queue.py rename to tests/unit/neptune/new/internal/test_disk_queue.py diff --git a/tests/unit/neptune/internal/test_operations.py b/tests/unit/neptune/new/internal/test_operations.py similarity index 100% rename from tests/unit/neptune/internal/test_operations.py rename to tests/unit/neptune/new/internal/test_operations.py diff --git a/tests/unit/neptune/internal/test_streams.py b/tests/unit/neptune/new/internal/test_streams.py similarity index 100% rename from tests/unit/neptune/internal/test_streams.py rename to tests/unit/neptune/new/internal/test_streams.py diff --git a/tests/unit/neptune/internal/utils/__init__.py b/tests/unit/neptune/new/internal/utils/__init__.py similarity index 100% rename from tests/unit/neptune/internal/utils/__init__.py rename to tests/unit/neptune/new/internal/utils/__init__.py diff --git a/tests/unit/neptune/internal/utils/test_deprecation.py b/tests/unit/neptune/new/internal/utils/test_deprecation.py similarity index 100% rename from tests/unit/neptune/internal/utils/test_deprecation.py rename to tests/unit/neptune/new/internal/utils/test_deprecation.py diff --git a/tests/unit/neptune/internal/utils/test_images.py b/tests/unit/neptune/new/internal/utils/test_images.py similarity index 100% rename from tests/unit/neptune/internal/utils/test_images.py rename to tests/unit/neptune/new/internal/utils/test_images.py diff --git a/tests/unit/neptune/internal/utils/test_iteration.py b/tests/unit/neptune/new/internal/utils/test_iteration.py similarity index 100% rename from tests/unit/neptune/internal/utils/test_iteration.py rename to tests/unit/neptune/new/internal/utils/test_iteration.py diff --git a/tests/unit/neptune/internal/utils/test_json_file_splitter.py b/tests/unit/neptune/new/internal/utils/test_json_file_splitter.py similarity index 98% rename from tests/unit/neptune/internal/utils/test_json_file_splitter.py rename to tests/unit/neptune/new/internal/utils/test_json_file_splitter.py index e6aff9e69..3a4149ed3 100644 --- a/tests/unit/neptune/internal/utils/test_json_file_splitter.py +++ b/tests/unit/neptune/new/internal/utils/test_json_file_splitter.py @@ -16,7 +16,7 @@ import unittest from neptune.internal.utils.json_file_splitter import JsonFileSplitter -from tests.unit.neptune.utils.file_helpers import create_file +from tests.unit.neptune.new.utils.file_helpers import create_file class TestJsonFileSplitter(unittest.TestCase): diff --git a/tests/unit/neptune/internal/utils/test_utils.py b/tests/unit/neptune/new/internal/utils/test_utils.py similarity index 100% rename from tests/unit/neptune/internal/utils/test_utils.py rename to tests/unit/neptune/new/internal/utils/test_utils.py diff --git a/tests/unit/neptune/test_experiment.py b/tests/unit/neptune/new/test_experiment.py similarity index 100% rename from tests/unit/neptune/test_experiment.py rename to tests/unit/neptune/new/test_experiment.py diff --git a/tests/unit/neptune/test_handler.py b/tests/unit/neptune/new/test_handler.py similarity index 99% rename from tests/unit/neptune/test_handler.py rename to tests/unit/neptune/new/test_handler.py index aff060dda..260f8334c 100644 --- a/tests/unit/neptune/test_handler.py +++ b/tests/unit/neptune/new/test_handler.py @@ -61,7 +61,7 @@ from neptune.types.series.float_series import FloatSeries as FloatSeriesVal from neptune.types.series.string_series import StringSeries as StringSeriesVal from neptune.types.sets.string_set import StringSet as StringSetVal -from tests.unit.neptune.utils.file_helpers import create_file +from tests.unit.neptune.new.utils.file_helpers import create_file class TestBaseAssign(unittest.TestCase): diff --git a/tests/unit/neptune/test_imports.py b/tests/unit/neptune/new/test_imports.py similarity index 54% rename from tests/unit/neptune/test_imports.py rename to tests/unit/neptune/new/test_imports.py index 46c025937..817c1e710 100644 --- a/tests/unit/neptune/test_imports.py +++ b/tests/unit/neptune/new/test_imports.py @@ -114,8 +114,106 @@ UserNotExistsOrWithoutAccess, WorkspaceNotFound, ) -from neptune.project import Project -from neptune.run import ( +from neptune.new.attributes.atoms.artifact import Artifact +from neptune.new.attributes.atoms.atom import Atom +from neptune.new.attributes.atoms.boolean import Boolean +from neptune.new.attributes.atoms.datetime import Datetime +from neptune.new.attributes.atoms.file import File +from neptune.new.attributes.atoms.float import Float +from neptune.new.attributes.atoms.git_ref import GitRef +from neptune.new.attributes.atoms.integer import Integer +from neptune.new.attributes.atoms.notebook_ref import NotebookRef +from neptune.new.attributes.atoms.run_state import RunState +from neptune.new.attributes.atoms.string import String +from neptune.new.attributes.attribute import Attribute +from neptune.new.attributes.file_set import FileSet +from neptune.new.attributes.namespace import ( + Namespace, + NamespaceBuilder, +) +from neptune.new.attributes.series.fetchable_series import FetchableSeries +from neptune.new.attributes.series.file_series import FileSeries +from neptune.new.attributes.series.float_series import FloatSeries +from neptune.new.attributes.series.series import Series +from neptune.new.attributes.series.string_series import StringSeries +from neptune.new.attributes.sets.set import Set +from neptune.new.attributes.sets.string_set import StringSet +from neptune.new.attributes.utils import create_attribute_from_type +from neptune.new.exceptions import ( + AmbiguousProjectName, + ArtifactNotFoundException, + ArtifactUploadingError, + CannotResolveHostname, + CannotSynchronizeOfflineRunsWithoutProject, + ClientHttpError, + ExceptionWithProjectsWorkspacesListing, + FetchAttributeNotFoundException, + FileNotFound, + FileSetUploadError, + FileUploadError, + Forbidden, + InactiveRunException, + InternalClientError, + InternalServerError, + MalformedOperation, + MetadataInconsistency, + MissingFieldException, + NeedExistingRunForReadOnlyMode, + NeptuneApiException, + NeptuneClientUpgradeRequiredError, + NeptuneConnectionLostException, + NeptuneEmptyLocationException, + NeptuneException, + NeptuneFeatureNotAvailableException, + NeptuneIntegrationNotInstalledException, + NeptuneInvalidApiTokenException, + NeptuneLegacyIncompatibilityException, + NeptuneLegacyProjectException, + NeptuneLimitExceedException, + NeptuneLocalStorageAccessException, + NeptuneMissingApiTokenException, + NeptuneMissingProjectNameException, + NeptuneOfflineModeFetchException, + NeptunePossibleLegacyUsageException, + NeptuneRemoteStorageAccessException, + NeptuneRemoteStorageCredentialsException, + NeptuneRunResumeAndCustomIdCollision, + NeptuneSSLVerificationError, + NeptuneStorageLimitException, + NeptuneUnhandledArtifactSchemeException, + NeptuneUnhandledArtifactTypeException, + NeptuneUninitializedException, + NeptuneUnsupportedArtifactFunctionalityException, + OperationNotSupported, + PlotlyIncompatibilityException, + ProjectNotFound, + RunNotFound, + RunUUIDNotFound, + Unauthorized, +) +from neptune.new.handler import Handler +from neptune.new.integrations.python_logger import NeptuneHandler +from neptune.new.logging.logger import Logger +from neptune.new.management.exceptions import ( + AccessRevokedOnDeletion, + AccessRevokedOnMemberRemoval, + BadRequestException, + ConflictingWorkspaceName, + InvalidProjectName, + ManagementOperationFailure, + MissingWorkspaceName, + ProjectAlreadyExists, + ProjectNotFound, + ProjectsLimitReached, + UnsupportedValue, + UserAlreadyHasAccess, + UserNotExistsOrWithoutAccess, + WorkspaceNotFound, +) + +# ------------ Legacy neptune.new subpackage ------------- +from neptune.new.project import Project +from neptune.new.run import ( Attribute, Boolean, Datetime, @@ -133,7 +231,7 @@ String, Value, ) -from neptune.runs_table import ( +from neptune.new.runs_table import ( AttributeType, AttributeWithProperties, LeaderboardEntry, @@ -142,7 +240,7 @@ RunsTable, RunsTableEntry, ) -from neptune.sync import ( +from neptune.new.sync import ( ApiExperiment, CannotSynchronizeOfflineRunsWithoutProject, DiskQueue, @@ -156,6 +254,26 @@ ProjectNotFound, RunNotFound, ) +from neptune.new.types.atoms.artifact import Artifact +from neptune.new.types.atoms.atom import Atom +from neptune.new.types.atoms.boolean import Boolean +from neptune.new.types.atoms.datetime import Datetime +from neptune.new.types.atoms.file import File +from neptune.new.types.atoms.float import Float +from neptune.new.types.atoms.git_ref import GitRef +from neptune.new.types.atoms.integer import Integer +from neptune.new.types.atoms.string import String +from neptune.new.types.file_set import FileSet +from neptune.new.types.namespace import Namespace +from neptune.new.types.series.file_series import FileSeries +from neptune.new.types.series.float_series import FloatSeries +from neptune.new.types.series.series import Series +from neptune.new.types.series.series_value import SeriesValue +from neptune.new.types.series.string_series import StringSeries +from neptune.new.types.sets.set import Set +from neptune.new.types.sets.string_set import StringSet +from neptune.new.types.value import Value +from neptune.new.types.value_visitor import ValueVisitor from neptune.types.atoms.artifact import Artifact from neptune.types.atoms.atom import Atom from neptune.types.atoms.boolean import Boolean diff --git a/tests/unit/neptune/test_log_handler.py b/tests/unit/neptune/new/test_log_handler.py similarity index 100% rename from tests/unit/neptune/test_log_handler.py rename to tests/unit/neptune/new/test_log_handler.py diff --git a/tests/unit/neptune/test_stringify_unsupported.py b/tests/unit/neptune/new/test_stringify_unsupported.py similarity index 100% rename from tests/unit/neptune/test_stringify_unsupported.py rename to tests/unit/neptune/new/test_stringify_unsupported.py diff --git a/tests/unit/neptune/types/__init__.py b/tests/unit/neptune/new/types/__init__.py similarity index 100% rename from tests/unit/neptune/types/__init__.py rename to tests/unit/neptune/new/types/__init__.py diff --git a/tests/unit/neptune/types/atoms/__init__.py b/tests/unit/neptune/new/types/atoms/__init__.py similarity index 100% rename from tests/unit/neptune/types/atoms/__init__.py rename to tests/unit/neptune/new/types/atoms/__init__.py diff --git a/tests/unit/neptune/types/atoms/test_file.py b/tests/unit/neptune/new/types/atoms/test_file.py similarity index 100% rename from tests/unit/neptune/types/atoms/test_file.py rename to tests/unit/neptune/new/types/atoms/test_file.py diff --git a/tests/unit/neptune/types/test_file_casting.py b/tests/unit/neptune/new/types/test_file_casting.py similarity index 96% rename from tests/unit/neptune/types/test_file_casting.py rename to tests/unit/neptune/new/types/test_file_casting.py index d17ca1572..acb1317c0 100644 --- a/tests/unit/neptune/types/test_file_casting.py +++ b/tests/unit/neptune/new/types/test_file_casting.py @@ -29,7 +29,7 @@ ) from neptune.types.namespace import Namespace from neptune.types.type_casting import cast_value -from tests.unit.neptune.attributes.test_attribute_base import TestAttributeBase +from tests.unit.neptune.new.attributes.test_attribute_base import TestAttributeBase class TestTypeCasting(TestAttributeBase): diff --git a/tests/unit/neptune/utils/__init__.py b/tests/unit/neptune/new/utils/__init__.py similarity index 100% rename from tests/unit/neptune/utils/__init__.py rename to tests/unit/neptune/new/utils/__init__.py diff --git a/tests/unit/neptune/utils/api_experiments_factory.py b/tests/unit/neptune/new/utils/api_experiments_factory.py similarity index 100% rename from tests/unit/neptune/utils/api_experiments_factory.py rename to tests/unit/neptune/new/utils/api_experiments_factory.py diff --git a/tests/unit/neptune/utils/file_helpers.py b/tests/unit/neptune/new/utils/file_helpers.py similarity index 100% rename from tests/unit/neptune/utils/file_helpers.py rename to tests/unit/neptune/new/utils/file_helpers.py diff --git a/tests/unit/neptune/websockets/__init__.py b/tests/unit/neptune/new/websockets/__init__.py similarity index 100% rename from tests/unit/neptune/websockets/__init__.py rename to tests/unit/neptune/new/websockets/__init__.py diff --git a/tests/unit/neptune/websockets/test_websockets_signals_background_job.py b/tests/unit/neptune/new/websockets/test_websockets_signals_background_job.py similarity index 100% rename from tests/unit/neptune/websockets/test_websockets_signals_background_job.py rename to tests/unit/neptune/new/websockets/test_websockets_signals_background_job.py From acf0082de4b89daae191447c40bd2e58e288200e Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 15:48:05 +0100 Subject: [PATCH 24/33] types removed --- src/neptune/new/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/neptune/new/__init__.py b/src/neptune/new/__init__.py index 963446311..8c86d6023 100644 --- a/src/neptune/new/__init__.py +++ b/src/neptune/new/__init__.py @@ -24,7 +24,6 @@ https://docs.neptune.ai/api/neptune """ __all__ = [ - "types", "ANONYMOUS", "ANONYMOUS_API_TOKEN", "NeptunePossibleLegacyUsageException", From ecd14dca5a4b36d4685b7082a5e7d7c7688fd09d Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 16:10:42 +0100 Subject: [PATCH 25/33] neptune.new compatibility --- src/neptune/new/__init__.py | 23 +++++----- src/neptune/new/_compatibility.py | 51 ++++++++++++++++++++++ tests/unit/neptune/new/test_imports.py | 59 ++------------------------ 3 files changed, 67 insertions(+), 66 deletions(-) create mode 100644 src/neptune/new/_compatibility.py diff --git a/src/neptune/new/__init__.py b/src/neptune/new/__init__.py index 8c86d6023..8e0e36978 100644 --- a/src/neptune/new/__init__.py +++ b/src/neptune/new/__init__.py @@ -13,16 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # - -"""``neptune`` is a global object that you can use to start new tracked runs or re-connect to already existing ones. - -It also provides some convenience functionalities like obtaining the last created run. - -You may also want to check `Neptune docs page`_. - -.. _Neptune docs page: - https://docs.neptune.ai/api/neptune -""" +# flake8: noqa __all__ = [ "ANONYMOUS", "ANONYMOUS_API_TOKEN", @@ -56,6 +47,8 @@ "get_last_run", ] +import sys + from neptune import ( ANONYMOUS, ANONYMOUS_API_TOKEN, @@ -69,10 +62,17 @@ init_project, init_run, ) +from neptune.attributes import * +from neptune.cli import * from neptune.exceptions import ( NeptunePossibleLegacyUsageException, NeptuneUninitializedException, ) +from neptune.integrations import * +from neptune.logging import * +from neptune.metadata_containers import * +from neptune.new._compatibility import CompatibilityImporter +from neptune.types import * def _raise_legacy_client_expected(*args, **kwargs): @@ -100,3 +100,6 @@ def _raise_legacy_client_expected(*args, **kwargs): ) = ( log_text ) = send_image = log_image = send_artifact = delete_artifacts = log_artifact = stop = _raise_legacy_client_expected + + +sys.meta_path.append(CompatibilityImporter()) diff --git a/src/neptune/new/_compatibility.py b/src/neptune/new/_compatibility.py new file mode 100644 index 000000000..a95e8ece9 --- /dev/null +++ b/src/neptune/new/_compatibility.py @@ -0,0 +1,51 @@ +# +# Copyright (c) 2022, Neptune Labs Sp. z o.o. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__all__ = ["CompatibilityImporter"] + +import sys +from importlib import import_module +from importlib.abc import ( + Loader, + MetaPathFinder, +) + + +class CompatibilityModuleLoader(Loader): + def module_repr(self, module): + return repr(module) + + def load_module(self, fullname): + module_name_parts = fullname.split(".") + new_module_name = f"neptune.{module_name_parts[2]}" + + module = sys.modules[fullname] = import_module(new_module_name) + return module + + +modules = [ + "neptune.new.attributes", + "neptune.new.cli", + "neptune.new.integrations", + "neptune.new.logging", + "neptune.new.metadata_containers", + "neptune.new.types", +] + + +class CompatibilityImporter(MetaPathFinder): + def find_module(self, fullname, path=None): + if ".".join(fullname.split(".")) in modules: + return CompatibilityModuleLoader() diff --git a/tests/unit/neptune/new/test_imports.py b/tests/unit/neptune/new/test_imports.py index 817c1e710..3f2430fe4 100644 --- a/tests/unit/neptune/new/test_imports.py +++ b/tests/unit/neptune/new/test_imports.py @@ -18,6 +18,7 @@ # flake8: noqa import unittest +# ---------------- neptune ---------------------- from neptune.attributes.atoms.artifact import Artifact from neptune.attributes.atoms.atom import Atom from neptune.attributes.atoms.boolean import Boolean @@ -98,6 +99,8 @@ from neptune.handler import Handler from neptune.integrations.python_logger import NeptuneHandler from neptune.logging.logger import Logger + +# ------------- management --------------- from neptune.management.exceptions import ( AccessRevokedOnDeletion, AccessRevokedOnMemberRemoval, @@ -194,22 +197,6 @@ from neptune.new.handler import Handler from neptune.new.integrations.python_logger import NeptuneHandler from neptune.new.logging.logger import Logger -from neptune.new.management.exceptions import ( - AccessRevokedOnDeletion, - AccessRevokedOnMemberRemoval, - BadRequestException, - ConflictingWorkspaceName, - InvalidProjectName, - ManagementOperationFailure, - MissingWorkspaceName, - ProjectAlreadyExists, - ProjectNotFound, - ProjectsLimitReached, - UnsupportedValue, - UserAlreadyHasAccess, - UserNotExistsOrWithoutAccess, - WorkspaceNotFound, -) # ------------ Legacy neptune.new subpackage ------------- from neptune.new.project import Project @@ -254,46 +241,6 @@ ProjectNotFound, RunNotFound, ) -from neptune.new.types.atoms.artifact import Artifact -from neptune.new.types.atoms.atom import Atom -from neptune.new.types.atoms.boolean import Boolean -from neptune.new.types.atoms.datetime import Datetime -from neptune.new.types.atoms.file import File -from neptune.new.types.atoms.float import Float -from neptune.new.types.atoms.git_ref import GitRef -from neptune.new.types.atoms.integer import Integer -from neptune.new.types.atoms.string import String -from neptune.new.types.file_set import FileSet -from neptune.new.types.namespace import Namespace -from neptune.new.types.series.file_series import FileSeries -from neptune.new.types.series.float_series import FloatSeries -from neptune.new.types.series.series import Series -from neptune.new.types.series.series_value import SeriesValue -from neptune.new.types.series.string_series import StringSeries -from neptune.new.types.sets.set import Set -from neptune.new.types.sets.string_set import StringSet -from neptune.new.types.value import Value -from neptune.new.types.value_visitor import ValueVisitor -from neptune.types.atoms.artifact import Artifact -from neptune.types.atoms.atom import Atom -from neptune.types.atoms.boolean import Boolean -from neptune.types.atoms.datetime import Datetime -from neptune.types.atoms.file import File -from neptune.types.atoms.float import Float -from neptune.types.atoms.git_ref import GitRef -from neptune.types.atoms.integer import Integer -from neptune.types.atoms.string import String -from neptune.types.file_set import FileSet -from neptune.types.namespace import Namespace -from neptune.types.series.file_series import FileSeries -from neptune.types.series.float_series import FloatSeries -from neptune.types.series.series import Series -from neptune.types.series.series_value import SeriesValue -from neptune.types.series.string_series import StringSeries -from neptune.types.sets.set import Set -from neptune.types.sets.string_set import StringSet -from neptune.types.value import Value -from neptune.types.value_visitor import ValueVisitor class TestImports(unittest.TestCase): From 1e5efd411f977fe072d01f2ade9116d9a138a306 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 16:17:32 +0100 Subject: [PATCH 26/33] CHANGELOG updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad2726f91..65ed4b7af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## [UNRELEASED] neptune-client 1.0.0 ### Changes +- Modules from `neptune.new` moved to `neptune` with compatibility imports ([#1213](https://github.com/neptune-ai/neptune-client/pull/1213)) - Removed `neptune.*` legacy modules ([#1206](https://github.com/neptune-ai/neptune-client/pull/1206)) ## [UNRELEASED] neptune-client 0.16.18 From cbf99b71ce04cbc01402e5b7b16684521914f7ca Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 16:36:37 +0100 Subject: [PATCH 27/33] Fixed e2e tests --- tests/e2e/standard/test_init.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/e2e/standard/test_init.py b/tests/e2e/standard/test_init.py index acff10ec6..2e3e24bc7 100644 --- a/tests/e2e/standard/test_init.py +++ b/tests/e2e/standard/test_init.py @@ -17,8 +17,10 @@ import neptune from neptune.exceptions import NeptuneModelKeyAlreadyExistsError -from neptune.metadata_containers import Model -from neptune.project import Project +from neptune.metadata_containers import ( + Model, + Project, +) from tests.e2e.base import ( AVAILABLE_CONTAINERS, BaseE2ETest, From 9f79f3f70411e88f2c3c455e24b0ba5fd6225cf2 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Fri, 10 Feb 2023 17:35:24 +0100 Subject: [PATCH 28/33] Fixed unittests --- tests/unit/neptune/new/test_imports.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/unit/neptune/new/test_imports.py b/tests/unit/neptune/new/test_imports.py index 3f2430fe4..6154349c8 100644 --- a/tests/unit/neptune/new/test_imports.py +++ b/tests/unit/neptune/new/test_imports.py @@ -26,7 +26,6 @@ from neptune.attributes.atoms.file import File from neptune.attributes.atoms.float import Float from neptune.attributes.atoms.git_ref import GitRef -from neptune.attributes.atoms.integer import Integer from neptune.attributes.atoms.notebook_ref import NotebookRef from neptune.attributes.atoms.run_state import RunState from neptune.attributes.atoms.string import String @@ -124,7 +123,6 @@ from neptune.new.attributes.atoms.file import File from neptune.new.attributes.atoms.float import Float from neptune.new.attributes.atoms.git_ref import GitRef -from neptune.new.attributes.atoms.integer import Integer from neptune.new.attributes.atoms.notebook_ref import NotebookRef from neptune.new.attributes.atoms.run_state import RunState from neptune.new.attributes.atoms.string import String @@ -207,7 +205,6 @@ Float, Handler, InactiveRunException, - Integer, MetadataInconsistency, Namespace, NamespaceAttr, From 1218d684b83cac627df7f9ffffa94f7d198b3050 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Mon, 13 Feb 2023 09:10:44 +0100 Subject: [PATCH 29/33] Deprecation message --- src/neptune/new/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/neptune/new/__init__.py b/src/neptune/new/__init__.py index 8e0e36978..0b791a99f 100644 --- a/src/neptune/new/__init__.py +++ b/src/neptune/new/__init__.py @@ -64,6 +64,7 @@ ) from neptune.attributes import * from neptune.cli import * +from neptune.common.deprecation import warn_once from neptune.exceptions import ( NeptunePossibleLegacyUsageException, NeptuneUninitializedException, @@ -103,3 +104,9 @@ def _raise_legacy_client_expected(*args, **kwargs): sys.meta_path.append(CompatibilityImporter()) + +warn_once( + message="You're importing neptune client via deprecated `neptune.new`" + " module and it will be removed in a future." + " Try to import it directly from `neptune`." +) From 4810e3aa1053501b461c266eb7ae548405925e23 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Mon, 13 Feb 2023 09:11:42 +0100 Subject: [PATCH 30/33] CHANGELOG updated --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65ed4b7af..a8e039e06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ ## [UNRELEASED] neptune-client 1.0.0 ### Changes -- Modules from `neptune.new` moved to `neptune` with compatibility imports ([#1213](https://github.com/neptune-ai/neptune-client/pull/1213)) +- Modules from `neptune.new` moved to `neptune` with compatibility imports and marked `neptune.new` as deprecated ([#1213](https://github.com/neptune-ai/neptune-client/pull/1213)) - Removed `neptune.*` legacy modules ([#1206](https://github.com/neptune-ai/neptune-client/pull/1206)) ## [UNRELEASED] neptune-client 0.16.18 From 6af4899263a418b34ec053f803a2c02b73f9e9b4 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Mon, 13 Feb 2023 09:29:45 +0100 Subject: [PATCH 31/33] Typo --- src/neptune/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neptune/__init__.py b/src/neptune/__init__.py index 3a505e5e2..a35b3c318 100644 --- a/src/neptune/__init__.py +++ b/src/neptune/__init__.py @@ -58,7 +58,7 @@ def get_last_run() -> Optional[Run]: Examples: >>> import neptune - >>> # Crate a new tracked run + >>> # Create a new tracked run ... neptune.init_run(name='A new approach', source_files='**/*.py') ... # Oops! We didn't capture the reference to the Run object From a65a574c9556b04b610747161968e9257c161ded Mon Sep 17 00:00:00 2001 From: Sabine Date: Mon, 13 Feb 2023 10:31:46 +0200 Subject: [PATCH 32/33] message phrasing --- src/neptune/new/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/neptune/new/__init__.py b/src/neptune/new/__init__.py index 0b791a99f..67fd1338a 100644 --- a/src/neptune/new/__init__.py +++ b/src/neptune/new/__init__.py @@ -106,7 +106,7 @@ def _raise_legacy_client_expected(*args, **kwargs): sys.meta_path.append(CompatibilityImporter()) warn_once( - message="You're importing neptune client via deprecated `neptune.new`" - " module and it will be removed in a future." - " Try to import it directly from `neptune`." + message="You're importing the Neptune client library via the deprecated" + " `neptune.new` module, which will be removed in a future release." + " Import directly from `neptune` instead." ) From 882f37caccee9e526278cf00576dc3f8da9a5bf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Jankowski?= Date: Mon, 13 Feb 2023 09:37:39 +0100 Subject: [PATCH 33/33] Update CHANGELOG.md Co-authored-by: Sabine --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8e039e06..69e47551d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ ## [UNRELEASED] neptune-client 1.0.0 ### Changes -- Modules from `neptune.new` moved to `neptune` with compatibility imports and marked `neptune.new` as deprecated ([#1213](https://github.com/neptune-ai/neptune-client/pull/1213)) +- Moved modules from `neptune.new` to `neptune` with compatibility imports and marked `neptune.new` as deprecated ([#1213](https://github.com/neptune-ai/neptune-client/pull/1213)) - Removed `neptune.*` legacy modules ([#1206](https://github.com/neptune-ai/neptune-client/pull/1206)) ## [UNRELEASED] neptune-client 0.16.18