From f927634e386a1399126bac2a52c0e9513eb28f18 Mon Sep 17 00:00:00 2001 From: Jakub Kuszneruk Date: Wed, 3 Nov 2021 14:03:51 +0100 Subject: [PATCH] Update import of pytorch_lightning and other integrations (#673) * Update import of pytorch_lightning and other integrations * Update CHANGELOG.md --- CHANGELOG.md | 5 ++++- neptune/new/exceptions.py | 11 ++++++----- neptune/new/integrations/fastai/__init__.py | 5 ++++- neptune/new/integrations/kedro/__init__.py | 5 ++++- neptune/new/integrations/lightgbm/__init__.py | 5 ++++- neptune/new/integrations/optuna/__init__.py | 5 ++++- .../new/integrations/pytorch_lightning/__init__.py | 9 ++++++--- neptune/new/integrations/sacred/__init__.py | 5 ++++- neptune/new/integrations/sklearn/__init__.py | 5 ++++- neptune/new/integrations/tensorflow_keras/__init__.py | 5 ++++- neptune/new/integrations/xgboost/__init__.py | 5 ++++- setup.py | 2 +- 12 files changed, 49 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d259ee83c..031415d99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/neptune/new/exceptions.py b/neptune/new/exceptions.py index 8e7016086..33ddbe2bd 100644 --- a/neptune/new/exceptions.py +++ b/neptune/new/exceptions.py @@ -659,16 +659,16 @@ 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 @@ -676,7 +676,8 @@ def __init__(self, framework): {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 )) diff --git a/neptune/new/integrations/fastai/__init__.py b/neptune/new/integrations/fastai/__init__.py index e2d512eeb..6725a0572 100644 --- a/neptune/new/integrations/fastai/__init__.py +++ b/neptune/new/integrations/fastai/__init__.py @@ -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 diff --git a/neptune/new/integrations/kedro/__init__.py b/neptune/new/integrations/kedro/__init__.py index 8798ad239..b203b68a8 100644 --- a/neptune/new/integrations/kedro/__init__.py +++ b/neptune/new/integrations/kedro/__init__.py @@ -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 diff --git a/neptune/new/integrations/lightgbm/__init__.py b/neptune/new/integrations/lightgbm/__init__.py index 13669d109..d8cb551f1 100644 --- a/neptune/new/integrations/lightgbm/__init__.py +++ b/neptune/new/integrations/lightgbm/__init__.py @@ -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 diff --git a/neptune/new/integrations/optuna/__init__.py b/neptune/new/integrations/optuna/__init__.py index 430f22005..0c848ab9a 100644 --- a/neptune/new/integrations/optuna/__init__.py +++ b/neptune/new/integrations/optuna/__init__.py @@ -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 diff --git a/neptune/new/integrations/pytorch_lightning/__init__.py b/neptune/new/integrations/pytorch_lightning/__init__.py index 0c6227abd..fd41d6d35 100644 --- a/neptune/new/integrations/pytorch_lightning/__init__.py +++ b/neptune/new/integrations/pytorch_lightning/__init__.py @@ -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 diff --git a/neptune/new/integrations/sacred/__init__.py b/neptune/new/integrations/sacred/__init__.py index d60683870..e0ea823a0 100644 --- a/neptune/new/integrations/sacred/__init__.py +++ b/neptune/new/integrations/sacred/__init__.py @@ -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 diff --git a/neptune/new/integrations/sklearn/__init__.py b/neptune/new/integrations/sklearn/__init__.py index 8ca3b1d0b..e25c3df50 100644 --- a/neptune/new/integrations/sklearn/__init__.py +++ b/neptune/new/integrations/sklearn/__init__.py @@ -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 diff --git a/neptune/new/integrations/tensorflow_keras/__init__.py b/neptune/new/integrations/tensorflow_keras/__init__.py index ae59c3a3f..bca0e8825 100644 --- a/neptune/new/integrations/tensorflow_keras/__init__.py +++ b/neptune/new/integrations/tensorflow_keras/__init__.py @@ -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 diff --git a/neptune/new/integrations/xgboost/__init__.py b/neptune/new/integrations/xgboost/__init__.py index 2c23789de..802055e92 100644 --- a/neptune/new/integrations/xgboost/__init__.py +++ b/neptune/new/integrations/xgboost/__init__.py @@ -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 diff --git a/setup.py b/setup.py index ec195143c..4d9010e8e 100644 --- a/setup.py +++ b/setup.py @@ -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"],