py2html is a Python library that lets you build full HTML pages entirely in Python code. Instead of writing markup or template strings, you create aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nishad12323/py2html/llms.txt
Use this file to discover all available pages before exploring further.
Parent object and call methods like Button(), Frame(), Heading(), and Link() to compose your document — then call getHTML() to render it.
Installation
Set up py2html in your project using the installer script.
Quickstart
Build your first HTML page in under five minutes.
Core Concepts
Understand how the Parent class and element model work.
API Reference
Full reference for every method on the Parent class.
Why py2html?
Writing HTML by hand means wrestling with closing tags, escaping user input, and keeping markup in sync with your Python logic. py2html keeps everything in one place — your Python file — so you can build pages with loops, conditionals, and variables just like any other Python code.Widget-Style API
Call methods like
Button(), Frame(), and Heading() — no template syntax to learn.Inline Text Markup
Use shorthand like
[* bold *], [_ italic _], and [xl large xl] inside text content.Flexbox Layouts
The
Frame() method maps directly to CSS flexbox and block layouts with full positioning support.Auto-Escaping
All user-supplied text is HTML-escaped by default so you don’t accidentally inject markup.
How it works
py2html is not on PyPI. Use the installer script to set it up in your project.