You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently read about the suggested approach to extending xarray here: Extending xarray 2
We have a lot of functions on xarray datasets that are domain-specific enough to spatial mosaics that I think I want to start using these.
One issue I am seeing so far is that when I use the accessor in jupyter notebook, the arguments and docs are inspected and returned, which makes it nice and usable. However, within vscode, it is unable to inspect the args. The side effect is slower development and no more type checking, which isn’t ideal. This is also an issue with the rio accessor.
Am I missing something here? Has anyone noticed this and is there an existing fix? This must also be an issue with pandas custom accessors, too. Is there a way to more officially register accessors within my packages entry points?
For example
## inside notebooks
ds.sp.my_function() # I can inspect as usual
ds.rio.write_crs() # I can inspect as usual
## inside vscode
ds.sp.my_function() # I can not inspect the args or their types
ds.rio.write_crs() # I can not inspect the args or their types
Unfortunately I don't think this is possible since this kind of inspection is using static code analysis while jupyter Notebook can inspect dynamically.
Yeah, I was afraid of that lol. This must also be a pandas issue, too, since they recommend a similar way of extending pandas dataframes. I couldn't find a similar pandas issue/pr and was a bit surprised by that.
def use_domain_specific_dataset(dset: xr.Dataset):
if not isinstance(dset.ma, MyAccessor):
raise something
# gets some type checking
dset.ma.my_special_func()
What is your issue?
I recently read about the suggested approach to extending xarray here: Extending xarray 2
We have a lot of functions on xarray datasets that are domain-specific enough to spatial mosaics that I think I want to start using these.
One issue I am seeing so far is that when I use the accessor in jupyter notebook, the arguments and docs are inspected and returned, which makes it nice and usable. However, within vscode, it is unable to inspect the args. The side effect is slower development and no more type checking, which isn’t ideal. This is also an issue with the rio accessor.
Am I missing something here? Has anyone noticed this and is there an existing fix? This must also be an issue with pandas custom accessors, too. Is there a way to more officially register accessors within my packages entry points?
For example
I have seen sphinx-autosummary-accessors — sphinx-autosummary-accessors documentation 1, but that only seems relevant for doc generation.
The text was updated successfully, but these errors were encountered: