authlib icon indicating copy to clipboard operation
authlib copied to clipboard

PEP-484 Type Hints

Open relsunkaev opened this issue 2 years ago • 8 comments

Is your feature request related to a problem? Please describe.

We use python with strict typing at our organization which means we have to add a bunch of "type: ignore" comments wherever this library is used. Adding types would make working with this library much easier and require much less context switching between the docs and the editor thanks to autocomplete.

Describe the solution you'd like

I understand a bunch of functionality in this library is very hard to type (dynamic clients, etc.), so maybe this effort could start with the JOSE module.

Describe alternatives you've considered

Alternatively, type stubs for this library could be added to the typeshed project but that is not ideal as it would be very easy for those to get out of sync.

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive the pledge once the issue is completed & verified
Fund with Polar

relsunkaev avatar May 17 '22 05:05 relsunkaev

Is there any interest in this from maintainers? Would a PR be welcome, or is there some discussion that should take place prior to that?

relsunkaev avatar Jun 14 '22 16:06 relsunkaev

We are in the same situation in my organization as @relsunkaev. Is there any movement in this direction?

cristianbercu avatar Dec 06 '22 13:12 cristianbercu

I just noticed this issue has been labeled which I'm gonna take as an endorsement and take a stab at a PR.

relsunkaev avatar Dec 06 '22 16:12 relsunkaev

@relsunkaev If you haven't got time to work on this, I can make a draft PR regarding this issue. If you've already made some progress, I'd be happy to help

Viicos avatar Jan 09 '23 22:01 Viicos

@relsunkaev If you haven't got time to work on this, I can make a draft PR regarding this issue. If you've already made some progress, I'd be happy to help

I have indeed made some progress, I will share the repository soon.

relsunkaev avatar Jan 10 '23 05:01 relsunkaev

I've created a separated jose module with type hints: https://github.com/authlib/joserfc

lepture avatar Jul 14 '23 17:07 lepture

I've created a separated jose module with type hints: https://github.com/authlib/joserfc

Thanks for making this happen, we have done very smooth transition.

alonbl avatar Oct 01 '23 16:10 alonbl