typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

Added annotation for five functions in Authlib

Open Spider84pr opened this issue 4 months ago • 33 comments

I have added five annotation in Authlib Not sure how to annotate returning request function of AsyncOAuth1Mixin class It seem returning Response object from request library. I am not sure how to annotate it correctly Can I write it like this? async def request(self, method, url: str, token: dict[str, Any] | None =None, **kwargs): -> Response ...

Spider84pr avatar Sep 27 '25 23:09 Spider84pr

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Sep 27 '25 23:09 github-actions[bot]

I am especially doubting if i must import Request?

Spider84pr avatar Sep 27 '25 23:09 Spider84pr

I have look in existing stubs and I found how to do it. Hopefully it is correct. If something wrong - please teIll me - I will fix it

Spider84pr avatar Sep 29 '25 00:09 Spider84pr

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Sep 29 '25 00:09 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Sep 29 '25 19:09 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Sep 29 '25 20:09 github-actions[bot]

Some tests failed I have googled and added to Response import # type: ignore[import-untyped] Now all test are passed but I dont know is this trick a legal one

Spider84pr avatar Sep 29 '25 20:09 Spider84pr

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Sep 30 '25 18:09 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Sep 30 '25 18:09 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Sep 30 '25 20:09 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Sep 30 '25 21:09 github-actions[bot]

I have added httpx in dependencies and annotated kwargs

Spider84pr avatar Sep 30 '25 21:09 Spider84pr

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Sep 30 '25 21:09 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Oct 01 '25 00:10 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Oct 01 '25 05:10 github-actions[bot]

Please, add new entries to the allowedlist for now

sobolevn avatar Oct 01 '25 05:10 sobolevn

Do I need to do something ro fix the tests?

Spider84pr avatar Oct 02 '25 14:10 Spider84pr

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Oct 02 '25 21:10 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Oct 02 '25 21:10 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Oct 02 '25 21:10 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Oct 02 '25 21:10 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Oct 02 '25 23:10 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Oct 02 '25 23:10 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Oct 02 '25 23:10 github-actions[bot]

Hello. I have problems that I cannot solve myself for getting two remaining test to work.

Authlib requires cryptography for work. I have installed if on my local machine and all tests runs OK. I have googled and it reccomended to put it in /requirements-tests.txt Tried to do it in PR - this test are passed but appeared a lot of other error in other stub files. I thought that it was bad idea and removed it back from requirements-tests. I dont know where to put it correctly. In requirements-tests.txt there is no similar libraries and i think iiit is not the right place

As previously mentioned tests found many errors in other files. After this PR I can try work, on it. Sorry for many commit and large post.

Spider84pr avatar Oct 03 '25 00:10 Spider84pr

Just add new errors to https://github.com/python/typeshed/blob/main/stubs/Authlib/%40tests/stubtest_allowlist.txt with a TODO comment that they need to be handled later (you can do this in the next PR).

@srittau can you please help with the stub_uploader failed job? I've submitted a PR with httpx addition :)

sobolevn avatar Oct 03 '25 10:10 sobolevn

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Oct 04 '25 23:10 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Oct 04 '25 23:10 github-actions[bot]

@sobolevn I've added entries in stubtest_allowlist.txt and I will work it in next PR but I cannot resolve the remaining two test. Must I just wait? I am also tried te setup this tests on local machine but without success. Is it possible?

Spider84pr avatar Oct 04 '25 23:10 Spider84pr

@sobolevn thanks for corrected me.Also I have succesfully setup stub_ uploader on local machine. Hopefully it will help me in future PRs.

Spider84pr avatar Oct 05 '25 13:10 Spider84pr