ngrok-python icon indicating copy to clipboard operation
ngrok-python copied to clipboard

fix: update type hints to reflect awaitable return types for module methods

Open rudi193-cmd opened this issue 6 months ago • 1 comments

Resolves #125

The module-level methods (connect, default, disconnect, fd, forward, getsockname, listen) use loop_wrap under the hood, which returns an awaitable (a Task) if an async loop is running, or the synchronous result if not.

This PR updates the type hints in ngrok.pyi to reflect this dual return type (Union[Awaitable[T], T]), similar to how werkzeug_develop is already typed. This accurately reflects the runtime behavior and resolves the issue where type checkers complain about awaiting these methods or using their synchronous results.

Made with Cursor

rudi193-cmd avatar May 20 '26 00:05 rudi193-cmd

Rebased onto main only (no longer stacked on #159). Single commit touching ngrok.pyi — PR was briefly closed after a bad force-push; reopened.

rudi193-cmd avatar May 20 '26 18:05 rudi193-cmd