Skip to content

PY-ASYN0003 · deprecated_event_loop_policy_usage

Count event-loop policy APIs deprecated in Python 3.14.

This is a deterministic rule for python. Read its implementation.

For a configured minimum Python 3 minor version of 14 or newer, resolve references to get_event_loop_policy, set_event_loop_policy, AbstractEventLoopPolicy, DefaultEventLoopPolicy, WindowsSelectorEventLoopPolicy, and WindowsProactorEventLoopPolicy. The value and findings count every reference.

Every finding gives the deprecated asyncio member and its exact source range. The value is the number of deprecated policy references.

A compatibility layer supporting older Python may temporarily retain policy code behind a version boundary. Python 3.14 applications should configure loops through loop_factory on asyncio.run or asyncio.Runner. No automatic rewrite is safe because policy subclasses can own arbitrary process-wide behavior. python_minor is the Python 3 minor version the project targets, and the rule reports nothing below 14 because these names are not deprecated there.

asyncio.set_event_loop_policy(CustomPolicy()) is reported for Python 3.14. Passing loop_factory=uvloop.new_event_loop to one runner is accepted. A Python 3.13 configuration produces no finding.

  • Cites “The Python Standard Library”, asyncio policy deprecations. Open reference
  • Cites “The Python Standard Library”, asyncio runners and loop_factory. Open reference