Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

neptune.new modules made a root modules #1213

Merged
merged 33 commits into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
29e309d
version moved
Raalsky Feb 10, 2023
4052299
Utils moved to root
Raalsky Feb 10, 2023
8e4571e
Handler moved to root
Raalsky Feb 10, 2023
3b8df3a
Exceptions moved to root module
Raalsky Feb 10, 2023
09b2119
Tests fixed
Raalsky Feb 10, 2023
c36d58d
Moved init
Raalsky Feb 10, 2023
f204f92
Moved envs
Raalsky Feb 10, 2023
caa433b
Constants moved
Raalsky Feb 10, 2023
f89b2cb
Year bumped
Raalsky Feb 10, 2023
7930eac
init fixed
Raalsky Feb 10, 2023
8dd7090
minimal legacy rename
Raalsky Feb 10, 2023
9847f9a
docstrings for legacy client updated
Raalsky Feb 10, 2023
0317997
Imports up-to-date
Raalsky Feb 10, 2023
ecdb8e7
Internal moved
Raalsky Feb 10, 2023
84ee06e
cli moved
Raalsky Feb 10, 2023
3295c04
logging moved
Raalsky Feb 10, 2023
eb9f2f8
attributes moved
Raalsky Feb 10, 2023
7972863
Integrations moved
Raalsky Feb 10, 2023
06d402a
Metadata containers moved
Raalsky Feb 10, 2023
5f0e283
types moved
Raalsky Feb 10, 2023
dcac08b
tests structure
Raalsky Feb 10, 2023
2fb93ad
rename in tests
Raalsky Feb 10, 2023
57f8c03
Tests updated
Raalsky Feb 10, 2023
acf0082
types removed
Raalsky Feb 10, 2023
ecd14dc
neptune.new compatibility
Raalsky Feb 10, 2023
1e5efd4
CHANGELOG updated
Raalsky Feb 10, 2023
cbf99b7
Fixed e2e tests
Raalsky Feb 10, 2023
9f79f3f
Fixed unittests
Raalsky Feb 10, 2023
1218d68
Deprecation message
Raalsky Feb 13, 2023
4810e3a
CHANGELOG updated
Raalsky Feb 13, 2023
6af4899
Typo
Raalsky Feb 13, 2023
a65a574
message phrasing
normandy7 Feb 13, 2023
882f37c
Update CHANGELOG.md
Raalsky Feb 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
- 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
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

>>> # Crate a new tracked run
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor spelling error

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from that looks good to me, so will approve at once

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed + this function will be probably removed (and probably by you :P)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

XD

... 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()
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
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
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