2021 Development Plan

I have been mulling around the ideas of what should be our priorities in 2021. As always, of course, speed and stability are paramount. Sanic is not a framework about throwing a lot of built in features. It is not opinionated, and meant to provide flexibility. With that in mind, here are some thoughts I had in the general strategy.

  1. Let’s get streaming merged and out the door for 21.3.
  2. Testing - Also close to completion and should be in 21.3 is ripping out testing and releasing in its own package.
  3. Routing - there’s no lack of discussion and I have been saying this for several years now. This is next on my list. Why? Because it will help in both of the next two items.
  4. Signals - this is a potential huge win for flexbility. And, without the bloat of another package, I think we can leverage the new router (or a subclass of it) for handling the dispatching of events.
  5. Streamlining - One of the core ideas of the new router will be to build at runtime an executable call chain for parsing and delivering a route to the handler. I think this can be extended (and indeed with some nice performance increases in rudimentary testing). I know this is something @vltr has wanted for a while. Basic idea would be to create a single call stack to wrap applicable routing, middleware, handling, etc into one single executable at runtime. One challenge here will be not expending too much memory, but there could be some nice performance gains. And, when we are talking about potentially adding more complexity to a route with signals, this could mitigate that. This is in early thoughts. An RFC to come later.
  6. Caching - One thing we do not do is cache responses. This could be an easy win. It is a standard in a lot of other frameworks, so we should at least provide an opt-in pattern.

With this in mind, a general plan for 2021:

21.3 - streaming all responses, removing testing, maybe routing
21.6 - routing (if not already), signals, streamlining
21.9 - cleanup
21.12 - release Sanic with level 5 - Stable

Where should caching go? It is sort of outside of the building blocks of the above items. It could probably go at any time after streaming merge.

Thanks @ahopkins for writing up what looks like a really exciting strategy for 2021.

I’ve been playing with the Streaming changes (already merged into master) and I’m really liking the changes so far.

I’d like to play around with your new router code too when I get a chance. I’d really like to see routing going into 21.3 because it’s likely it will require some breaking changes, and 21.3 is the best time in the year to include those changes.

I have a question about version numbering in Master.

Current text in version.py in master is “20.12.0”.

Thats because 20.12 was released, then the LTS branch (with 20.12.1) was split off master.

That is normal and expected, but should be also change the version in master so maybe “21.3.0a1” or something similar?

I ask because I’m currently testing writing some plugins against Sanic master, and usually I use version number comparisons to enable/disable version-specific code. But with current master reporting as “20.12.0” this is not possible.

That’s fine with me. That’s probably a good practice to do after releases.

Sure thing. I also want to get this going soon. There’s some small items I’ve marked in GH, but I think we have the bandwidth to get this in within the next couple weeks so we can iterate over it. I think ultimately after we have an initial version we can optimize it by having make a few optimization decisions based upon either config or analysis of defined routes. There are some changes that are tradeoffs in performance in different scenarios.

I also ultimately have some ideas on using a similar strategy of AST style code optimization that can be used elsewhere on the handling cycle.

You can see the code here.

I am working on an integration now.

That looks awesome. Can’t wait to have such a fast router in Sanic.