From c8a58aa322dbe57e53dd8e740ff6a30d6b553ad5 Mon Sep 17 00:00:00 2001 From: Erik Hasse Date: Tue, 1 Nov 2022 16:10:49 -0500 Subject: [PATCH] Remove IPython as a dependency --- CHANGELOG.md | 3 ++- darts/utils/utils.py | 8 +++++++- requirements/core.txt | 1 - 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e000a7e379..0c27588800 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Darts is still in an early development phase, and we cannot always guarantee bac ## [Unreleased](https://github.com/unit8co/darts/tree/master) - Fixed edge case in ShapExplainer for regression models where covariates series > target series [#1310](https://https://github.com/unit8co/darts/pull/1310) by [Rijk van der Meulen](https://github.com/rijkvandermeulen) +- Removed `IPython` as a dependency. [#1331](https://github.com/unit8co/darts/pull/1331) by [Erik Hasse](https://github.com/erik-hasse) [Full Changelog](https://github.com/unit8co/darts/compare/0.22.0...master) @@ -824,4 +825,4 @@ All implementations of `GlobalForecastingModel`s support multivariate time serie ## Older releases -[Full Changelog](https://github.com/unit8co/darts/compare/f618c4536bf7ed6e3b6a2239fbca4e3089736426...0.2.3) \ No newline at end of file +[Full Changelog](https://github.com/unit8co/darts/compare/f618c4536bf7ed6e3b6a2239fbca4e3089736426...0.2.3) diff --git a/darts/utils/utils.py b/darts/utils/utils.py index a3ca0b85fa..98234a32f8 100644 --- a/darts/utils/utils.py +++ b/darts/utils/utils.py @@ -10,7 +10,6 @@ import numpy as np import pandas as pd -from IPython import get_ipython from joblib import Parallel, delayed from tqdm import tqdm from tqdm.notebook import tqdm as tqdm_notebook @@ -18,6 +17,11 @@ from darts import TimeSeries from darts.logging import get_logger, raise_if, raise_if_not, raise_log +try: + from IPython import get_ipython +except ModuleNotFoundError: + get_ipython = None + logger = get_logger(__name__) @@ -88,6 +92,8 @@ def _build_tqdm_iterator(iterable, verbose, **kwargs): """ def _isnotebook(): + if get_ipython is None: + return False try: shell = get_ipython().__class__.__name__ if shell == "ZMQInteractiveShell": diff --git a/requirements/core.txt b/requirements/core.txt index 6a7e69293d..32d3ad8802 100644 --- a/requirements/core.txt +++ b/requirements/core.txt @@ -1,6 +1,5 @@ catboost>=1.0.6 holidays>=0.11.1 -ipython>=5.0.0 joblib>=0.16.0 lightgbm>=3.2.0 matplotlib>=3.3.0