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

Fix pn.state.onload type hint #5804

Merged
merged 1 commit into from
Nov 6, 2023
Merged

Fix pn.state.onload type hint #5804

merged 1 commit into from
Nov 6, 2023

Conversation

MarcSkovMadsen
Copy link
Collaborator

My editor was complaining about the typehint for pn.state.onload when using an async callable as in

import panel as pn
from asyncio import sleep
pn.extension()

pn.panel("Hello").servable()

async def run():
    for i in range(10):
        print(i, " I sleep")
        await sleep(0.1)
        
pn.state.onload(run)

This PR fixes the issue. See also python/typing#424 for guidance on type annotations for async callables.

@philippjfr philippjfr merged commit 66d9e42 into main Nov 6, 2023
8 of 11 checks passed
@philippjfr philippjfr deleted the fix/typehint-onload branch November 6, 2023 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants