Skip to content

Commit

Permalink
neptune.new modules made a root modules (#1213)
Browse files Browse the repository at this point in the history
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
  • Loading branch information
Raalsky and normandy7 committed Feb 14, 2023
1 parent 207c589 commit 9fd3b58
Show file tree
Hide file tree
Showing 296 changed files with 3,584 additions and 3,448 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## [UNRELEASED] neptune-client 1.0.0

### Changes
- 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))

## neptune-client 0.16.18
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
67 changes: 64 additions & 3 deletions src/neptune/__init__.py
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -13,10 +13,71 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__all__ = ["__version__"]
__all__ = [
"ANONYMOUS",
"ANONYMOUS_API_TOKEN",
"get_project",
"init",
"init_model",
"init_model_version",
"init_project",
"init_run",
"Run",
"__version__",
"get_last_run",
]

from typing import Optional

from neptune.common.patches import apply_patches
from neptune.version import __version__
from neptune.constants import (
ANONYMOUS,
ANONYMOUS_API_TOKEN,
)
from neptune.exceptions import NeptuneUninitializedException
from neptune.internal.init import (
get_project,
init,
init_model,
init_model_version,
init_project,
init_run,
)
from neptune.internal.utils.deprecation import deprecated
from neptune.metadata_containers import Run
from neptune.version import version


@deprecated()
def get_last_run() -> Optional[Run]:
"""Returns last created Run object.
Returns:
``Run``: object last created by neptune global object.
Examples:
>>> import neptune
>>> # 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
>>> # 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()
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
import pathlib
import typing

from neptune.new.attributes.atoms.atom import Atom
from neptune.new.internal.artifacts.types import (
from neptune.attributes.atoms.atom import Atom
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.types.atoms.artifact import Artifact as ArtifactVal
from neptune.types.atoms.artifact import Artifact as ArtifactVal


class Artifact(Atom):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
__all__ = ["Atom"]

from neptune.new.attributes.attribute import Attribute
from neptune.attributes.attribute import Attribute


class Atom(Attribute):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

import typing

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
from neptune.attributes.atoms.copiable_atom import CopiableAtom
from neptune.internal.container_type import ContainerType
from neptune.internal.operation import AssignBool
from neptune.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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
import abc
import typing

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
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.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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
import typing
from datetime import datetime

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
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.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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

from typing import Optional

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
from neptune.attributes.atoms.atom import Atom
from neptune.internal.operation import UploadFile
from neptune.internal.utils import verify_type
from neptune.types.atoms.file import File as FileVal


class File(Atom):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

import typing

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
from neptune.attributes.atoms.copiable_atom import CopiableAtom
from neptune.internal.container_type import ContainerType
from neptune.internal.operation import AssignFloat
from neptune.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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
__all__ = ["GitRef"]

from neptune.new.attributes.atoms.atom import Atom
from neptune.attributes.atoms.atom import Atom


class GitRef(Atom):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

import typing

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
from neptune.attributes.atoms.copiable_atom import CopiableAtom
from neptune.internal.container_type import ContainerType
from neptune.internal.operation import AssignInt
from neptune.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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
__all__ = ["NotebookRef"]


from neptune.new.attributes.atoms.atom import Atom
from neptune.attributes.atoms.atom import Atom


class NotebookRef(Atom):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
__all__ = ["RunState"]

from neptune.new.attributes.atoms.atom import Atom
from neptune.attributes.atoms.atom import Atom


class RunState(Atom):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@

import typing

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
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.types.atoms.string import String as StringVal

if typing.TYPE_CHECKING:
from neptune.new.internal.backends.neptune_backend import NeptuneBackend
from neptune.new.metadata_containers import MetadataContainer
from neptune.internal.backends.neptune_backend import NeptuneBackend
from neptune.metadata_containers import MetadataContainer


class String(CopiableAtom):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
List,
)

from neptune.new.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
from neptune.exceptions import TypeDoesNotSupportAttributeException
from neptune.internal.backends.neptune_backend import NeptuneBackend
from neptune.internal.operation import Operation
from neptune.types.value_copy import ValueCopy

if TYPE_CHECKING:
from neptune.new.internal.container_type import ContainerType
from neptune.new.metadata_containers import MetadataContainer
from neptune.internal.container_type import ContainerType
from neptune.metadata_containers import MetadataContainer


class Attribute:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
Union,
)

from neptune.new.attributes.attribute import Attribute
from neptune.new.internal.operation import (
from neptune.attributes.attribute import Attribute
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.types.file_set import FileSet as FileSetVal
from neptune.types.file_set import FileSet as FileSetVal


class FileSet(Attribute):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@
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.attributes.attribute import Attribute
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.types.namespace import Namespace as NamespaceVal
from neptune.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

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Union,
)

from neptune.new.internal.backends.api_model import (
from neptune.internal.backends.api_model import (
FloatSeriesValues,
StringSeriesValues,
)
Expand Down
Loading

0 comments on commit 9fd3b58

Please sign in to comment.