posit-dev / posit-dev/py-shiny
Should figure out how to check sync/async types for decorators
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 135
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 21
Description
In the example below, the last function, gas, should be flagged, since a synchronous function can't depend on an async event. Currently, our typing does not flag it. (I don't know that it's actually possible with Python.)
def fs() -> int:
return 1
async def fa() -> int:
return 1
# sync-sync - OK
@event(fs)
def gss() -> int:
return 3
# async-async - OK
@event(fa)
async def gaa() -> int:
return 3
# sync-async - OK
@event(fs)
async def gsa() -> int:
return 3
# async-sync - should be flagged
@event(fa)
def gas() -> int:
return 3
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by investigating the typing behavior of the event decorator using the four sync/async examples in the issue. Done means determining whether the type system can flag gas, where a synchronous function depends on an async event, while accepting the other three combinations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100