I'm not sure there's anything "impossible" about how small this is. You don't really need a lot of lines of code to support routes, request and response and nothing else. If anything, 765 lines of code for this is quite a lot.
It also uses libraries for most "extensions" that are available, defeating the purpose and bending the claim that it's 1,700 lines of code including the extensions. Just jinja, one of the dependencies, is 18,000 lines of code. If that counts my Nanodot server which calls flask.app.run() is one line...
To clarify this, note that the extensions are entirely optional, and unlike what you are saying, most do not require any dependencies.
The only two extensions that use dependencies are the one that adds template rendering, and the one that implements secure user sessions.
For templates, you can use Jinja on CPython (where you wouldn't normally have space issues), or the uTemplate library (https://github.com/pfalcon/utemplate) on MicroPython, which is quite small.
For secure sessions, on CPython you have to add PyJWT. On MicroPython you need to add the HMAC and JWT modules from the MicroPython standard library, which are not installed by default. These are also very small.
Yeah, it's an over exaggeration to say "impossibly small", it's a pretty normal size for a minimal routing class...
> I'm not sure there's anything "impossible" about how small this is. You don't really need a lot of lines of code to support routes, request and response and nothing else. If anything, 765 lines of code for this is quite a lot.
How do you explain why virtually all frameworks end up requiring an order of magnitude more LoC?
Because they support a lot more features?
I made a similar "framework" in PHP years back as an experiment and it was a couple hundred lines AT MOST.
> Because they support a lot more features?
Not necessarily. For example, some minimal web frameworks actually provide multiple routing strategies because different implementation strategy have tradeoffs.
Not meaning to be pedantic, but supporting multiple routing strategies is textbook ”more features”.
Are they, though? I mean, is it a feature to make something usable? If you have hard performance constraints and you know what routes you need to suppport, a generic but prohibitively expensive routing strategy can prevent you from using the framework.
> I mean, is it a feature to make something usable?
In your own example, having multiple ways of declaring routing is not required to be considered usable.
So, yes.