python-trio / python-trio/flake8-async

Maybe it's helpful to warn about `try` / `except` around `open_nursery`?

Open
#354 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

new rule
Dominant language
Python
Stars
26
Forks
10
PR merge metrics
No merged PRs in 30d

Description

I'm not sure this is a common mistake, but now that strict exception groups are a thing try/except around either trio.open_nursery or trio.run is never going to happen. (except maybe cancellation? I haven't thought through that part)

Stuff like:

async def main():
  try:
    async with trio.open_nursery() as nursery:
      ...
  except KeyboardInterrupt:
    print("...")
    raise

(maybe worth prototyping and seeing if it catches anything?)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by prototyping the shown try/except KeyboardInterrupt pattern around trio.open_nursery and checking how strict exception groups behave. Resolve the open question about cancellation and whether this is a common mistake; done means the warning scope and prototype outcome are decided.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.