mpylab.tools.config_check module

Static validation of versioned mpylab configuration packages.

class mpylab.tools.config_check.ConfigCheckReport(manifest: str, diagnostics: tuple[ConfigDiagnostic, ...])

Bases: object

Result of checking one configuration-package manifest.

Parameters:
  • manifest (str) – Checked manifest filename.

  • diagnostics (tuple of ConfigDiagnostic) – Findings sorted by source location.

as_dict()

Return a JSON-serializable report.

Returns:

Manifest, diagnostics, and summary counts.

Return type:

dict

diagnostics: tuple[ConfigDiagnostic, ...]
property errors

Return all error findings.

Returns:

Findings whose severity is "error".

Return type:

tuple of ConfigDiagnostic

manifest: str
property warnings

Return all warning findings.

Returns:

Findings whose severity is "warning".

Return type:

tuple of ConfigDiagnostic

class mpylab.tools.config_check.ConfigDiagnostic(severity: str, code: str, source: str, line: int, column: int, message: str)

Bases: object

One source-located configuration validation finding.

Parameters:
  • severity ({"error", "warning"}) – Finding severity.

  • code (str) – Stable machine-readable identifier.

  • source (str) – Source filename.

  • line (int) – One-based line number.

  • column (int) – One-based column number.

  • message (str) – Human-readable explanation.

code: str
column: int
format()

Return a compiler-style single-line representation.

Returns:

source:line:column: severity[code]: message.

Return type:

str

line: int
message: str
severity: str
source: str
mpylab.tools.config_check.check_config_package(manifest)

Validate a configuration package described by a TOML manifest.

Parameters:

manifest (path-like) – Versioned package manifest.

Returns:

Source-located syntax, reference, data, and graph-path findings.

Return type:

ConfigCheckReport

mpylab.tools.config_check.main(argv=None)

Run the static configuration-package checker.

Parameters:

argv (sequence of str or None, optional) – Command-line arguments. None uses sys.argv.

Returns:

Zero on success, one for findings promoted to failure, or two when errors are present.

Return type:

int