python-trio / python-trio/flake8-async

Create new `ASYNC3xx` rules to account for asyncio's different cancellation semantics?

Open
#257 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

In https://github.com/python-trio/flake8-async/issues/211, we noted that ASYNC102 (await-in-finally-or-cancelled) is specific to Trio/AnyIO style "level-triggered" cancellation semantics.

Asyncio has a pretty different system, where cancellation is an event rather than a state (well, mostly - on Python 3.11+ there's also Task.uncancel() to reverse the state change, on 3.10 and earlier you can only partly uncancel).

If someone works out a good lint rule, or set of rules, for asyncio-style cancellation semantics, we'd be happy to accept them as ASYNC3xx rules and make ASYNC102 specific to Trio and AnyIO.

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 reading issue 211, the existing ASYNC102 rule, and the linked asyncio cancellation documentation. Work out a well-defined ASYNC3xx rule or rule set for asyncio's cancellation semantics, then confirm that ASYNC102 can remain specific to Trio and AnyIO and that the proposed rules are suitable for acceptance.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.