skillfed

branca

Generate complex HTML+JS pages with Python

branca v0.8.2 3.6M downloads/30d#2,543 on PyPI134
Permissive license MIT Active released

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 branca

uv

uv add branca

poetry

poetry add branca

Installing 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

Development Status :: 5 - Production/StableLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

html generation from pythonjinja2 template renderingdynamic html js pagespython web content generationinteractive web page builderhtml templating libraryweb visualization framework
html-generationtemplatingdata-visualization

More Dynamic Content packages