Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dluks opened this issue Jul 6, 2023 · 4 comments · Fixed by #683
Closed
Labels
proposal Idea for a new feature.

Comments

@dluks
Copy link
Contributor

dluks commented Jul 6, 2023

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)
@dluks dluks added the proposal Idea for a new feature. label Jul 6, 2023
@snowman2
Copy link
Member

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

@dluks
Copy link
Contributor Author

dluks commented Jul 11, 2023

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
Copy link
Member

snowman2 commented Jul 11, 2023

This is what the error is likely complaining about:

from rioxarray._io import open_rasterio # noqa

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

Kirill888 added a commit to Kirill888/rioxarray that referenced this issue Jul 11, 2023
@Kirill888
Copy link
Contributor

I believe this is due to missing __all__.

@dluks dluks changed the title "open_rasterio" is not exported from module "rioxarray" error reported by Pylance linting "'open_rasterio' is not exported from module 'rioxarray'" error reported by Pylance linting Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Idea for a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants