From a13775d73effb05addc0857c5ba401bd766bd50a Mon Sep 17 00:00:00 2001 From: maleksandrov Date: Mon, 8 Aug 2022 09:29:24 +0200 Subject: [PATCH] Improved handling of imports from utils.py --- examples/batch_processing.ipynb | 6 ++++-- examples/data_collections.ipynb | 1 + examples/process_request.ipynb | 6 ++++-- pyproject.toml | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/batch_processing.ipynb b/examples/batch_processing.ipynb index 90225306..4dd35449 100644 --- a/examples/batch_processing.ipynb +++ b/examples/batch_processing.ipynb @@ -41,7 +41,6 @@ "import geopandas as gpd\n", "import matplotlib.pyplot as plt\n", "from matplotlib.patches import Patch\n", - "from utils import plot_image\n", "\n", "from sentinelhub import (\n", " CRS,\n", @@ -53,7 +52,10 @@ " SHConfig,\n", " bbox_to_dimensions,\n", " monitor_batch_job,\n", - ")" + ")\n", + "\n", + "# The following is not a package. It is a file utils.py which should be in the same folder as this notebook.\n", + "from utils import plot_image" ] }, { diff --git a/examples/data_collections.ipynb b/examples/data_collections.ipynb index a0311dec..a5d8b6a1 100644 --- a/examples/data_collections.ipynb +++ b/examples/data_collections.ipynb @@ -204,6 +204,7 @@ "source": [ "%matplotlib inline\n", "\n", + "# The following is not a package. It is a file utils.py which should be in the same folder as this notebook.\n", "from utils import plot_image\n", "\n", "plot_image(image, factor=3.5 / 255, clip_range=(0, 1))" diff --git a/examples/process_request.ipynb b/examples/process_request.ipynb index 23f80ea7..18462c38 100644 --- a/examples/process_request.ipynb +++ b/examples/process_request.ipynb @@ -63,7 +63,6 @@ "\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "from utils import plot_image\n", "\n", "from sentinelhub import (\n", " CRS,\n", @@ -75,7 +74,10 @@ " SentinelHubDownloadClient,\n", " SentinelHubRequest,\n", " bbox_to_dimensions,\n", - ")" + ")\n", + "\n", + "# The following is not a package. It is a file utils.py which should be in the same folder as this notebook.\n", + "from utils import plot_image" ] }, { diff --git a/pyproject.toml b/pyproject.toml index e1b767c2..bdd0bff2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,6 +5,7 @@ preview = true [tool.isort] profile = "black" known_absolute = "sentinelhub" +known_local_folder = "utils" sections = ["FUTURE", "STDLIB", "THIRDPARTY", "ABSOLUTE", "LOCALFOLDER"] line_length = 120