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.1.tar.gz (56.4 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.1-py3-none-any.whl (55.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: djule-1.0.1.tar.gz
  • Upload date:
  • Size: 56.4 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.1.tar.gz
Algorithm Hash digest
SHA256 e42cb1a2c2411994eef0a003adb646d017a44bc71a6ccce814cdce8fd767ef0b
MD5 9370213739ccd77fe616146966e0a993
BLAKE2b-256 35e9ecb001f0eeb4f7abfc3a24417d24f2886fbf6af5644bef77f054dce24d0c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: djule-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 55.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aa8b900620bbc29d6baf55453084fbcc2aff449be50397d7d6b4170db0c67079
MD5 1aac3c9e16184dfcc8d512d23f60fc96
BLAKE2b-256 6ad89e8bea4a2ba36c62e2c294565abf5ecaf014827b7cbb8c84e5c61db334c3

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