mth5.utils.mth5_validator_standalone

Lightweight validator for MTH5 files that doesn’t require the full mth5 package. Only depends on h5py and standard library.

This standalone version is ideal for: - Building small executables (~20-30 MB vs 150+ MB) - Validation without installing full mth5 environment - Quick file checks in production environments

Usage:

python mth5_validator_standalone.py validate file.mth5 python mth5_validator_standalone.py validate file.mth5 –verbose python mth5_validator_standalone.py validate file.mth5 –json

Author: MTH5 Development Team Date: February 9, 2026

Attributes

ACCEPTABLE_FILE_VERSIONS

ACCEPTABLE_FILE_TYPES

ACCEPTABLE_DATA_LEVELS

Classes

ValidationLevel

Validation severity levels.

ValidationMessage

Container for a single validation message.

ValidationResults

Container for validation results.

MTH5Validator

Standalone MTH5 file validator.

Functions

main()

CLI entry point.

Module Contents

mth5.utils.mth5_validator_standalone.ACCEPTABLE_FILE_VERSIONS = ['0.1.0', '0.2.0'][source]
mth5.utils.mth5_validator_standalone.ACCEPTABLE_FILE_TYPES = ['MTH5'][source]
mth5.utils.mth5_validator_standalone.ACCEPTABLE_DATA_LEVELS = [0, 1, 2, 3][source]
class mth5.utils.mth5_validator_standalone.ValidationLevel[source]

Bases: enum.Enum

Validation severity levels.

ERROR = 'ERROR'[source]
WARNING = 'WARNING'[source]
INFO = 'INFO'[source]
class mth5.utils.mth5_validator_standalone.ValidationMessage[source]

Container for a single validation message.

level: ValidationLevel[source]
category: str[source]
message: str[source]
path: str | None = None[source]
details: dict[str, Any][source]
class mth5.utils.mth5_validator_standalone.ValidationResults[source]

Container for validation results.

file_path: pathlib.Path[source]
messages: list[ValidationMessage] = [][source]
checked_items: dict[str, bool][source]
property is_valid: bool[source]

Check if file passed validation (no errors).

property error_count: int[source]

Count of error messages.

property warning_count: int[source]

Count of warning messages.

property info_count: int[source]

Count of info messages.

add_error(category: str, message: str, path: str | None = None, **details) None[source]

Add an error message.

add_warning(category: str, message: str, path: str | None = None, **details) None[source]

Add a warning message.

add_info(category: str, message: str, path: str | None = None, **details) None[source]

Add an info message.

print_report(include_info: bool = False) None[source]

Print a formatted validation report.

to_dict() dict[source]

Convert results to dictionary.

to_json(**kwargs) str[source]

Convert results to JSON string.

class mth5.utils.mth5_validator_standalone.MTH5Validator(file_path: str | pathlib.Path, verbose: bool = False, check_data: bool = False)[source]

Standalone MTH5 file validator.

Validates MTH5 file structure without requiring full mth5 package. Only depends on h5py and standard library.

file_path[source]
verbose = False[source]
check_data = False[source]
results[source]
h5_file = None[source]
validate() ValidationResults[source]

Run full validation suite.

mth5.utils.mth5_validator_standalone.main()[source]

CLI entry point.