Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that aiohttp is present in Jupyter environments #1792

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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