MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / is_docker_image_public

Function is_docker_image_public

misc/python/materialize/mzbuild.py:451–468  ·  view source on GitHub ↗

Whether the Docker Hub repository for `name` is public (tri-state). Reads repository metadata (`is_private`) via the Hub API rather than the registry, which both avoids the registry's anonymous pull-rate limit (see `mz_image_tag_exists`) and is tag-independent. A 404 means the repo is

(name: str)

Source from the content-addressed store, hash-verified

449
450
451def is_docker_image_public(name: str) -> bool | None:
452 """Whether the Docker Hub repository for `name` is public (tri-state).
453
454 Reads repository metadata (`is_private`) via the Hub API rather than the
455 registry, which both avoids the registry's anonymous pull-rate limit (see
456 `mz_image_tag_exists`) and is tag-independent. A 404 means the repo is
457 private or absent; transient errors yield None rather than a false "private".
458 """
459 repo = name.rsplit(":", 1)[0]
460 response = _get_with_retries(f"https://hub.docker.com/v2/repositories/{repo}/")
461 if response is None:
462 return None
463 if response.status_code == 404:
464 return False
465 if response.status_code != 200:
466 return None
467 body = _json_dict_or_none(response)
468 return None if body is None else not body.get("is_private", True)
469
470
471def is_ghcr_image_public(name: str) -> bool | None:

Callers 1

is_publicMethod · 0.85

Calls 3

_get_with_retriesFunction · 0.85
_json_dict_or_noneFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected