Describe the bug
import brightwind eagerly imports Jupyter/GUI-only packages, so they are mandatory just to load the library — even for headless/server/batch use that never touches plotting widgets or maps:
brightwind/__init__.py (line 11) → brightwind/utils/gis.py (line 3) import gmaps
brightwind/__init__.py (line 4) → brightwind/analyse/shear.py (lines 10-12) from ipywidgets import FloatProgress, from IPython.display import display, clear_output
Both are notebook-only features:
gmaps is used solely by plot_meas_station_on_gmap (a Google Maps widget).
ipywidgets/IPython are used solely for a progress bar in Shear.
To Reproduce
Steps to reproduce the behaviour:
- Create a clean environment with no Jupyter stack.
- Run
pip install brightwind — this forces gmaps, ipywidgets, ipython and their dependency trees.
- In a minimal/headless container, any install or build hiccup in
gmaps (an abandoned sdist) blocks import brightwind entirely.
Expected behavior
import brightwind should require only the core scientific stack (pandas, numpy, scipy, scikit-learn, matplotlib, requests, jsonschema, jinja2). Maps and notebook-progress features should import their dependencies lazily, inside the functions that use them, and those dependencies should be optional extras (brightwind[maps], brightwind[notebook]). Calling a feature without its extra installed should raise a clear, actionable ImportError (e.g. "install brightwind[maps]").
Additional context
The "make it optional" half depends on extras being declared (see the packaging-modernisation issue). The lazy-import guards can land independently in the current setup.py.
Downstream impact: the Lambda image bundles gmaps 0.9.0, ipywidgets 8.1.8 and ipython 9.15.0 solely to satisfy import brightwind.
Related: the abandoned-gmaps issue.
Code example
# gis.py
def plot_meas_station_on_gmap(meas_station, ...):
try:
import gmaps
except ImportError as e:
raise ImportError("plot_meas_station_on_gmap requires the 'maps' extra: pip install brightwind[maps]") from e
Describe the bug
import brightwindeagerly imports Jupyter/GUI-only packages, so they are mandatory just to load the library — even for headless/server/batch use that never touches plotting widgets or maps:brightwind/__init__.py(line 11) →brightwind/utils/gis.py(line 3)import gmapsbrightwind/__init__.py(line 4) →brightwind/analyse/shear.py(lines 10-12)from ipywidgets import FloatProgress,from IPython.display import display, clear_outputBoth are notebook-only features:
gmapsis used solely byplot_meas_station_on_gmap(a Google Maps widget).ipywidgets/IPythonare used solely for a progress bar inShear.To Reproduce
Steps to reproduce the behaviour:
pip install brightwind— this forcesgmaps,ipywidgets,ipythonand their dependency trees.gmaps(an abandoned sdist) blocksimport brightwindentirely.Expected behavior
import brightwindshould require only the core scientific stack (pandas, numpy, scipy, scikit-learn, matplotlib, requests, jsonschema, jinja2). Maps and notebook-progress features should import their dependencies lazily, inside the functions that use them, and those dependencies should be optional extras (brightwind[maps],brightwind[notebook]). Calling a feature without its extra installed should raise a clear, actionableImportError(e.g. "install brightwind[maps]").Additional context
The "make it optional" half depends on extras being declared (see the packaging-modernisation issue). The lazy-import guards can land independently in the current
setup.py.Downstream impact: the Lambda image bundles
gmaps 0.9.0,ipywidgets 8.1.8andipython 9.15.0solely to satisfyimport brightwind.Related: the abandoned-gmaps issue.
Code example