Djblets 4.0 provides utilities for working with Rollup.js in Django projects, Server-Sent Events HTTP streams, a view for health checks, API error improvements, modern Python packaging infrastructure for extensions, more Python type hints throughout the codebase, and more!
Rollup.js support
djblets.pipeline
now supports RollupCompiler and utilities for working with Rollup.js in Django projects. This makes it easy to work with TypeScript, ES Modules, and other modern JavaScript architecture within Django.
When used, Rollup.js will be responsible for compiling any index.js
, index.ts
, index.es6
, or index.es6.js
files, making use of your project's Rollup configuration.
Health Check Endpoint
djblets.util.views.HealthCheckStatus can be used by projects to provide a /health/
URL for informing Kubernetes, Docker, monitoring services, etc. of the health of a server. This will check the memory caching and database servers to make sure they're working as expected.
Server-Sent Events HTTP Response
djblets.http.responses.EventStreamHttpResponse can be used to send Server-Sent Events responses to clients. This is especially useful for periodically reporting status to clients during an HTTP POST (such as when results are processing) or when communicating events to a client (which is best done with a ASGI server implementation).
API resources can also return a generator of djblets.webapi.responses.WebAPIEventStreamMessage objects to automatically send a Server-Sent Events response in API handlers.
API Improvements
WebAPIError now supports several new error-related fields, including:
error_type
: A string-based error codeerror_subtype
: A more specific error for a givenerror_type
detail
: Additional, potentially lengthy information about the error, separate from the error message.trace_id
: An opaque ID that can be used to associate error responses with internal logging or monitoring data.
Python Type Hints
We've added more type hints in the following modules:
djblets.configforms
djblets.extensions
djblets.http
djblets.mail
djblets.util
djblets.webapi
Plus More
See the Djblets 4.0 release notes for the complete list of changes.
Installation
$ pip3 install Djblets==4.0