Skip to content

Releases: volfpeter/fasthx

v2.0.0-rc3

09 Sep 11:30
d4d293f
Compare
Choose a tag to compare

Changes

Full Changelog: v2.0.0-rc2...v2.0.0-rc3

v2.0.0-rc2

03 Sep 08:41
256b12f
Compare
Choose a tag to compare

Changes (breaking):

  • The RequestComponentSelector protocol and the ComponentSelector type are generic now to allow more flexible integrations.
  • RequestComponentSelector.get_component_id() was renamed to RequestComponentSelector.get_component() as a consequence of the above change.

How to migrate from 2.0.0-rc1:

  • If you have custom component selector implementations, just rename your RequestComponentSelector.get_component_id() methods to RequestComponentSelector.get_component().
  • If you've written a custom integration, just add the required generic type to ComponentSelector type hints.

PRs

Full Changelog: v2.0.0-rc1...v2.0.0-rc2

v2.0.0-rc1

27 Aug 20:24
33f374e
Compare
Choose a tag to compare

What's Changed

Features:

  • Both the core (hx() and page()) decorators and the Jinja integration got support for error rendering. Fixes #28.
  • Response status code and background job are preserved (if set on the Response dependency for example in a route). Fixes #26 #27.
  • Added a JinjaPath utility, see docs for details.

Breaking changes:

  • To support error rendering, the RequestComponentSelector protocol got a second argument (error: Exception | None).
  • The internals of Jinja changed slightly.

How to upgrade:

  • If you have custom RequestComponentSelector implementations, then please add the new argument to the get_component_id() method. Well-behaved RequestComponentSelectors that don's support error rendering should reraise the received error if it's not None (although not doing so will not break anything as result and errors are clearly separated in Jinja and the core decorators don't rely on this protocol).
  • If you've overridden any of the protected methods of Jinja, please go through this PR so you can upgrade your custom implementation.

Full Changelog: v1.1.1...v2.0.0-rc1

v1.1.1

31 Jul 20:15
10bf17b
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.1.0...v1.1.1

v1.1.0

31 Jul 14:01
593d75a
Compare
Choose a tag to compare

What's Changed

  • Added JinjaContext.wrap_as() utility and tests by @volfpeter in #24

v1.0.0

16 Jul 15:02
1dd33f6
Compare
Choose a tag to compare

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 to Jinja.hx() and Jinja.page(). By @volfpeter in #23
  • Renamed most template_name arguments to template ("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

14 Jul 15:51
a367c9b
Compare
Choose a tag to compare

Removed deprecated code (breaking changes):

  • HTMXRenderer: use HTMLRenderer instead.
  • Jinja.__call__(): use Jinja.hx instead.
  • Jinja.template(): use Jinja.hx instead.

Other changes:

  • Tooling upgrade.

v0.2403.1

26 Mar 19:56
4d1e77c
Compare
Choose a tag to compare

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

26 Mar 13:45
cd54f96
Compare
Choose a tag to compare

This is most likely the last release before the project goes sem-ver (1.0).

Changes:

v0.2402.2

20 Feb 20:42
f5496a3
Compare
Choose a tag to compare

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 generic page() 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__() and Jinja.template() are now deprecated and will be removed in the future.
  • JinjaContext.unpack_result() can now handle None as well by converting it into an empty Jinja rendering context.
  • Typing improvements.
  • Renamed HTMXRenderer to HTMLRenderer. HTMXRenderer is still importable as a deprecated alias of HTMLRenderer.
  • 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: the hx() and page() decorators can now be found here.
  • Jinja-related code has been moved from fasthx.main to fasthx.jinja.
  • get_hx_request() and DependsHXRequest are now in fasthx.dependencies.
  • All utility types have been moved from fasthx.main to fasthx.typing.
  • The internal _append_to_signature() method was moved from fasthx.main to fasthx.utils and renamed to append_to_signature. This method is still for internal use only.