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 complain "component" is not exported from module "solara" #465

Open
zhuoqiang opened this issue Jan 13, 2024 · 2 comments
Open

pyright complain "component" is not exported from module "solara" #465

zhuoqiang opened this issue Jan 13, 2024 · 2 comments

Comments

@zhuoqiang
Copy link

pyright complains "component" is not exported from module "solara" for the following code, line 3

import solara

@solara.component
class Page
    pass

turns out it is not a false alarm, see microsoft/pyright#5929

By default, all imports in a py.typed library are considered private unless they are explicitly re-exported. To indicate that an imported symbol is intended to be re-exported, the maintainers of this library would need to use one of the techniques documented here

so I guess instead of

from reacton import component

it could be updated to re-exported using the redundant form to make pyright happy

from reacton import component as component
@Lundez
Copy link
Contributor

Lundez commented Jan 25, 2024

I think adding the following to .vscode/settings.json solved this for me 👍

    "python.analysis.packageIndexDepths": [
        {
            "name": "",
            "depth": 5
        }
    ],
@Jhsmit
Copy link
Contributor

Jhsmit commented Mar 13, 2024

I have the same issue (with pylance)
Not only solara.component but also solara.use_state (basically any reacton import)

unfortunately @Lundez' fix doesnt seem to help

adding __all__ to __init__.py can also fix the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants