Skip to content

Commit

Permalink
fixup! DEP: bump minimal supported IPython version to 7.32, declare i…
Browse files Browse the repository at this point in the history
…pykernel as optional dep, cleanup
  • Loading branch information
neutrinoceros committed May 2, 2024
1 parent 74b304c commit 677a81a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions astropy/utils/compat/optional_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"html5lib",
"ipykernel",
"IPython",
"ipywidgets",
"jplephem",
"lxml",
"matplotlib",
Expand Down
19 changes: 9 additions & 10 deletions astropy/utils/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
_CAN_RESIZE_TERMINAL = False

from astropy import conf
from astropy.utils.compat.optional_deps import HAS_IPYKERNEL, HAS_IPYTHON
from astropy.utils.compat.optional_deps import (
HAS_IPYKERNEL,
HAS_IPYTHON,
HAS_IPYWIDGETS,
)

from .decorators import classproperty, deprecated
from .misc import isiterable
Expand All @@ -48,14 +52,6 @@
class _IPython:
"""Singleton class given access to IPython streams, etc."""

@classproperty
def get_ipython(cls):
if HAS_IPYTHON:
from IPython import get_ipython

return get_ipython
raise ModuleNotFoundError("IPython is not installed")

@classproperty
def OutStream(cls):
if not hasattr(cls, "_OutStream"):
Expand Down Expand Up @@ -559,9 +555,12 @@ def _update_ipython_widget(self, value=None):
"""
# Create and display an empty progress bar widget,
# if none exists.

if not hasattr(self, "_widget"):
# Import only if an IPython widget, i.e., widget in iPython NB
_IPython.get_ipython()
if not HAS_IPYWIDGETS:
raise ModuleNotFoundError("ipywidgets is not installed")

Check warning on line 562 in astropy/utils/console.py

View check run for this annotation

Codecov / codecov/patch

astropy/utils/console.py#L561-L562

Added lines #L561 - L562 were not covered by tests

from ipywidgets import widgets

self._widget = widgets.FloatProgress()
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ test_all = [
"objgraph",
"ipykernel",
"ipython>=7.32",
"ipywidgets",
"coverage[toml]",
"skyfield>=1.20",
"sgp4>=2.3",
Expand Down Expand Up @@ -91,6 +92,7 @@ all = [
"bottleneck",
"ipykernel",
"ipython>=7.32",
"ipywidgets",
"pytest>=7.0",
"fsspec[http]>=2023.4.0",
"s3fs>=2023.4.0",
Expand Down

0 comments on commit 677a81a

Please sign in to comment.