v0.10.0 - HTML streaming and performance boost
What's Changed
The main feature is that the library now has a StreamingRenderer that lets you optimize TTFB (time to first byte), basically producing instant responses.
Tags (and the entire html module) have been rewritten to improve performance. Tag creation is now ~35% faster.
Rewritten how ErrorBoundary works, which simplified renderers and improved performance by about ~5-10.
Streaming support will soon land in FastHX and holm as well, to give you the best possible web development experience.
Features
- Introduce the streaming renderer concept. The default streaming renderer can be imported as
from htmy import StreamingRenderer. (by @volfpeter in #94) - The baseline renderer can now stream the result, reducing time to first byte to around 0.00001s (several orders of magnitude improvement for a typical webpage). As a side-effect, this renderer's performance is now only about 20-25% worse then the default renderer's. (by @volfpeter in #94)
- The renderer instance can now be loaded from the rendering context using the
RendererContextutility. (by @volfpeter in #94) - Simplified renderers by moving the
ErrorBoundaryrendering logic into the component itself. Also slightly improved renderer performance in the process. (by @volfpeter in #94) - Rewritten how tags work to improve tag creation performance by ~35%. (by @volfpeter in #94)
Breaking changes
These are likely to affect you:
htmltags can no longer be used for type hints. You should useComponentTypeinstead.htmltags no longer have class utilities likelink.css()ormeta.charset()for example. The title-case variants have these utility constructors instead, e.g.Link.css()orMeta.charset().WildcardTagis replace bywildcard_tag.
These likely won't affect you:
- Tag implementations have been moved to
tag.py. - Creating tags can no longer be done with subclassing (well, it can, just quite differently to how it was done before).
TagConfigDictwas removed, configuration is now done directly through theTag()constructor.
Other changes
- Moved the project from
poetrytouv. - Updated dev dependencies.
- Fixed a number of deprecation warnings (most caused by using
asyncioandAwaitableinstead of the correspondinginspectfunctions). - Added tests for new features.
- Migrated from
mkdocs-materialtozensical
Full Changelog: v0.9.0...v0.10.0