Fasthx

Latest version: v2.0.2

Safety actively analyzes 681866 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 4

0.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 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.

0.2402.1

0.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 by `JinjaContextFactory` methods with default implementations in `JinjaContext`.
- 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 the `make_context` argument of the decorator.
- `Jinja` got a new hook method `_make_response()` for response customization.
- Updated the documentation to highlight these features.

0.2401.3

Features:

- Show the `HX-Request` header in the OpenAPI docs of decorated routes, see 5
- Updated custom rendering example.

0.2401.2

README and documentation fix.

0.2401.1

Fixed readme.

Page 3 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.