aiozmq icon indicating copy to clipboard operation
aiozmq copied to clipboard

Deprecate usage of annotations as parameter converters

Open JelleZijlstra opened this issue 7 years ago • 4 comments

aiozmq currently inspects annotations on RPC methods and uses them as parameter converters. This makes it hard to use typing on a codebase that uses aiozmq, so we should deprecate and replace this feature.

JelleZijlstra avatar Jun 16 '18 17:06 JelleZijlstra

Any ideas for the replacement?

asvetlov avatar Jun 16 '18 21:06 asvetlov

May be define converters as `rpc.method`` decorator parameters?

akhilman avatar Aug 25 '18 12:08 akhilman

I take it this is why when I use annotations on the rpc.method I get an exception?

import aiozmq.rpc
from typing import Any

@aiozmq.rpc.method
async def create(self, meta: Any) -> int:
    ...

aiozmq.rpc.base.ParametersError: Invalid value for argument 'meta': TypeError('Cannot instantiate typing.Any')

wachpwnski avatar Feb 19 '20 17:02 wachpwnski

Yes.

JelleZijlstra avatar Feb 19 '20 18:02 JelleZijlstra

Done in the latest release.

JelleZijlstra avatar Nov 03 '22 01:11 JelleZijlstra