Skip to main content

Python-first server-rendered templating runtime

Project description

Djule

Djule is a Python-first templating/runtime for server-rendered UI.

It currently includes:

  • a lexer and parser for .djule files
  • a renderer with import resolution and render-plan caching
  • a VS Code extension for syntax, diagnostics, and completions
  • an optional Django integration layer

Djule is licensed under Apache License 2.0.

Installation

Install the package locally:

python3 -m pip install .

Install from PyPI:

python3 -m pip install djule

Install with Django helpers:

python3 -m pip install '.[django]'

For local development:

python3 -m pip install -e '.[dev]'

Local Development

Install the editable dev environment:

make install-dev

Run the Python test suite:

make test

Run the parser CLI:

python3 -m djule.parser check-json tests/fixtures/01_simple_page.djule
python3 -m djule.parser render tests/fixtures/01_simple_page.djule --props '{"title":"Hello Djule"}'
djule render tests/fixtures/01_simple_page.djule --props '{"title":"Hello Djule"}'

Useful maintenance commands:

make check
make build
make clean
make clean-cache

Django Integration

Djule ships a small Django-facing API in src/djule/integrations/django.py.

Example:

from djule.integrations.django import render_djule_response


def dashboard_view(request):
    return render_djule_response(
        request,
        "examples/08_django_request_props.djule",
        props={
            "user": request.user,
            "notifications": [],
            "team": {"name": "Core"},
        },
    )

Set DJULE_IMPORT_ROOTS in Django settings if you want explicit import roots. Otherwise Djule falls back to BASE_DIR.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djule-1.0.0.tar.gz (56.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

djule-1.0.0-py3-none-any.whl (55.5 kB view details)

Uploaded Python 3

File details

Details for the file djule-1.0.0.tar.gz.

File metadata

  • Download URL: djule-1.0.0.tar.gz
  • Upload date:
  • Size: 56.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for djule-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d62a73a334c379458d7b3c59b9ee1c56b0f89963676ad9463ba8448c1e6e4157
MD5 597f94b6acb4ccf87305532b32886919
BLAKE2b-256 f48268b3e1c47d813af01b1f2b6ca834032197025cce8e0287eced95862a8bd1

See more details on using hashes here.

File details

Details for the file djule-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: djule-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 55.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for djule-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b74b65c344b366cdf6e3e426f67212fabefeaae380ee7957693e60a10a7570d3
MD5 267293daa70e5aeaf27ab9e2ebf1f5c8
BLAKE2b-256 00b3ab64b81abe7486beb7c806651072de7fec15b146af132e41601c86f57081

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page