diff --git a/CHANGELOG.md b/CHANGELOG.md index 56d69c3..1bcce44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,11 @@ All notable changes to `winuvloop` are documented here. -## 0.2.1 - Unreleased +## 0.2.2 - Unreleased + +- Add public API stubs for better editor and type-checker ergonomics. + +## 0.2.1 - 2026-04-25 - Move packaging to standard PEP 621 metadata and the `uv_build` backend. - Replace `poetry.lock` with `uv.lock` for faster, reproducible development. diff --git a/README.md b/README.md index 5b4bccc..ce05407 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,13 @@ The module re-exports the common backend API: Backend-specific attributes are delegated to the selected upstream module. +## Typing + +`winuvloop` ships a `py.typed` marker and public API stubs for the selector +module. The runtime values remain direct aliases to the selected upstream +backend, so `winuvloop.Loop` is still `uvloop.Loop` on POSIX and `winloop.Loop` +on Windows. + ## Compatibility `winuvloop` targets CPython 3.8.1 and newer, matching the current published diff --git a/pyproject.toml b/pyproject.toml index b6b49d1..108ed65 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "uv_build" [project] name = "winuvloop" -version = "0.2.1" +version = "0.2.2" description = "Cross-platform asyncio event loop selection: uvloop on POSIX and winloop on Windows." readme = "README.md" requires-python = ">=3.8.1" diff --git a/src/winuvloop/__init__.pyi b/src/winuvloop/__init__.pyi new file mode 100644 index 0000000..0caf2b1 --- /dev/null +++ b/src/winuvloop/__init__.pyi @@ -0,0 +1,48 @@ +from __future__ import annotations + +import asyncio +from types import ModuleType +from typing import Any, Callable, Coroutine, TypeVar + +_T = TypeVar("_T") + +__backend__: str +__version__: str + + +class Loop(asyncio.AbstractEventLoop): + ... + + +class EventLoopPolicy(asyncio.AbstractEventLoopPolicy): + ... + + +def backend_name() -> str: + ... + + +def backend() -> ModuleType: + ... + + +def new_event_loop() -> Loop: + ... + + +def install() -> None: + ... + + +def run( + main: Coroutine[Any, Any, _T], + *, + loop_factory: Callable[[], Loop] | None = ..., + debug: bool | None = ..., + **run_kwargs: Any, +) -> _T: + ... + + +def __getattr__(name: str) -> Any: + ... diff --git a/uv.lock b/uv.lock index aa7ef78..3a74800 100644 --- a/uv.lock +++ b/uv.lock @@ -1393,7 +1393,7 @@ wheels = [ [[package]] name = "winuvloop" -version = "0.2.1" +version = "0.2.2" source = { editable = "." } dependencies = [ { name = "uvloop", marker = "platform_python_implementation == 'CPython' and sys_platform != 'win32'" },