Skip to content

Add mypy friendly py.typed marker and stubs#32

Open
ronyb29 wants to merge 6 commits intoDreamLab:masterfrom
ronyb29:master
Open

Add mypy friendly py.typed marker and stubs#32
ronyb29 wants to merge 6 commits intoDreamLab:masterfrom
ronyb29:master

Conversation

@ronyb29
Copy link

@ronyb29 ronyb29 commented Jul 20, 2024

Hey nice lib,

I'm trying to make it "mypy-friendly".

tested on py3.11 with this stub, but it should work for older versions too

from memoize.configuration import DefaultInMemoryCacheConfiguration
from memoize.wrapper import memoize


@memoize(configuration=DefaultInMemoryCacheConfiguration())
async def get_value(arg: str, *, kwarg: str = None) -> str:
    return arg + (kwarg or '')

reveal_type(get_value)

before would yield

checktypes.py:9: note: Revealed type is "Any"

now yields

checktypes.py:9: note: Revealed type is "def (arg: builtins.str, *, kwarg: Union[builtins.str, None] =) -> typing.Coroutine[Any, Any, builtins.str]"

@ronyb29
Copy link
Author

ronyb29 commented Mar 4, 2026

Hi @kwarunek can you take a look again?

@ronyb29 ronyb29 changed the title Add py.typed marker and stub for decorator type Add mypy friendly py.typed marker and stubs Mar 8, 2026
@ronyb29
Copy link
Author

ronyb29 commented Mar 9, 2026

Hi guys, what are next steps to merge and release it?

@kwarunek @zmumi

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.

2 participants