[v0.9.1] Validator decoupled from hatch_metadata.json file I/O#21
Merged
LittleCoinCoin merged 2 commits intomainfrom Apr 15, 2026
Merged
[v0.9.1] Validator decoupled from hatch_metadata.json file I/O#21LittleCoinCoin merged 2 commits intomainfrom
hatch_metadata.json file I/O#21LittleCoinCoin merged 2 commits intomainfrom
Conversation
Hatch CLI is migrating from hatch_metadata.json to server.json as the package descriptor. Once that file is gone, every validate_package call fails with "file not found". Adding an optional metadata kwarg lets callers pass a pre-extracted flat dict and skip file I/O — the legacy path is preserved for existing callers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Patch release introducing an optional
metadatakeyword argument tovalidate_package(). Allows callers to supply a pre-extracted flat dict andbypass disk I/O entirely — the groundwork required for Hatch CLI's upcoming
migration from
hatch_metadata.jsontoserver.jsonas the packagedescriptor.
Bug Fixes
validate_package()hardcoded dependency onhatch_metadata.jsonRoot cause:
validate_package()unconditionally loadshatch_metadata.jsonfrom
package_dir. Once Hatch CLI migrates toserver.json, that file nolonger exists and every call fails with
"hatch_metadata.json not found"—with no way for the caller to supply already-extracted metadata.
Solution: Added
metadata: Optional[Dict[str, Any]] = Nonebetweenpackage_dirandpending_updatein the signature ofHatchPackageValidator.validate_package():When
metadatais supplied, the file-loading block is skipped entirely. Whenabsent (the default), the existing
hatch_metadata.jsonpath runs unchanged —all current callers are backward compatible with no modifications required.
New caller pattern (Hatch CLI after
server.jsonmigration):Backward compat — existing callers unchanged: