hmp.check()#

check(
source,
*,
base=None,
partial=True,
inputs=False,
overlays=(),
set=None,
environment=None,
)[source]#

Check a configuration, a draft or a file, and return every diagnostic it holds.

A mapping is checked as it stands, as a form being filled would be, against the base its relative paths are read from: a mapping without one is refused, as load() refuses it. A path is read as hmp run reads it: the base_config chain, the project root, the name of the workflow. A [sites] project is expanded case by case, and each issue comes back at the key it reaches. A calibration with nothing to fix and nothing to fill is also read by its preflight.

Parameters:
  • source (str | PathLike[str] | Mapping[str, Any]) – A path to a TOML file, or the document as a mapping of sections.

  • base (str | PathLike[str] | None) – The folder relative paths are read from. A mapping needs it.

  • partial (bool) – True reports a required key not written yet as to_fill, which stops nothing. False reports it as an error, what hmp run refuses.

  • inputs (bool) – True also reads the header of each input file the document names, and downloads nothing.

  • overlays (Sequence[str | PathLike[str]]) – TOML files merged over a file, then dotted paths and their values, as hmp run --overlay and --set. A mapping refuses both.

  • set (Mapping[str, Any] | None) – TOML files merged over a file, then dotted paths and their values, as hmp run --overlay and --set. A mapping refuses both.

  • environment (Environment | None) – The bounds an input header may be read within. The default is the bounds of a bare Environment.

Returns:

list of Diagnostic – Empty when the document loads and every rule passes. A diagnostic of a file carries line_number.

Raises:

TypeError – When source is neither a mapping nor a path.

Return type:

list[Diagnostic]

Keyword arguments and command-line flags#

The twin command is hmp check.

KeywordDefaultCommand-line flagAccepted by
baseNoneno flagevery form
partialTrue--partialevery form
inputsFalse--inputsevery form
overlays()no flagevery form
setNoneno flagevery form
environmentNoneno flagevery form

Flags of hmp check with no keyword: --lang. To get their effect from Python, build the configuration object with the values you want, or write them in the TOML file.