Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

dj-hyperview

CI Codecov PyPI - Python Version Django Versions PyPI Downloads Ruff License

Server-driven Hyperview UI for Django, with every screen owned by your project. Resolve, render, validate, cache, and publish mobile UI from filesystem or database templates without bundling application screens into the package.

  • Consumer-owned screens — keep XML and HXML inside the Django project that defines the mobile application.
  • Ordered template sources — resolve from configured filesystem directories, the optional database app, or custom source backends with explicit precedence.
  • Live database publication — edit validated templates through Django admin and expose committed changes on the next request, with an optional HXML-aware Ace editor.
  • Cache consistency — opt into a compatible Django cache backend, including Redis, with source-aware keys and generation-based invalidation. File-based caches are not supported.
  • Optional realtime hints — use [realtime] for Redis-backed after-commit SSE invalidation, with exact v1 compatibility and negotiated opaque v2 change metadata. The application still owns authentication, client adaptation and safe screen refresh. Follow the SSE guide.
  • Django-native HTTP integration — use lazy template responses, class-based views, validated fragment responses, request detection middleware that attaches claimed client metadata, and standard CSRF protection.
  • Fail-closed validation — enforce canonical names, UTF-8, XML safety, configurable resource limits, and automatic XSD 1.1 validation against one corrected Hyperview 0.111.0 schema plus explicit project extensions.

dj-hyperview does not ship application screens, runtime application HXML, mobile components, Redis, or a required database app. Those choices remain under the consumer project's control.

Example application

HyperTodo is the maintained test application for dj-hyperview. It combines a Django backend with an Expo mobile client and exercises filesystem and database templates, Admin editing, fragment updates, custom HXML components, light and dark themes, English and Spanish localization, biometric sign-in, and realtime SSE refresh. Its Redis template cache is enabled only by the backend-run-redis and backend-run-device workflows, and an avatar travels as a base64 form field, not a multipart upload.

Release maturity

This documentation covers 0.1.0b3, which includes the reviewed security and reliability corrections and continues to validate against the corrected Hyperview 0.111.0 schema introduced in 0.1.0b2. The earlier 0.1.0b1 release used Hyperview 0.110.0. Entries under Unreleased in the changelog describe changes that are not part of any release yet. Read the beta compatibility policy and verified scope and deployment limits. The roadmap separates current capabilities from future work. Beta invites integration feedback; it does not guarantee production suitability.

Requirements

  • Tested Python: 3.12, 3.13, or 3.14
  • Django: 5.2 or 6.1
  • lxml: 6.1.3 or newer, below 7
  • Hyperview contract (0.1.0b3): 0.111.0

Version 0.1.0b3 requires Python 3.12 or newer without an upper bound. CI tests Python 3.12 through 3.14; newer interpreters are not yet verified.

Installation

# uv (recommended)
uv add dj-hyperview
# pip
pip install dj-hyperview

Register the base Django application:

INSTALLED_APPS = [
    # Your project applications.
    "dj_hyperview",
]

The base app performs no database, cache, or network access during startup. Database-backed templates and admin integration are optional.

Schema validation is automatic: xmlschema is a normal dependency, with no profile or enable flag. The deprecated [schema] extra remains an empty compatibility alias. Install the optional Admin authoring tools separately:

uv add "dj-hyperview[editor]"

The editor adds HXML completion, formatting, and context-free validation of unsaved source. Enable only that editor explicitly:

from django.http import HttpRequest

INSTALLED_APPS = [
    "django_ace",
    "dj_hyperview",
    "dj_hyperview.contrib.database",
]


def can_edit_hyperview(request: HttpRequest) -> bool:
    """Your project's own policy: who may change stored templates."""
    return request.user.has_perm("dj_hyperview_database.change_hyperviewtemplate")


HYPERVIEW = {
    "ADMIN": {
        "EDITOR": True,
        "PERMISSION": can_edit_hyperview,
    },
}

Stored templates execute as Django template code. Template mutations therefore default to superusers only; omit PERMISSION to keep that default. can_edit_hyperview above is your project's own function, not part of the package. ADMIN.PERMISSION may be a callable receiving the current request or a dotted path to one; it must return the literal boolean True to grant add, change, and delete access.

Quick start

Create hyperview/screens/home.xml inside the consumer project:

<?xml version="1.0" encoding="UTF-8"?>
<doc xmlns="https://hyperview.org/hyperview">
  <screen id="home">
    <body>
      <view>
        <text>Hello from Django</text>
      </view>
    </body>
  </screen>
</doc>

Configure the filesystem source in settings.py:

from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent.parent

HYPERVIEW = {
    "TEMPLATE_DIRS": [BASE_DIR / "hyperview"],
    "SOURCES": [
        {"BACKEND": "dj_hyperview.sources.FileSystemSource"},
    ],
}

Expose the screen through Django's URL configuration:

from django.urls import path

from dj_hyperview import HyperviewTemplateView

urlpatterns = [
    path(
        "hyperview/home/",
        HyperviewTemplateView.as_view(template_name="screens/home.xml"),
        name="hyperview-home",
    ),
]

A request to /hyperview/home/ returns the rendered document as application/vnd.hyperview+xml.

Configuration

All package settings live under the HYPERVIEW dictionary. Sources are queried in declaration order, and the first match wins:

HYPERVIEW = {
    "TEMPLATE_DIRS": [BASE_DIR / "hyperview"],
    "SOURCES": [
        {"BACKEND": "dj_hyperview.contrib.database.sources.DatabaseSource"},
        {"BACKEND": "dj_hyperview.sources.FileSystemSource"},
    ],
}

To publish templates through the database and Django admin, add the optional app and run migrations:

INSTALLED_APPS = [
    # Django applications used by your project.
    "django.contrib.admin",
    "dj_hyperview",
    "dj_hyperview.contrib.database",
]
python manage.py migrate

Caching remains disabled unless a non-empty HYPERVIEW["CACHE"] configuration is supplied. See the configuration and cache guides before enabling a shared backend.

Documentation

📚 Full documentation — including Installation, Quick Start, Mobile Getting Started, Configuration, Filesystem sources, Database and admin, Cache consistency, Security, HTTP responses, Changelog, and the public Python API.

The package is published at PyPI.

Development

See the contributing guide for the quality contract, supported test matrix, and release workflow.

uv sync --all-groups
uv run pytest
uv run ruff check .
uv run ruff format --check .

uv run pytest runs the base profile only. The Admin tests (tests/test_database_admin*.py) need --ds=tests.settings_database_admin and are reported as skipped otherwise. uv run python -m tools.test_matrix --django-version 6.1.1 runs both profiles and enforces the coverage gate.

License

dj-hyperview is distributed under the MIT License.

Metadata

Release files for dj-hyperview 0.1.0b3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dj-hyperview 0.1.0b3
File Size Uploaded
dj_hyperview-0.1.0b3.tar.gz 131.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dj-hyperview 0.1.0b3
File Interpreter ABI Platform
dj_hyperview-0.1.0b3-py3-none-any.whl Python 3 none any Details

Total release size: 297.4 kB

Release files / dj_hyperview-0.1.0b3.tar.gz

Download URL dj_hyperview-0.1.0b3.tar.gz
Size 131.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7073e14cc391bb527bad176fd9f018d7f95db5d78b27eae505a713034992f276
BLAKE2b-256 checksum
How to use checksums
60883b1b30e8cdfa34b5f9408c2a8a6891602b7c42ffbf11568186d0c5dd3d47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Release files / dj_hyperview-0.1.0b3-py3-none-any.whl

Download URL dj_hyperview-0.1.0b3-py3-none-any.whl
Size 166.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4258fbfd41e598ae146d7ef534d5b794b5237f2e76095c4cd50f6e89b881d95
BLAKE2b-256 checksum
How to use checksums
f8cef491bc3745d6557d3e8b1b522d3fbeb7649c2069f3da3e93668213b14439
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page