Releases: volfpeter/fasthx
Releases · volfpeter/fasthx
v1.1.0
v1.0.0
What's Changed
- Added
TemplateHeader
(and some utility types) for multi-template support on a single route. By @volfpeter in #23 - Added a
prefix
argument toJinja.hx()
andJinja.page()
. By @volfpeter in #23 - Renamed most
template_name
arguments totemplate
("keyword or positional" arguments are affected, potentially breaking change). By @volfpeter in #23 - Added more tests. By @volfpeter in #23
- Refactored and extended the documentation. By @volfpeter in #23
- Bumped version to
1.0.0
, the project will be sem-ver from now. By @volfpeter in #23
Upgrade from older releases
The upgrade shouldn't require code changes unless you assigned Jinja template names as keyword arguments in Jinja.hx()
and Jinja.page()
. In that case, all you need to do is rename template_name="..."
to template="..."
.
v0.2407.0
v0.2403.1
Changes:
- Added Response header support to Jinja decorators as well by @volfpeter in #20
- Examples, docs, and tests for response headers for Jinja by @volfpeter in #20
v0.2403.0
This is most likely the last release before the project goes sem-ver (1.0).
Changes:
- #18 - Response header support in core decorators by @volfpeter in #19
- #18 - Examples, docs, and tests for response header usage by @volfpeter in #19
v0.2402.2
Changes
- Added a
page()
decorator for unconditionally rendering HTML (useful when a route needs to serve HTML for non-HTMX requests). - Added a
Jinja.page()
decorator, the Jinja2 implementation of the genericpage()
decorator. - Sync routes are now executed in a threadpool to avoid blocking the asyncio event loop.
- Added
Jinja.hx()
as the primary decorator for HTMX-serving routes for overall consistency in the library. At the same time,Jinja.__call__()
andJinja.template()
are now deprecated and will be removed in the future. JinjaContext.unpack_result()
can now handleNone
as well by converting it into an empty Jinja rendering context.- Typing improvements.
- Renamed
HTMXRenderer
toHTMLRenderer
.HTMXRenderer
is still importable as a deprecated alias ofHTMLRenderer
. - Updated the existing Jinja example to showcase the updated
Jinja
class. - Added a fully-working (although rather basic) custom rendering example.
- Updated the documentation.
Internals
A lot of internal code has been moved. If, for some reason you imported something directly from a module instead of the package, you will unfortunately need to update your imports. New package layout:
fasthx.core_decorators
: thehx()
andpage()
decorators can now be found here.- Jinja-related code has been moved from
fasthx.main
tofasthx.jinja
. get_hx_request()
andDependsHXRequest
are now infasthx.dependencies
.- All utility types have been moved from
fasthx.main
tofasthx.typing
. - The internal
_append_to_signature()
method was moved fromfasthx.main
tofasthx.utils
and renamed toappend_to_signature
. This method is still for internal use only.
v0.2402.1
v0.2402.0
Changes:
Jinja
now supports non-dict route return values by default. The conversion from such values to valid Jinja contexts (dict
) is done byJinjaContextFactory
methods with default implementations inJinjaContext
.- It's possible to set the default Jinja context factory through the
Jinja.make_context
property. - It's possible to override the
Jinja
instance's context factory on a per-route basis using themake_context
argument of the decorator. Jinja
got a new hook method_make_response()
for response customization.- Updated the documentation to highlight these features.