Skip to main content

A basic internal XML-generating DSL in Python 3.

Project description


Build Status Documentation Status

An internal DSL for generating XML-like markup in Python 3.7


Installation is as simple as pip install pymarkup. To develop, download the source, and run pip install -e .[dev]


A basic example:

from pymarkup import MarkupBuilder

t = MarkupBuilder()

with t:  # <html> tag
    with t.h1(id='HelloWorld'):  # Attribute access creates new element, and call adds attributes to tag
        t + 'Hello World!'  # Add child text to tag

    with t.a(href=""):
        t + t.img(src="i_am_an_image.png")  # Self-closing tags are added with +
    with t.ul:
        for x in range(2):
                t + x

repr(t) gives:

<h1 id="HelloWorld">
Hello World!
<a href=""><img src="i_am_an_image.png"/>

For more information, see the docs

Project details

Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pymarkup, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size pymarkup-0.0.1-py3-none-any.whl (4.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size pymarkup-0.0.1.tar.gz (3.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page