-
-
Notifications
You must be signed in to change notification settings - Fork 230
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
BaseRouter and Router have different signatures for add_route #1035
Comments
Hey @dave42w 👋 I just want to show that every router needs to have an |
I'm not sure :-) I'll have a think |
I think we could fix by creating two more ABCs. One for the parameters eg BaseRouteArg and one for the return type eg BaseRouteReturn For each type of Router we need two classes eg
That seems a bit clumsy, but if we create these as dataclasses, we can move argument validation into them. That would simplify the add_route methods, which are currently long with deep nesting. So now we have
|
If the constructor for RouterRouteArg has exactly the same arguments as the Router.add_route currently does then code changes should be minimal. eg In Robyn.add_route we construct a RouterRouteArg before passing it to |
Hi @sansyrox This passes mypy. It's slightly odd to me that the ABC class needs to be used for the argument but the specific subclass can be used for the return. That's why I've added the assert.
Are you interested in a PR for this? |
Bug Description
According to mypy None of the subclasses of BaseRouter correctly implement the abstractmethod add_route.
vs
vs
vs
The mypy errors are:
I can't find any use of BaseRouter in the codebase.
Options:
Steps to Reproduce
Your operating system
Linux
Your Python version (
python --version
)3.12
Your Robyn version
main branch
Additional Info
No response
The text was updated successfully, but these errors were encountered: