From 166fd34bce7ee11296bf49be3c22528996208ab1 Mon Sep 17 00:00:00 2001 From: Kkkakania <200867803+Kkkakania@users.noreply.github.com> Date: Wed, 15 Jul 2026 12:20:29 +0800 Subject: [PATCH] feat: define top-level public API --- hvplot/__init__.py | 48 ++++++++++++++++++++++++++++++---------- hvplot/tests/test_api.py | 30 +++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 12 deletions(-) create mode 100644 hvplot/tests/test_api.py diff --git a/hvplot/__init__.py b/hvplot/__init__.py index f3ebed055..8faa0922d 100644 --- a/hvplot/__init__.py +++ b/hvplot/__init__.py @@ -63,23 +63,23 @@ import holoviews as _hv import panel as _pn -from holoviews import render # noqa: F401 +from holoviews import render -from . import sampledata # noqa: F401 -from .converter import HoloViewsConverter # noqa: F401 +from . import sampledata +from .converter import HoloViewsConverter from .interactive import Interactive from .plotting import ( - andrews_curves, # noqa: F401 - hvPlot, # noqa: F401 - hvPlotTabular, # noqa: F401 - lag_plot, # noqa: F401 - parallel_coordinates, # noqa: F401 - plot, # noqa: F401 - scatter_matrix, # noqa: F401 + andrews_curves, + hvPlot, + hvPlotTabular, + lag_plot, + parallel_coordinates, + plot, + scatter_matrix, ) -from .ui import explorer # noqa: F401 +from .ui import explorer from .util import _in_ipython, _PatchHvplotDocstrings -from .utilities import help, hvplot_extension, output, save, show # noqa: F401 +from .utilities import help, hvplot_extension, output, save, show # Define '__version__' try: @@ -116,6 +116,30 @@ # the package. __version__ = '0.0.0+unknown' +__all__ = [ + 'HoloViewsConverter', + 'Interactive', + '__version__', + 'andrews_curves', + 'bind', + 'explorer', + 'extension', + 'help', + 'hvPlot', + 'hvPlotTabular', + 'hvplot_extension', + 'lag_plot', + 'output', + 'parallel_coordinates', + 'plot', + 'post_patch', + 'render', + 'sampledata', + 'save', + 'scatter_matrix', + 'show', +] + _PATCH_PLOT_SIGNATURES = _in_ipython() or ( os.getenv('HVPLOT_PATCH_PLOT_DOCSTRING_SIGNATURE', 'false').lower() in ('1', 'true') ) diff --git a/hvplot/tests/test_api.py b/hvplot/tests/test_api.py new file mode 100644 index 000000000..22b0e52d1 --- /dev/null +++ b/hvplot/tests/test_api.py @@ -0,0 +1,30 @@ +import hvplot + +EXPECTED_PUBLIC_API = [ + 'HoloViewsConverter', + 'Interactive', + '__version__', + 'andrews_curves', + 'bind', + 'explorer', + 'extension', + 'help', + 'hvPlot', + 'hvPlotTabular', + 'hvplot_extension', + 'lag_plot', + 'output', + 'parallel_coordinates', + 'plot', + 'post_patch', + 'render', + 'sampledata', + 'save', + 'scatter_matrix', + 'show', +] + + +def test_public_api(): + assert hvplot.__all__ == EXPECTED_PUBLIC_API + assert all(hasattr(hvplot, name) for name in hvplot.__all__)