Registry / web-framework / markuppy

markuppy

JSON →
library1.18pypypi✓ verified 22d ago

MarkupPy is a Python module designed to simplify the generation of HTML/XML from Python code in an intuitive, lightweight, and Pythonic manner. It supports both Python 2 and 3 environments, offering a straightforward approach to creating markup. The library maintains an active status with intermittent releases, with version 1.18 being published in March 2025.

pip install MarkupPy
INSTALL
IMPORT
SIG · MARKUPPY
M
markuppy
web-frameworkpythonv1.18
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.18 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

markup
from MarkupPy import markup
import markuppy.markup
The primary class to interact with is 'markup.page()', which resides within the 'MarkupPy' package, not a direct 'markuppy' module.

This example demonstrates how to initialize an HTML page, add a title, paragraphs, and a link. Elements are added as method calls on the page object. Closing tags are explicitly called for block elements like 'p'.

from MarkupPy import markup # Create an HTML page page = markup.page() page.init(title="My Title", lang="en") page.h1("Welcome!") page.p("Hello, World!") page.p.close() page.a("Visit GitHub", href="https://github.com/tylerbakke/MarkupPy") print(page)
Debug
Known issues
gotchaMarkupPy is a lightweight generator and not intended as a full-blown web framework, templating engine, or XML parser. For robust production environments or complex needs, alternatives like ElementTree are suggested.
fix
Align usage with the library's intended lightweight purpose; consider other tools for complex production scenarios.
affects: All versions
gotchaWhen adding content to `<pre>` tags, versions prior to 1.17 might insert extra newlines between additions. Use the `add_raw()` method (available from v1.17+) to preserve exact formatting without unwanted newlines.
fix
Upgrade to MarkupPy 1.17+ and use `page.add_raw('your raw content\n')` for pre-formatted text.
affects: < 1.17
gotchaDirect embedding of inline CSS and JavaScript content via the `init()` method's `style_content` and `script_content` arguments is only supported in version 1.16 and newer.
fix
For older versions, manual methods (e.g., adding `<style>` or `<script>` tags directly with `page.add()` or similar) would be required, or upgrade to 1.16+.
affects: < 1.16
gotchaDue to the existence of the `page.add()` method for inserting raw text, 'add' cannot be used as an HTML/XML element name (e.g., `page.add(...)` for creating an `<add>` tag) as it would clash with the method.
fix
Avoid using 'add' as a custom element name; choose a different, non-conflicting name.
affects: All versions
gotchaWhile MarkupPy states compatibility with Python 2 and 3, Python 2 has reached End-of-Life. It is strongly recommended to use MarkupPy with Python 3 for modern development and security.
fix
Migrate your project to Python 3. MarkupPy's functionality is fully supported in Python 3.
affects: All versions (in context of Python 2 usage)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'MarkupPy'
The 'MarkupPy' package is not installed in the current Python environment or the Python interpreter cannot find it.
fix
Ensure MarkupPy is installed using pip: `pip install MarkupPy`.
pkg_resources.DistributionNotFound: The 'markuppy' distribution was not found
This error occurs when a dependency (often another library) tries to import or access 'markuppy' but it's not properly installed or discoverable within the current package distribution system, even if `pip install MarkupPy` was run. This is common in complex environments like virtual machines, Docker containers, or when using package managers like `poetry` or `conda` that manage dependencies strictly.
fix
Verify `markuppy` is listed in your project's dependencies (e.g., `requirements.txt`, `pyproject.toml`). If using `pip`, ensure your virtual environment is activated and run `pip install MarkupPy`. If using `poetry`, run `poetry add MarkupPy` and then `poetry install`. If used as a transitive dependency, ensure all primary dependencies are correctly installed.
ERROR: Failed building wheel for markuppy
This installation error typically indicates that the `wheel` package, which is necessary for building Python packages from source, is missing in your Python environment.
fix
Install the `wheel` package before installing `markuppy`: `pip install wheel markuppy`.
AttributeError: module 'markuppy' has no attribute 'page'
Users often encounter this error when attempting to instantiate the `page` class directly from the top-level `markuppy` module after using `import markuppy`. The `page` class is not directly exposed under `markuppy` but is part of the `markup` submodule.
fix
Import the `markup` submodule explicitly and then use its `page` class: `from MarkupPy import markup` followed by `page = markup.page()`.
Upgrade
Version history
1.18latest on PyPI · released Mar 19, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
2
Amazon
1
Resources
markuppy — pip install markuppy · libregistry