{"id":15024445,"url":"https://github.com/runekaagaard/django-hypergen","last_synced_at":"2025-10-09T03:06:31.098Z","repository":{"id":39232768,"uuid":"331591929","full_name":"runekaagaard/django-hypergen","owner":"runekaagaard","description":"Take a break from javascript. Write server-rendered reactive HTML liveviews for Django in pure python 💫","archived":false,"fork":false,"pushed_at":"2025-09-03T10:59:02.000Z","size":3038,"stargazers_count":80,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-10-09T03:03:05.203Z","etag":null,"topics":["django","liveview","python","reactive"],"latest_commit_sha":null,"homepage":"https://hypergen.it","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/runekaagaard.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-01-21T10:25:39.000Z","updated_at":"2025-10-03T22:11:43.000Z","dependencies_parsed_at":"2024-10-14T04:40:35.865Z","dependency_job_id":"3ac5657e-52e4-448e-a33e-0e2b987a4481","html_url":"https://github.com/runekaagaard/django-hypergen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/runekaagaard/django-hypergen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runekaagaard%2Fdjango-hypergen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runekaagaard%2Fdjango-hypergen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runekaagaard%2Fdjango-hypergen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runekaagaard%2Fdjango-hypergen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/runekaagaard","download_url":"https://codeload.github.com/runekaagaard/django-hypergen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runekaagaard%2Fdjango-hypergen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000777,"owners_count":26082911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","liveview","python","reactive"],"created_at":"2024-09-24T20:00:22.086Z","updated_at":"2025-10-09T03:06:31.091Z","avatar_url":"https://github.com/runekaagaard.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. raw:: html\n\n    \u003cp align=\"center\"\u003e\n      \u003ca href=\"https://github.com/runekaagaard/django-hypergen\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/runekaagaard/django-hypergen/main/examples/website/static/website/hypergen-logo.png\" alt=\"Welcome to Django Hypergen\" width=\"75px\" height=\"100px\" /\u003e\n      \u003c/a\u003e\n    \u003c/p\u003e\n\n    \u003ch1 align=\"center\"\u003e\u003ca href=\"https://hypergen.it\"\u003eHypergen\u003c/a\u003e\u003c/h1\u003e\n\n    \u003cp align=\"center\"\u003e\n        \u003cb\u003eTake a break from javascript\u003c/b\u003e\n    \u003c/p\u003e\n    \u003cp align=\"center\"\u003e\n        Write server-rendered reactive HTML liveviews for Django in pure python 💫\n    \u003c/p\u003e\n    \u003cp align=\"center\"\u003e\n        \u003cimg src=\"https://github.com/runekaagaard/django-hypergen/actions/workflows/pytest.yml/badge.svg\" /\u003e\n        \u003ca href=\"https://pypi.org/project/django-hypergen/\"\u003e\n            \u003cimg src=\"https://badge.fury.io/py/django-hypergen.svg\" /\u003e\n        \u003c/a\u003e\n    \u003c/p\u003e\n\n    \u003cp align=\"center\" dir=\"auto\"\u003e\n        \u003ca href=\"https://hypergen.it\" rel=\"nofollow\"\u003eHomepage\u003c/a\u003e \u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\n      \u003ca href=\"https://hypergen.it/documentation/\" rel=\"nofollow\"\u003eDocumentation\u003c/a\u003e \u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\n      \u003ca href=\"https://github.com/runekaagaard/django-hypergen/issues/\" rel=\"nofollow\"\u003eSupport\u003c/a\u003e\n    \u003c/p\u003e\n\n**2025-05-19 Status:** The website is up again :)\n    \n**2025-05-17 Status:** The website is currently down, we are working on getting it back up.\n    \n**2025-05-17 Status:** Hypergen Core (this project) has reached maturity with a stable codebase. It currently serves as the production foundation for our company's healthcare platform, supporting 50,000+ unique healthcare clients annually. While the core continues to power all new feature development, it has reached a maintenance phase where updates primarily consist of targeted bug fixes and optimizations.\n    \n**Hypergen: A Hypertext Generator**:\nCraft templates using pure Python. Instead of declaring ``\u003cp\u003ehi\u003c/p\u003e`` in an HTML file, simply invoke ``p(\"hi\")`` within your view. Composing Python functions keeps templates DRY and streamlined. If you've ever written JSX, Hypergen's syntax will feel familiar.\n\n**Reactive Liveviews**:\nEffortlessly bridge frontend and backend. Connect browser events like `onclick` straight to backend actions. With these actions, Django views can instantly refresh the frontend with new HTML, send notifications, and more, all while natively working with Python data types.\n\n**Websockets**:\nHypergen brings realtime to the forefront with Django Channels. Set up is a breeze - quickly establish consumers and instantly react to live events. It's realtime made simple and friendly, just the way we like it.\n\n**Production Ready**:\nWe've deployed Hypergen in projects spanning tens of thousands of lines, serving over 100,000 unique users more than 10 million requests.\n\n**Quickstart**:\nKickstart your Hypergen journey in minutes. Execute ``pip install django-hypergen``, append ``'hypergen'`` to ``INSTALLED_APPS``, include ``'hypergen.context.context_middleware'`` in ``MIDDLEWARE``, and you're all set to dive in.\n    \nHow does it look?\n=================\n\nUsing Hypergens most high-level constructs, a simple counter looks like this:\n\n.. code-block:: python\n\n    @liveview(perm=NO_PERM_REQUIRED)\n    def counter(request):\n        with html(), body(), div(id=\"content\"):\n            template(0)\n\n    @action(perm=NO_PERM_REQUIRED, target_id=\"content\")\n    def increment(request, n):\n        template(n + 1)\n\n    def template(n):\n        label(\"Current value: \")\n        input_el = input_(id=\"n\", type_=\"number\", value=n)\n        button(\"Increment\", id=\"increment\", onclick=callback(increment, input_el))\n\n\n\nYou can `see it in action \u003chttps://hypergen.it/hellohypergen/counter/\u003e`_.\n        \nThe ``callback(func, arg1, arg2, ..., **settings)`` function connects the onclick event to the ``increment(request, n)`` action. The ``n`` argument is the value of the input field.\n\nDOM elements are nested with the ``with`` statement.\n\nIt's python all the way down. 🔥🔥🔥\n\nFeatures\n========\n\n- 🧩 **Composable** - structure your app with ... TADAAA ... python functions\n- 🌐 **Less infrastructure** - take a break from npm, npx, yarn, webpack, parcel, react, redux, gulp, angular, vue and friends\n- 🚀 **Build truly singlepage apps** - avoid abstraction gaps to a template language and javascript\n- ⏳ **Async not needed** - uses the vanilla Django Request-Response cycle by default\n- 🔀 **Automatic (de)serialization** - use python builtin types and move on\n- 🎯 **No magic strings** - reactivity is defined by referencing python functions\n- 📦 **Free partial loading** - no special setup required, includes back/forward history support\n- 🔒 **Control over client side events** - inbuilt confirmation dialogs, blocking and debouncing\n- 📤 **Easy uploading of files** - with progress bar\n- 💛 **Still loves javascript** - trivially call client functions from the server\n- ⚡ **Realtime** - Create websocket consumers trivially\n- 📜 **History buff?** - don't worry, Hypergen supports from Django 1.11, Python 3.6 and up to as of this writing Django 4.2.6 and python 3.12.\n- 🛠️ **Hyperfy** - the command line app that converts html to hypergen python code\n\nRunning the examples\n====================\n\n.. code-block:: bash\n\n    git clone git@github.com:runekaagaard/django-hypergen.git\n    cd django-hypergen/\n    virtualenv -p python3.9 venv\n    source venv/bin/activate\n    pip install -r requirements-dev.txt\n    cd examples\n    python manage.py runserver\n\nThen browse to http://127.0.0.1:8000.\n    \nContributing\n============\n\nBug reports and feature requests are `very welcome \u003chttps://github.com/runekaagaard/django-hypergen/issues/new\u003e`_. So are pull requests or diffs.\n\nAuthors\n=======\n\nHypergen is written by `Jeppe Tuxen \u003chttps://github.com/jeppetuxen\u003e`_ and `Rune Kaagaard \u003chttps://github.com/runekaagaard\u003e`_, both located around Copenhagen, Denmark.\n\nWe are using Hypergen extensively at work so it's a big focus of ours. \n\nWhy not Hypergen?\n=================\n\n- Every frontend event calls the server. Not good for e.g. games.\n- Python templating might not be for everyone. We found it works great in practice.\n\nDeveloping\n==========\n\nBackend\n-------\n\nHypergen is located in ``src/hypergen``. Format all python code with yapf, a .yapf config file is present in the repository.\n\nFrontend\n--------\n\nCompile the javascript files:\n\n.. code-block:: bash\n\n    cd src/hypergen/static/hypergen\n    npm install # use node 18 lts\n    # watch hypergen.js to dist/hypergen.js\n    npm start\n    # build hypergen.js to dist/hypergen.js\n    npm run build\n    \nProfiling\n---------\n\nHow fast are we?:\n\n.. code-block:: bash\n\n    rm -f /tmp/hypergen.profile \u0026\u0026 python -m cProfile -o /tmp/hypergen.profile manage.py runserver 127.0.0.1:8002\n    echo -e 'sort tottime\\nstats' | python3 -m pstats /tmp/hypergen.profile | less\n    \n    # or\n    pyprof2calltree -i /tmp/hypergen.profile -k\n\n    # or\n    rm -f /tmp/hypergen.profile \u0026\u0026 python -m cProfile -o /tmp/hypergen.profile manage.py inputs_profile \u0026\u0026 \\\n        echo -e 'sort tottime\\nstats' | python3 -m pstats /tmp/hypergen.profile | less\n\nTesting\n=======\n\nWe have a `Github Action \u003chttps://github.com/runekaagaard/django-hypergen/blob/main/.github/workflows/pytest.yml\u003e`_ that automatically tests a matrix of Django and Python versions. You can run the pytest tests locally like so:\n\n.. code-block:: bash\n\n    pip install -r requirements-dev.txt\n    make pytest-run\n\nAnd the testcafe end-to-end_ tests:\n\n.. code-block:: bash\n    \n    npm i -g testcafe\n    make testcafe-run\n    # or\n    make testcafe-run-headless\n\nRequires that the examples are running on ``127.0.0.1:8002``.\n\nThanks\n======\n\n- `Django \u003chttps://www.djangoproject.com/\u003e`_ - for making work fun\n- `Morphdom \u003chttps://github.com/patrick-steele-idem/morphdom\u003e`_ - for fast updating of the DOM tree\n- `Pyrsistent \u003chttps://pyrsistent.readthedocs.io/en/latest/intro.html\u003e`_ - for providing an immutable dict\n- `sockette \u003chttps://github.com/lukeed/sockette\u003e`_ - The cutest little WebSocket wrapper! 🧦\n- `Simple.css \u003chttps://simplecss.org/\u003e`_ - for the no-class styling on the homepage\n- `DALL-E mini \u003chttps://huggingface.co/spaces/dalle-mini/dalle-mini\u003e`_ - for the logo generated with the query \"a vibrant logo of the letter H\"\n\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunekaagaard%2Fdjango-hypergen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frunekaagaard%2Fdjango-hypergen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunekaagaard%2Fdjango-hypergen/lists"}