wrapt 2.2.0 introduces new tools for decorators that need to change a function's outward shape at runtime. The new `wrapt.with_signature` decorator replaces the deprecated `adapter=` argument and lets you override what `inspect.signature` reports using a prototype function, a prebuilt `inspect.Signature` object, or a factory callable. For sync/async calling-convention mismatches, the new `mark_as_sync` and `mark_as_async` decorators correct what `inspect.iscoroutinefunction` and related checks report without doing any bridging themselves. Convenience decorators `async_to_sync` and `sync_to_async` handle both the bridging and the marking together for common cases. The two concerns — signature shape and calling convention — are kept separate and can be freely composed by stacking decorators.
Table of contents
What introspection is forThe signature side: the old wayThe signature side: with_signatureThe calling-convention side: the problemmark_as_sync and mark_as_asyncasync_to_sync and sync_to_asyncComposing both axesWrap upSort: