Skip to main content

XML Schema (XSD 1.0/1.1) validation CLI.

Project description

Mug

  • ⚠️ This project is in early development (pre-release/alpha).
  • APIs and behavior will change rapidly as features are added.
  • Pre-1.0.0 Policy: Anything goes before v1.0.0.
  • Stability guarantees begin only at v1.0.0.

XML Schema Validator (XSD 1.0 / 1.1)

Mug validates XML instance documents against an XSD schema, with full support for XSD 1.1 (including xs:assert and XPath 2.0 functions) via the xmlschema library.


Installation

From PyPI

pip install mug

From Source

git clone https://github.com/bynbb/mug.git
cd mug
pip install -e .

Note: Console commands (like mug) are available only after install.
If you prefer not to install, you can run via module from the repo root:
PYTHONPATH=src python -m mug <xml> <xsd>


Usage

After installation (either via PyPI or from source), run:

mug <xml-file> <xsd-file> [options]
# or
python -m mug <xml-file> <xsd-file> [options]

Example:

mug requirements/2025/08/20/req_20250820T142442+0000.xml requirements-v1.xsd

On success, it prints:

OK

Options

Option Description
--xsd-version {1.0,1.1} Selects the XSD version. Default is 1.1.
--fail-fast Stop at the first validation error.
--quiet Suppress the OK message when validation passes.
-h, --help Show usage help.

Exit Codes

  • 0 → Validation successful

  • 1 → Validation failed (errors found)

  • 2 → Input read error or missing dependency

  • 3 → Schema read/parse error


Output Format

Errors are printed in a familiar style:

file:line:column: LEVEL: message

Development

git clone https://github.com/bynbb/mug.git
cd mug
pip install -e .

# verify CLI is available
mug --help

# sample validation
mug requirements-spec-example.xml requirements-v1.xsd

Notes

  • XSD 1.1 features (e.g., xs:assert) require --xsd-version 1.1 (this is the default).

  • If you see ERROR: The 'xmlschema' package is required, install it with pip install xmlschema.


Project details


Download files

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

Source Distribution

mug-0.3.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mug-0.3.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file mug-0.3.0.tar.gz.

File metadata

  • Download URL: mug-0.3.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for mug-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d6fa93d510a1c71c1a4336d48e7c587fb6adb035b0660b1237a6ea89079431a2
MD5 3d775bfb012abd71e2408c0d38dbd200
BLAKE2b-256 bab08c71aad817ece36766cb7d4958ad511dd3ebcf8808af2fc417d062af7a0b

See more details on using hashes here.

File details

Details for the file mug-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: mug-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for mug-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b545975af5c14243027386d52bb10a236ffe034c689ead47a960ee7613307621
MD5 e72018c60dd09e10ed7ad5e908c0d23a
BLAKE2b-256 c46d6ba011dc2fa5e2b0d7a75218ce6e8abbd3d478e3ec20441c4c544699d1f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page