Skip to content

Commit

Permalink
Update import of pytorch_lightning and other integrations (#673)
Browse files Browse the repository at this point in the history
* Update import of pytorch_lightning and other integrations

* Update CHANGELOG.md
  • Loading branch information
shnela authored Nov 3, 2021
1 parent 39784e6 commit f927634
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 18 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## neptune-client 0.13.1 [UNRELEASED]
## neptune-client 0.13.1

### Features
- PyTorchLightning integration is imported directly from `pytorch-lightnig` repo ([#673](https://github.com/neptune-ai/neptune-client/pull/673))

### Fixes
- Fix issue with file upload retry buffer causing 400 bad requests ([#743](https://github.com/neptune-ai/neptune-client/pull/743))
Expand Down
11 changes: 6 additions & 5 deletions neptune/new/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,24 +659,25 @@ def __init__(self):


class NeptuneIntegrationNotInstalledException(NeptuneException):
def __init__(self, framework):
def __init__(self, integration_package_name, framework_name):
message = """
{h1}
----NeptuneIntegrationNotInstalledException-----------------------------------------
{end}
Looks like integration neptune-{framework} wasn't installed.
Looks like integration {integration_package_name} wasn't installed.
To install run:
{bash}pip install neptune-{framework}{end}
{bash}pip install {integration_package_name}{end}
Or:
{bash}pip install neptune-client[{framework}]{end}
{bash}pip install neptune-client[{framework_name}]{end}
You may also want to check the following docs pages:
- https://docs.neptune.ai/integrations-and-supported-tools/intro
{correct}Need help?{end}-> https://docs.neptune.ai/getting-started/getting-help
"""
super().__init__(message.format(
framework=framework,
integration_package_name=integration_package_name,
framework_name=framework_name,
**STYLES
))

Expand Down
5 changes: 4 additions & 1 deletion neptune/new/integrations/fastai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
except ModuleNotFoundError as e:
if e.name == 'neptune_fastai':
from neptune.new.exceptions import NeptuneIntegrationNotInstalledException
raise NeptuneIntegrationNotInstalledException("fastai") from None
raise NeptuneIntegrationNotInstalledException(
integration_package_name="neptune-fastai",
framework_name="fastai"
) from None
else:
raise
5 changes: 4 additions & 1 deletion neptune/new/integrations/kedro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
except ModuleNotFoundError as e:
if e.name == 'kedro_neptune':
from neptune.new.exceptions import NeptuneIntegrationNotInstalledException
raise NeptuneIntegrationNotInstalledException("kedro") from None
raise NeptuneIntegrationNotInstalledException(
integration_package_name="kedro-neptune",
framework_name="kedro"
) from None
else:
raise
5 changes: 4 additions & 1 deletion neptune/new/integrations/lightgbm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
except ModuleNotFoundError as e:
if e.name == 'neptune_lightgbm':
from neptune.new.exceptions import NeptuneIntegrationNotInstalledException
raise NeptuneIntegrationNotInstalledException("lightgbm") from None
raise NeptuneIntegrationNotInstalledException(
integration_package_name="neptune-lightgbm",
framework_name="lightgbm"
) from None
else:
raise
5 changes: 4 additions & 1 deletion neptune/new/integrations/optuna/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
except ModuleNotFoundError as e:
if e.name == 'neptune_optuna':
from neptune.new.exceptions import NeptuneIntegrationNotInstalledException
raise NeptuneIntegrationNotInstalledException("optuna") from None
raise NeptuneIntegrationNotInstalledException(
integration_package_name="neptune-optuna",
framework_name="optuna"
) from None
else:
raise
9 changes: 6 additions & 3 deletions neptune/new/integrations/pytorch_lightning/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@

try:
# pylint: disable=import-error
from neptune_pytorch_lightning.impl import *
from pytorch_lightning.loggers import NeptuneLogger
except ModuleNotFoundError as e:
if e.name == 'neptune_pytorch_lightning':
if e.name == 'pytorch_lightning':
from neptune.new.exceptions import NeptuneIntegrationNotInstalledException
raise NeptuneIntegrationNotInstalledException("pytorch-lightning") from None
raise NeptuneIntegrationNotInstalledException(
integration_package_name="pytorch-lightning",
framework_name="pytorch-lightning"
) from None
else:
raise
5 changes: 4 additions & 1 deletion neptune/new/integrations/sacred/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
except ModuleNotFoundError as e:
if e.name == 'neptune_sacred':
from neptune.new.exceptions import NeptuneIntegrationNotInstalledException
raise NeptuneIntegrationNotInstalledException("sacred") from None
raise NeptuneIntegrationNotInstalledException(
integration_package_name="neptune-sacred",
framework_name="sacred"
) from None
else:
raise
5 changes: 4 additions & 1 deletion neptune/new/integrations/sklearn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
except ModuleNotFoundError as e:
if e.name == 'neptune_sklearn':
from neptune.new.exceptions import NeptuneIntegrationNotInstalledException
raise NeptuneIntegrationNotInstalledException("sklearn") from None
raise NeptuneIntegrationNotInstalledException(
integration_package_name="neptune-sklearn",
framework_name="sklearn"
) from None
else:
raise
5 changes: 4 additions & 1 deletion neptune/new/integrations/tensorflow_keras/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
except ModuleNotFoundError as e:
if e.name == 'neptune_tensorflow_keras':
from neptune.new.exceptions import NeptuneIntegrationNotInstalledException
raise NeptuneIntegrationNotInstalledException("tensorflow-keras") from None
raise NeptuneIntegrationNotInstalledException(
integration_package_name="neptune-tensorflow-keras",
framework_name="tensorflow-keras"
) from None
else:
raise
5 changes: 4 additions & 1 deletion neptune/new/integrations/xgboost/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
except ModuleNotFoundError as e:
if e.name == 'neptune_xgboost':
from neptune.new.exceptions import NeptuneIntegrationNotInstalledException
raise NeptuneIntegrationNotInstalledException("xgboost") from None
raise NeptuneIntegrationNotInstalledException(
integration_package_name="neptune-xgboost",
framework_name="xgboost"
) from None
else:
raise
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def main():
"fastai": ["neptune-fastai"],
"lightgbm": ["neptune-lightgbm"],
"optuna": ["neptune-optuna"],
"pytorch-lightning": ["neptune-pytorch-lightning"],
"pytorch-lightning": ["pytorch-lightning"],
"sacred": ["neptune-sacred"],
"sklearn": ["neptune-sklearn"],
"tensorflow-keras": ["neptune-tensorflow-keras"],
Expand Down

0 comments on commit f927634

Please sign in to comment.