mdurl is a Python port of the JavaScript mdurl package, providing utilities for parsing, encoding, and decoding URLs in Markdown. The latest version is 0.1.2, released on August 14, 2022. The project has a stable release history with no recent updates.
Install & Compatibility
Where this runs
tested against v0.1.2 · 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
muslpy 3.10–3.925 runs
installs and imports cleanly · install 0.0s · import 0.029s · 17.8MB
glibcpy 3.10–3.925 runs
installs and imports cleanly · install 1.5s · import 0.023s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
encode
✓ from mdurl import encode
✗ import mdurl.encode
Incorrect import path; use direct import from mdurl.
decode
✓ from mdurl import decode
✗ import mdurl.decode
Incorrect import path; use direct import from mdurl.
parse
✓ from mdurl import parse
✗ import mdurl.parse
Incorrect import path; use direct import from mdurl.
format
✓ from mdurl import format
✗ import mdurl.format
Incorrect import path; use direct import from mdurl.
Demonstrates encoding, decoding, parsing, and formatting URLs using mdurl.
from mdurl import encode, decode, parse, format
# Encode a URL
encoded_url = encode('https://example.com/path?query=param')
print(f'Encoded URL: {encoded_url}')
# Decode a URL
decoded_url = decode(encoded_url)
print(f'Decoded URL: {decoded_url}')
# Parse a URL
parsed_url = parse('https://example.com/path?query=param')
print(f'Parsed URL: {parsed_url}')
# Format a parsed URL
formatted_url = format(parsed_url)
print(f'Formatted URL: {formatted_url}')
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'mdurl'
The 'mdurl' package is not installed in the Python environment where the code is being run.
fixInstall the package using pip: `pip install mdurl`
AttributeError: module 'mdurl' has no attribute 'quote'
The user is attempting to call a function that does not exist in the `mdurl` library, possibly confusing its API with other URL parsing libraries like `urllib.parse` or the original JavaScript `mdurl`.
fixRefer to the `mdurl` documentation. The primary encoding function is `mdurl.encode()` and the decoding function is `mdurl.decode()`.
TypeError: argument 's' must be str, not int
The `mdurl.encode()` or `mdurl.decode()` function received an argument that is not a string, but an integer (or another non-string type) instead.
fixEnsure that the input provided to `mdurl.encode()` or `mdurl.decode()` is a string.
ValueError: Malformed URL scheme
While `mdurl.parse()` is designed to be lenient, if the input URL string is severely malformed, particularly regarding its scheme or structure (e.g., `https:/example.com` instead of `https://example.com`), it can lead to unexpected parsing results or a `ValueError` if subsequent operations on the parsed object assume a valid structure.
fixValidate and ensure that the URL string passed to `mdurl.parse()` or other functions has a reasonably well-formed structure, including the correct scheme (e.g., `http://`, `https://`).
Audit
Dependencies
No dependency data recorded yet.