branca
Generate complex HTML+JS pages with Python
What it is and what it does
Branca is a Python library for programmatically generating HTML and JavaScript pages. It wraps Jinja2 templating to let you build complex web content as Python objects rather than writing raw markup. Originally developed as part of the folium project, it now stands alone as a general-purpose tool for anyone who needs to create dynamic web pages from Python code.
The library is designed for data visualization and web content generation workflows where you want to avoid hand-coding HTML and JavaScript. It supports modern Python versions (3.8–3.12) and has no heavy compiled dependencies, making it straightforward to install and use in any Python environment.
Use it for:
- Generate interactive web dashboards and visualizations from Python data analysis code
- Create HTML reports programmatically with dynamic content and styling
- Build custom map or chart visualizations that need both HTML structure and JavaScript interactivity
- Template-based web content generation for data science notebooks and Jupyter environments
- Embed interactive elements into static documentation or data export workflows
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Branca generates HTML and JavaScript pages from Python code using Jinja2 templating, enabling programmatic creation of complex web content without writing raw HTML or JS.
Yes. Branca is a stable, actively maintained library with low install friction, permissive licensing, and no known vulnerabilities. Install it if you need to generate HTML and JavaScript from Python code without writing raw markup—particularly useful for data visualization and report generation workflows.
Install
branca on PyPI
pip
pip install brancauv
uv add brancapoetry
poetry add brancaInstalling branca
Before you install
Low friction install with a single pure-Python dependency (jinja2). Active maintenance with recent commits and stable production status across Python 3.8–3.12.
License in practice
MIT license is permissive; you can use, modify, and distribute branca with minimal restrictions, including in commercial projects.
Quickstart
pip install branca
from branca.element import Figure, Html
fig = Figure()
fig.add_child(Html('<h1>Hello World</h1>'))
fig.render()
Verify before relying
- Whether branca's HTML/JS output is suitable for modern browser security policies (CSP, etc.)
- Performance characteristics when generating very large or deeply nested HTML structures
- Extent of interactive component support beyond basic templating
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — jinja2 |
| Maintenance | actively maintained — 312 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,649,338/month — #2,543 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: branca-0.8.2-py3-none-any.whl
Keywords: data, visualization
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
foliumfolium builds interactive web maps by combining…
permissive · top 5,000 on PyPI
html5taggerGenerates HTML5 markup programmatically using…
permissive · top 5,000 on PyPI
htmlBuilderRender HTML by writing Python code, using…
permissive · top 15,000 on PyPI
vsdxvsdx reads, modifies, and creates Microsoft…
permissive · top 15,000 on PyPI
htbuilderhtbuilder lets you construct HTML strings using…
permissive · top 15,000 on PyPI
jinja2-fragmentsRenders individual Jinja2 template blocks as…
permissive · top 15,000 on PyPI
dominateDominate is a Python library for writing HTML…
copyleft · top 5,000 on PyPI
mjmlConverts MJML (a markup language for responsive…
permissive · top 15,000 on PyPI
aiohttp-jinja2Integrates Jinja2 template rendering into…
permissive · top 5,000 on PyPI