dopplershift: :rage: I was running flake8 regularly here to try to avoid this. And apparently did not do it on the last iteration.
dopplershift: Alright, cleaned up.
dopplershift: Weird. Importing numpy within the `__init__.py` for the sub packages in question fixes it up--`dockets` must be doing some magic to determine the `globals` for running the doc examples. This has become a bit trickier than I want right now, so I'm going to punt this from the 0.10 release.
diff --git a/src/metpy/calc/__init__.py b/src/metpy/calc/__init__.py
index 5c1f22aaff..faf6b112c5 100644
--- a/src/metpy/calc/__init__.py
+++ b/src/metpy/calc/__init__.py
@@ -10,6 +10,7 @@ from .kinematics import *  # noqa: F403
 from .thermo import *  # noqa: F403
 from .tools import *  # noqa: F403
 from .turbulence import *  # noqa: F403
+from ..package_tools import set_module
 
 __all__ = basic.__all__[:]  # pylint: disable=undefined-variable
 __all__.extend(cross_sections.__all__)  # pylint: disable=undefined-variable
@@ -18,3 +19,5 @@ __all__.extend(kinematics.__all__)  # pylint: disable=undefined-variable
 __all__.extend(thermo.__all__)  # pylint: disable=undefined-variable
 __all__.extend(tools.__all__)  # pylint: disable=undefined-variable
 __all__.extend(turbulence.__all__)  # pylint: disable=undefined-variable
+
+set_module(globals())
diff --git a/src/metpy/interpolate/__init__.py b/src/metpy/interpolate/__init__.py
index 9161bcf697..59f8788f69 100644
--- a/src/metpy/interpolate/__init__.py
+++ b/src/metpy/interpolate/__init__.py
@@ -8,9 +8,12 @@ from .one_dimension import *  # noqa: F403
 from .points import *  # noqa: F403
 from .slices import *  # noqa: F403
 from .tools import *  # noqa: F403
+from ..package_tools import set_module
 
 __all__ = grid.__all__[:]  # pylint: disable=undefined-variable
 __all__.extend(one_dimension.__all__)  # pylint: disable=undefined-variable
 __all__.extend(points.__all__)  # pylint: disable=undefined-variable
 __all__.extend(slices.__all__)  # pylint: disable=undefined-variable
 __all__.extend(tools.__all__)  # pylint: disable=undefined-variable
+
+set_module(globals())
diff --git a/src/metpy/io/__init__.py b/src/metpy/io/__init__.py
index 6cbf28c20c..aae7c90c0c 100644
--- a/src/metpy/io/__init__.py
+++ b/src/metpy/io/__init__.py
@@ -12,6 +12,11 @@ from .gini import *  # noqa: F403
 from .metar import *  # noqa: F403
 from .nexrad import *  # noqa: F403
 from .station_data import *  # noqa: F403
+from ..package_tools import set_module
 
 __all__ = gini.__all__[:]  # pylint: disable=undefined-variable
+__all__.extend(metar.__all__)  # pylint: disable=undefined-variable
 __all__.extend(nexrad.__all__)  # pylint: disable=undefined-variable
+__all__.extend(station_data.__all__)  # pylint: disable=undefined-variable
+
+set_module(globals())
diff --git a/src/metpy/package_tools.py b/src/metpy/package_tools.py
index 3b8faf9d0a..a423844f1d 100644
--- a/src/metpy/package_tools.py
+++ b/src/metpy/package_tools.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015,2019 MetPy Developers.
+# Copyright (c) 2015,2018,2019 MetPy Developers.
 # Distributed under the terms of the BSD 3-Clause License.
 # SPDX-License-Identifier: BSD-3-Clause
 """Collection of tools for managing the package."""
@@ -37,3 +37,25 @@ class Exporter:
         """Exit the instance tracking block."""
         self.exports.extend(set(self.globls) - self.start_vars)
         del self.start_vars
+
+
+def set_module(globls):
+    """Set the module for all functions in ``__all__``.
+
+    This sets the ``__module__`` attribute of all items within the ``__all__`` list
+    for the calling module.
+
+    This supports our hoisting of functions out of individual modules, which are
+    considered implementation details, into the namespace of the top-level subpackage.
+
+    Parameters
+    ----------
+    globls : Dict[str, object]
+        Mapping of all global variables for the module. This contains all needed
+        python special ("dunder") variables needed to be modified.
+
+    """
+    for item in globls['__all__']:
+        obj = globls[item]
+        if hasattr(obj, '__module__'):
+            obj.__module__ = globls['__name__']
diff --git a/src/metpy/plots/__init__.py b/src/metpy/plots/__init__.py
index 7058aa6aab..1af06cce64 100644
--- a/src/metpy/plots/__init__.py
+++ b/src/metpy/plots/__init__.py
@@ -14,6 +14,7 @@ from .declarative import *  # noqa: F403
 from .skewt import *  # noqa: F403
 from .station_plot import *  # noqa: F403
 from .wx_symbols import *  # noqa: F403
+from ..package_tools import set_module
 
 logger = logging.getLogger(__name__)
 
@@ -29,3 +30,5 @@ try:
     __all__.extend(['USCOUNTIES', 'USSTATES'])
 except ImportError:
     logger.warning('Cannot import USCOUNTIES and USSTATES without Cartopy installed.')
+
+set_module(globals())

Set __module__ on exported functions, etc.
Functions and classes have a `__module__` attribute, which IPython and Jupyter use when printing out a name:
```python
from metpy.calc import geostrophic_wind
geostrophic_wind
> <function metpy.calc.kinematics.geostrophic_wind(heights, f, dx, dy)>
```
It would be nice if the printed name didn't include the implementation detail of the function's original home.

We should add a helper function that each of the top-level modules calls, passing in `__all__` and the module's `__name__`; this function can reset the module on all the items in `__all__`.
diff --git a/conftest.py b/conftest.py
index 14c1fe7502..472e8d19f4 100644
--- a/conftest.py
+++ b/conftest.py
@@ -17,6 +17,7 @@ import traitlets
 import xarray
 
 import metpy.calc
+import metpy.units
 
 # Need to disable fallback before importing pint
 os.environ['PINT_ARRAY_PROTOCOL_FALLBACK'] = '0'
@@ -42,7 +43,9 @@ def doctest_available_modules(doctest_namespace):
     """Make modules available automatically to doctests."""
     doctest_namespace['metpy'] = metpy
     doctest_namespace['metpy.calc'] = metpy.calc
+    doctest_namespace['np'] = numpy
     doctest_namespace['plt'] = matplotlib.pyplot
+    doctest_namespace['units'] = metpy.units.units
 
 
 @pytest.fixture()
diff --git a/tests/test_packaging.py b/tests/test_packaging.py
new file mode 100644
index 0000000000..9a447e4d03
--- /dev/null
+++ b/tests/test_packaging.py
@@ -0,0 +1,17 @@
+# Copyright (c) 2018 MetPy Developers.
+# Distributed under the terms of the BSD 3-Clause License.
+# SPDX-License-Identifier: BSD-3-Clause
+"""Test packaging details."""
+
+from metpy.calc import tke
+from metpy.interpolate import interpolate_to_grid
+from metpy.io import Level2File
+from metpy.plots import StationPlot
+
+
+def test_modules_set():
+    """Test that functions from each subpackage have correct module set."""
+    assert Level2File.__module__ == 'metpy.io'
+    assert StationPlot.__module__ == 'metpy.plots'
+    assert interpolate_to_grid.__module__ == 'metpy.interpolate'
+    assert tke.__module__ == 'metpy.calc'

pip install -e .
parse_log_pytest
requirements.txt
pytest coverage
apt-get update apt-get install -y gcc libgeos-dev libproj-dev
3.9
ci/requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
appdirs==1.4.4
certifi==2025.1.31
charset-normalizer==3.4.1
coverage==7.8.0
cycler==0.12.1
exceptiongroup==1.2.2
idna==3.10
importlib-metadata==4.5.0
importlib-resources==5.1.4
iniconfig==2.1.0
ipython-genutils==0.2.0
kiwisolver==1.4.7
matplotlib==3.4.2
-e git+https://github.com/Unidata/MetPy.git@4acc25b959570dc3971781f315d596965330bfe7#egg=MetPy
numpy==1.20.3
packaging==24.2
pandas==1.2.4
pillow==11.1.0
Pint==0.17
pluggy==1.5.0
pooch==1.4.0
pyparsing==3.2.3
pyproj==3.1.0
pytest==8.3.5
python-dateutil==2.9.0.post0
pytz==2025.2
requests==2.32.3
scipy==1.6.3
six==1.17.0
tomli==2.2.1
traitlets==5.0.5
urllib3==2.3.0
xarray==0.18.2
zipp==3.21.0

name: MetPy
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - appdirs==1.4.4
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - coverage==7.8.0
      - cycler==0.12.1
      - exceptiongroup==1.2.2
      - idna==3.10
      - importlib-metadata==4.5.0
      - importlib-resources==5.1.4
      - iniconfig==2.1.0
      - ipython-genutils==0.2.0
      - kiwisolver==1.4.7
      - matplotlib==3.4.2
      - metpy==1.0.1.post138+g4acc25b959
      - numpy==1.20.3
      - packaging==24.2
      - pandas==1.2.4
      - pillow==11.1.0
      - pint==0.17
      - pluggy==1.5.0
      - pooch==1.4.0
      - pyparsing==3.2.3
      - pyproj==3.1.0
      - pytest==8.3.5
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - requests==2.32.3
      - scipy==1.6.3
      - six==1.17.0
      - tomli==2.2.1
      - traitlets==5.0.5
      - urllib3==2.3.0
      - xarray==0.18.2
      - zipp==3.21.0
prefix: /opt/conda/envs/MetPy

tests/test_packaging.py::test_modules_set
src/metpy/interpolate/__init__.py src/metpy/io/__init__.py src/metpy/package_tools.py src/metpy/plots/__init__.py src/metpy/calc/__init__.py
src/metpy/interpolate/__init__.py src/metpy/io/__init__.py src/metpy/package_tools.py src/metpy/plots/__init__.py src/metpy/calc/__init__.py