Skip to content

Update Hatch! to be compliant with Hatch-Validator#19 #53

@LittleCoinCoin

Description

@LittleCoinCoin

Context

CrackingShells/Hatch-Validator#19 adds v2.0.0 schema support to the library: a new v2_0_0/ validator module, a corrected version-dispatch key (hatch_schema_version), and a fixed "latest" fallback. Once that PR merges, Hatch CLI still needs to be updated to actually reach the new chain. This issue covers the Hatch side.

Prerequisite: CrackingShells/Hatch-Validator#19 merged and published.


Problem

Three independent wiring problems in Hatch CLI prevent v2.0.0 validation from working even after Hatch-Validator is fixed:

  1. Dependency pin is too loose: pyproject.toml declares hatch-validator>=0.8.0. This must be tightened to require the version that ships Hatch-Validator#19's changes so old installs cannot silently use a pre-v2.0.0 build.

  2. Two divergent import paths for HatchPackageValidator:

    • hatch/cli/cli_system.py:35from hatch_validator import HatchPackageValidator
    • hatch/installers/hatch_installer.py:20from hatch_validator.package_validator import HatchPackageValidator
      Both work today but the inconsistency should be resolved; the public __init__ export is the correct import.
  3. HatchInstaller creates its own HatchPackageValidator without a version argument (hatch/installers/hatch_installer.py:39):

    self.validator = HatchPackageValidator(registry_data=registry_data)

    This falls through to the "latest" fallback. After Hatch-Validator#19, "latest" resolves correctly to "2.0.0" only if the upstream fallback fix is in place — but this call site is silent about version intent and must be verified explicitly.


Tasks

  • Bump dependency pin in pyproject.toml: change hatch-validator>=0.8.0 to hatch-validator>=<version-that-ships-Hatch-Validator#19> once that release tag is known.

  • Unify import style: change hatch/installers/hatch_installer.py:20 to use the public export (from hatch_validator import HatchPackageValidator) to match cli_system.py.

  • Verify dispatch in handle_validate() (cli_system.py:105-109): the call is HatchPackageValidator(version="latest", ...). After Hatch-Validator#19, "latest" should resolve to "2.0.0". Confirm by checking that validation of a v2.0.0 hatch_metadata.json no longer raises ValueError: Unsupported schema version and no longer silently falls through to the v1.1.0 chain.

  • Verify HatchInstaller path (hatch_installer.py:39): run a dry-run install of a v2.0.0 package and confirm no version dispatch errors.


Success Gate

hatch validate <path-to-v2.0.0-package-dir>
  • Exits 0 on a well-formed v2.0.0 hatch_metadata.json (with hatch_schema_version, citations[], provenance{}).
  • Exits 1 with a field-named error (e.g., citations[0].value: does not match DOI pattern) on a deliberately broken field.
  • No ValueError: Unsupported schema version anywhere in output or logs.

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions