Skip to content

Commit

Permalink
Merge pull request #1792 from girder/guard-aiohttp
Browse files Browse the repository at this point in the history
Check that aiohttp is present in Jupyter environments
  • Loading branch information
manthey authored Jan 28, 2025
2 parents 8349470 + 8b28afa commit 341b6fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### Features

- Add utility functions for converting between frame and axes ([#1778](../../pull/1778))
- Jupyter frame selector ([#1738](../../pull/1738))
- Jupyter frame selector ([#1738](../../pull/1738), [#1792](../../pull/1792))

### Improvements

Expand Down
6 changes: 4 additions & 2 deletions large_image/tilesource/jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from typing import Any, Dict, List, Optional, Tuple, Union, cast
from urllib.parse import parse_qs, quote, urlencode, urlparse, urlunparse

import aiohttp
import numpy as np

import large_image
Expand All @@ -33,6 +32,7 @@

ipyleafletPresent = importlib.util.find_spec('ipyleaflet') is not None
ipyvuePresent = importlib.util.find_spec('ipyvue') is not None
aiohttpPresent = importlib.util.find_spec('aiohttp') is not None


class IPyLeafletMixin:
Expand Down Expand Up @@ -320,7 +320,7 @@ def make_map(

children: List[Any] = []
frames = metadata.get('frames')
if frames is not None and ipyvuePresent:
if frames is not None and ipyvuePresent and aiohttpPresent:
from large_image.widgets.components import FrameSelector

self.frame_selector = FrameSelector()
Expand Down Expand Up @@ -419,6 +419,8 @@ def update_frame(self, frame, style, **kwargs):
self._layer.redraw()

def get_frame_histogram(self, query):
import aiohttp

if self._layer is not None:
if self._frame_histograms is None:
self._frame_histograms = {}
Expand Down

0 comments on commit 341b6fc

Please sign in to comment.