Skip to content

Commit 6d4f085

Browse files
committed
Remove stubs and add xpx method for IDE support
1 parent 5751881 commit 6d4f085

5 files changed

Lines changed: 28 additions & 135 deletions

File tree

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ dependencies = [
2323
"xarray>=2023.1.0",
2424
"plotly>=5.0.0",
2525
"pandas>=1.5.0",
26-
"xarray-plotly-stubs>=0.1.0",
2726
]
2827

2928
[project.urls]

stubs/README.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

stubs/pyproject.toml

Lines changed: 0 additions & 28 deletions
This file was deleted.

stubs/xarray-stubs/__init__.pyi

Lines changed: 0 additions & 88 deletions
This file was deleted.

xarray_plotly/__init__.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
from importlib.metadata import version
2929

30-
from xarray import register_dataarray_accessor
30+
from xarray import DataArray, register_dataarray_accessor
3131

3232
from xarray_plotly.accessor import DataArrayPlotlyAccessor
3333
from xarray_plotly.common import SLOT_ORDERS, auto
@@ -36,8 +36,35 @@
3636
"DataArrayPlotlyAccessor",
3737
"SLOT_ORDERS",
3838
"auto",
39+
"xpx",
3940
]
4041

42+
43+
def xpx(da: DataArray) -> DataArrayPlotlyAccessor:
44+
"""
45+
Get the plotly accessor for a DataArray with full IDE code completion.
46+
47+
This is an alternative to `da.plotly` that provides proper type hints
48+
and code completion in IDEs.
49+
50+
Parameters
51+
----------
52+
da : DataArray
53+
The DataArray to plot.
54+
55+
Returns
56+
-------
57+
DataArrayPlotlyAccessor
58+
The accessor with plotting methods.
59+
60+
Examples
61+
--------
62+
>>> from xarray_plotly import xpx
63+
>>> fig = xpx(da).line() # Full code completion works here
64+
"""
65+
return DataArrayPlotlyAccessor(da)
66+
67+
4168
__version__ = version("xarray_plotly")
4269

4370
# Register the accessor

0 commit comments

Comments
 (0)