Conversation
The pixi workspace includes pyproject.toml as source metadata for the
local xarray package (via `xarray = { path = "." }`). When pyproject.toml
changes, the cached pixi.lock becomes invalid, causing CI failures with
"lock-file not up-to-date with the workspace".
This fix adds pyproject.toml to the cache key hash, ensuring the lock
file is regenerated when either pixi.toml or pyproject.toml changes.
| if TYPE_CHECKING: | ||
| from cf_xarray.accessor import CFAccessor | ||
| from hvplot.xarray import hvPlotAccessor | ||
| from pint_xarray import PintDataArrayAccessor, PintDatasetAccessor | ||
| from rioxarray import RasterArray, RasterDataset | ||
| from xarray_plotly import DataArrayPlotlyAccessor, DatasetPlotlyAccessor |
There was a problem hiding this comment.
So do all of these unrelated packages now have to be installed in our CI (in the same environment too)? Plotly at least is new.
There was a problem hiding this comment.
Just the mypy environment
There was a problem hiding this comment.
Actually they don't need to be installed at all since they are only imported within the TYPE_CHECKING block. So we just need some explicit mypy ignores (which @FBumann had already figured out).
There was a problem hiding this comment.
@jsignell Pretty elegant solution with the MixIn. I like it!
There was a problem hiding this comment.
does the IDE completion/hints still work even if not all of these are installed?
There was a problem hiding this comment.
@DocOtak Yes they do. But they are deprioritized (at least in my IDE), saying they are not at the top of the list
Here with only xarray-plotly installed, I only see the plotly accessor.
![]() |
![]() |
But after I type in .hv, also see that accessor with type hints.
Completion after the accessor name is only available for installed accessors:
![]() |
![]() |
One more thing:
The data_vars overwrite the accessor. This is a good thing imo!

The existing .plot accessor behaves differently. It overwrites the data_var

This means with conflicting var_names and accessor names, the code behaviour is backwards compatible. Only conflict in type hints, not at Runtime.
The pixi workspace includes pyproject.toml as source metadata for the
local xarray package (via `xarray = { path = "." }`). When pyproject.toml
changes, the cached pixi.lock becomes invalid, causing CI failures with
"lock-file not up-to-date with the workspace".
This fix adds pyproject.toml to the cache key hash, ensuring the lock
file is regenerated when either pixi.toml or pyproject.toml changes.




Based off of #11079 but only does the typing part.
Example of static typing:
Example of dynamic typing (in ipython) for the case where there is a data variable named one of the accessor names:
whats-new.rstapi.rst