Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: improve channel typings, add method stubs #2022

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

devkral
Copy link
Contributor

@devkral devkral commented Jun 27, 2023

Currently the layers module is untyped and BaseChannelLayer is not a real interface (lacks stub methods)

This PR adds typings and stub methods (for type hinting and getting a meaningful error in case something is missing)

@devkral
Copy link
Contributor Author

devkral commented Jan 28, 2024

ping?

@carltongibson
Copy link
Member

ping?

Yes, I'm not sure about this. It's a lot of noise for not much benefit as far as I can see.

Surely though, if we were adding types, a Protocol would be the way forward, rather than base class stub methods... 🤔

@devkral
Copy link
Contributor Author

devkral commented Jan 29, 2024

The problem my PR solves is, that it is not obvious for programmers how to write a layer backend.
Docstrings are spread around and you have to look in channels-redis too to make sense of the functions

Agreed a protocol would be maybe better later but it needs more refactory.
I will implement this

@devkral

This comment was marked as outdated.

@devkral
Copy link
Contributor Author

devkral commented Jan 29, 2024

how do you think about this?

BaseChannelLayer is now abstract, the extensions are now runtime checkable Protocols.

If you think this is good, I can document the changes

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.

None yet

2 participants