Skip to main content

PyMarkup

Build Status Documentation Status

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

Installation

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

Usage

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="github.com"):
        t + t.img(src="i_am_an_image.png")  # Self-closing tags are added with +
    with t.ul:
        for x in range(2):
            with t.li:
                t + x

repr(t) gives:

<html>
<h1 id="HelloWorld">
Hello World!
</h1>
<a href="github.com"><img src="i_am_an_image.png"/>
</a>
<ul>
<li>
0
</li>
<li>
1
</li>
</html>

For more information, see the docs

Metadata

Release files for pymarkup 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymarkup 0.0.1
File Size Uploaded
pymarkup-0.0.1.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymarkup 0.0.1
File Interpreter ABI Platform
pymarkup-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.7 kB

Release files / pymarkup-0.0.1.tar.gz

Download URL pymarkup-0.0.1.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e26ead0ad2edd7a720aa741872a5ea1bc59696743e68232b968dcaa3e14609c8
BLAKE2b-256 checksum
How to use checksums
09d917b475b9108fb86c13104bf487d8921bed90857909434e1896d7669750bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

Release files / pymarkup-0.0.1-py3-none-any.whl

Download URL pymarkup-0.0.1-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6bfd2c083b4b5b6adc2b9a8368819444f2dcb24752bb5f3867a0ccd354e7c22f
BLAKE2b-256 checksum
How to use checksums
0ea89b105e0b1ad040c8326024287cc39dea27a7a1719ab016a767b868820aae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page