--- id: htmlbuilder version: "1.0.0" license: MIT license_treatment: permissive maintenance: dormant --- # htmlBuilder — A beautiful html builder library. License: permissive · Maintenance: dormant · Downloads: 91.7K/mo ## What it is and what it does htmlBuilder lets you construct HTML documents by writing Python code instead of templates or markup strings. Each HTML tag is a Python class that accepts child elements and attributes as constructor arguments, and you call render() to produce the final HTML string. This approach lets you use Python's full feature set—loops, comprehensions, conditionals, functions—directly in your HTML generation logic, without learning a separate template syntax. The library is designed around three core ideas: minimal learning curve (you need only Python and HTML knowledge), real Python code (the generation logic reads like normal Python), and testability (you can inspect and unit-test the tag object structure before rendering). It has no runtime dependencies, supports Python 3.6 and later, and carries an MIT license. Use it for: - Generate dynamic HTML pages from Python data structures (e.g., rendering user lists or product catalogs). - Build HTML in unit tests without external template files or string concatenation. - Create reusable HTML components as Python functions that return tag objects. - Programmatically construct email templates or reports where Python logic drives the structure. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Render HTML by writing Python code, using classes to represent tags and leveraging Python's syntax and object-oriented features instead of template languages. Yes, if you prefer writing Python code over learning a template language and don't need active maintenance. The library is stable, has no dependencies, and carries a permissive license. However, note that the last release was in 2021; if you encounter bugs or need new features, community support may be limited. It is suitable for projects where HTML generation is straightforward and you value code clarity over template-engine maturity. ## Install pip install htmlbuilder uv add htmlbuilder poetry add htmlbuilder ## Installing htmlBuilder Before you install: Low install friction with no runtime dependencies. Maintenance is dormant—last release was 2021-03-02, over 1991 days ago, though the repository remains active and unarchived. License in practice: MIT license permits commercial and private use with minimal restrictions; you must include a copy of the license and copyright notice. Quickstart: pip install htmlbuilder from htmlBuilder.tags import Html, Head, Title, Body, Div from htmlBuilder.attributes import Class html = Html([], Head([], Title([], "My Page")), Body([Class('main')], Div([], "Hello"))) print(html.render(pretty=True)) Verify before relying: - Whether the package handles modern HTML5 features and attributes beyond the examples shown. - Performance characteristics when rendering large or deeply nested HTML structures. - Whether attribute escaping and XSS prevention are built in or require manual handling. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 91.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags python html generation, programmatic html rendering, html builder library, python to html, html templating without templates, html-generation, code-as-markup [View on SkillFed](https://skillfed.io/packages/htmlbuilder) · [View on PyPI](https://pypi.org/project/htmlbuilder/)