htesp.check_json¶
Backwards-compatible wrapper around htesp.config.
Historically every module did from check_json import config. That name is
kept so the science modules read the same as before, but the implementation is
now the searching, caching, default-merging loader in htesp.config.
- exception htesp.check_json.ConfigError[source]¶
Raised by
config()in strict mode and byrequire_api_key().
- htesp.check_json.api_key(cfg: Mapping[str, Any] | None = None) str | None[source]¶
Materials Project API key: environment, then credentials file, then config.
Returns
Nonewhen only the shipped placeholder is available, so callers can give a useful message rather than sendinguse_your_API_KEYto the MP servers.
- htesp.check_json.config(start: PathLike | str | None = None, strict: bool = False) dict[source]¶
Return the effective configuration as a plain
dict.Always returns a usable mapping: when no
config.jsonis found the packaged default is returned, so importing a module no longer depends on the working directory.strict=TrueraisesConfigErrorinstead, for commands that genuinely need the user’s own settings.
- htesp.check_json.config_path(start: PathLike | str | None = None) Path | None[source]¶
The file
config()would read, orNonefor the packaged default.
- htesp.check_json.find_config(start: PathLike | str | None = None) Path | None[source]¶
Return the first
config.jsonat or abovestart.$HTESP_CONFIGwins over the directory search, so a whole campaign can share one file without copying it into every working directory.