channels_redis icon indicating copy to clipboard operation
channels_redis copied to clipboard

FEAT: type hint

Open iwakitakuma33 opened this issue 6 months ago • 5 comments

https://github.com/django/channels_redis/issues/412

iwakitakuma33 avatar May 29 '25 14:05 iwakitakuma33

i'm yet to take a good look at this PR just like to mention that redis-py has wrong type hints so it shouldn't be used as guide to type hint this package

amirreza8002 avatar May 29 '25 14:05 amirreza8002

@amirreza8002 thanks for your review. I will do without redis-py!

best

iwakitakuma33 avatar May 29 '25 15:05 iwakitakuma33

hi @bigfootjon sorry for the ping since django is now python >= 3.10, is there any plans to move this package to >=3.10 as well? if so we could drop a lot of old syntax and take advantage of the newer typing supports

amirreza8002 avatar May 30 '25 12:05 amirreza8002

Sorry for the slow reply, 2 major pieces of feedback:

  1. We need some kind of CI on these changes. Something like how asgiref does it: https://github.com/django/asgiref/blob/main/tox.ini#L11
  2. This PR should ONLY add type-hints, please revert all other changes like the xfail removals

bigfootjon avatar Jun 08 '25 21:06 bigfootjon

Sorry for the slow reply, 2 major pieces of feedback:

  1. We need some kind of CI on these changes. Something like how asgiref does it: https://github.com/django/asgiref/blob/main/tox.ini#L11
  2. This PR should ONLY add type-hints, please revert all other changes like the xfail removals

@amirreza8002 @bigfootjon Thanks for replying.

The xfail fix has been reverted. The import order has been corrected. mypy ci has been introduced. Any has been used where necessary to reduce the number of error messages in mypy results.

iwakitakuma33 avatar Jul 04 '25 09:07 iwakitakuma33

@amirreza8002 @bigfootjon I fixed fail of CI.

Could you approve workflow awaiting?

iwakitakuma33 avatar Jul 15 '25 19:07 iwakitakuma33

@carltongibson thanks for approve workflow.

All tests were successful, but only the package dependency resolution error failed. I have resolved the conflict with the main branch. Can you approve the side workflow?

iwakitakuma33 avatar Jul 26 '25 14:07 iwakitakuma33

i should clarify that i am not a maintainer here, only an interested passer-by

i would note that since channels-redis is now python >= 3.9, we can get rid of typing.Dict and simply use dict (same goes forlist and the like)

amirreza8002 avatar Aug 15 '25 01:08 amirreza8002