corteva / rioxarray

geospatial xarray extension powered by rasterio
https://corteva.github.io/rioxarray
Other
504 stars 80 forks source link

"'open_rasterio' is not exported from module 'rioxarray'" error reported by Pylance linting #680

Closed dluks closed 12 months ago

dluks commented 1 year ago

I'm not so sure this is a bug as everything still technically functions fine so I'm including it in feature requests.

Pylance in VS Code (v1.80.0-insider (Universal)) throws a pyright reportPrivateImportUsage error when accessing open_rasterio from rioxarray.

For people who rely on reportPrivateImportUsage this is a bit annoying.

Steps to reproduce:

Use VS Code (Insider or regular) with Pylance and lint the following lines:

import rioxarray

raster = "path/to/raster"
dataset = rioxarray.open_rasterio(raster)
snowman2 commented 1 year ago

Since you are on the insider version, it may be worthwhile to raise the issue with pylance.

dluks commented 1 year ago

I can do that, but it should be noted that this also occurs on the LTS version for Mac. I wonder if it has anything to do with how rioxarray is including or inheriting xarray's open_rasterio function? Maybe there's some conflict there with rioxarray's self-defined open_rasterio() function. For the record, pylance does not report the error for xarray.open_rasterio().

snowman2 commented 1 year ago

This is what the error is likely complaining about: https://github.com/corteva/rioxarray/blob/ec26269924f59c878679f137758071515ac72e7c/rioxarray/__init__.py#L7

However, I don't think that pylance should care about private imports within the same package.

Kirill888 commented 12 months ago

I believe this is due to missing __all__.