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

Pyright does not recognize pandera.polars exports: reportPrivateImportUsage #1726

Open
3 tasks done
RmStorm opened this issue Jul 3, 2024 · 1 comment
Open
3 tasks done
Labels
bug Something isn't working

Comments

@RmStorm
Copy link

RmStorm commented Jul 3, 2024

Describe the bug
Pyright throws reportPrivateImportUsage errors on basically everything imported from pandera.polars.

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of pandera.
  • (optional) I have confirmed this bug exists on the main branch of pandera.

Simply running pyright by hand on a minimal example like this will show the problem:

#!/usr/bin/python3
# privates.py
import pandera.polars as pa

class SomeSchema(pa.DataFrameModel):
    height: float
    horizontal_accuracy: float
    config_id: str = pa.Field(nullable=True)
➜ pyright privates.py 
/SNIP/privates.py
  /SNIP/privates.py:6:21 - error: "DataFrameModel" is not exported from module "pandera.polars" (reportPrivateImportUsage)
  /SNIP/privates.py:9:25 - error: "Field" is not exported from module "pandera.polars" (reportPrivateImportUsage)
2 errors, 0 warnings, 0 informations

Expected behavior

Running pyright (either by hand or indirectly as an LSP in an editor) should not give any errors. More importantly I don't expect little red squiggly lines on literally every import from pandera.polars.

Context

I'm currently on pandera version 0.20.1 and pyright version 1.1.368.

To me it looks like Pylance papers over these issues or swallows the error even though it's using pyright under the hood. The pyright folk are really pretty clear that this is as designed and it ought to be fixed in the libraries. See this issue in pyright for example.

If you agree this is an issue and should be fixed in pandera I can probably find the time to make a PR!

@RmStorm RmStorm added the bug Something isn't working label Jul 3, 2024
@cosmicBboy
Copy link
Collaborator

Hi @RmStorm, this is probably because the pandera.polars module doesn't define __all__... can you try adding it e.g. see here and see if the pyright error goes away?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants