Skip to content

Fix clean imports on Python 3.14 - #38

Merged
aviadr1 merged 2 commits into
mainfrom
codex/python-3.14-deprecation-clean-import
Aug 24, 2026
Merged

Fix clean imports on Python 3.14#38
aviadr1 merged 2 commits into
mainfrom
codex/python-3.14-deprecation-clean-import

Conversation

@aviadr1

@aviadr1 aviadr1 commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Importing winuvloop on Python 3.14 previously resolved deprecated backend policy APIs and emitted an AbstractEventLoopPolicy warning before callers used the package. This PR makes those compatibility exports lazy, so supported run() and loop-factory usage imports cleanly while explicit access to deprecated APIs continues to follow the backend's behavior.

It also keeps winuvloop's public API aligned with uvloop and winloop: install and EventLoopPolicy remain exported through Python 3.15 and leave __all__ and the typing stub when event-loop policies are removed in Python 3.16.

Changes

  • Stop eagerly resolving backend install and EventLoopPolicy attributes.
  • Preserve both compatibility names lazily through Python 3.15.
  • Remove the deprecated names from __all__ and type declarations on Python 3.16+.
  • Run the clean-import regression in a fresh interpreter so backend caching cannot hide the warning.
  • Add cross-platform lifecycle coverage for both sides of the Python 3.16 boundary.
  • Document the compatibility behavior in the changelog.

Evidence

The lifecycle regression fails against the previous PR revision because both deprecated names remain in __all__ for simulated Python 3.16.

After the fix:

  • GitHub Actions: all 7 jobs passed.
  • Tests: 17 passed on Linux with Python 3.8, 3.12, and 3.14.
  • Cross-platform CI: Linux, macOS, and Windows passed.
  • Ruff lint and format checks passed.
  • Ruff preview F822 undefined-export check passed.
  • Source distribution and wheel built successfully; Twine metadata checks passed.

Closes #37.

@aviadr1
aviadr1 marked this pull request as ready for review August 24, 2026 21:43
@aviadr1
aviadr1 merged commit cb3879c into main Aug 24, 2026
7 checks passed
@aviadr1
aviadr1 deleted the codex/python-3.14-deprecation-clean-import branch August 24, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python 3.14: importing winuvloop emits AbstractEventLoopPolicy deprecation warning

1 participant