checks.urls.URLsCheck

checks.urls.URLsCheck()

Check that project URLs in metadata are reachable.

Reads the URLs from [project.urls] in pyproject.toml (or the legacy Poetry keys) and requests each http or https URL with HEAD, then GET. A URL on a local or private host is listed and not requested. A redirect is followed only to another http or https URL.

Attributes

name :

The check identifier (“urls”).

description :

Human-readable description of this check.

rules :

The codes of the findings, each with what the rule means.

hints :

The same codes, each with one sentence that says what to do.

Methods

Name Description
run Check URL reachability for project metadata URLs.

run

checks.urls.URLsCheck.run(package_path, config)

Check URL reachability for project metadata URLs.

Parameters

package_path : Path

Path to the package directory to check.

config : dict[str, Any]

Configuration dictionary for this check. Supports timeout (seconds per request, default URL_TIMEOUT), kept between URL_TIMEOUT_MIN and URL_TIMEOUT_MAX.

Returns

: CheckResult

A CheckResult with:

: CheckResult
  • OK status if all URLs are reachable
: CheckResult
  • WARNING status if a URL answers 404 or 410 or its host is unknown
: CheckResult
  • NOTE status if a URL could not be verified (HTTP 403, a server error, a timeout), or a value of the URL table is not a string
: CheckResult
  • SKIPPED status if no URL was requested. The reason is “not-applicable” when the project declares no URLs, declares them dynamically, or has none that is http or https and on a public host. It is “prerequisite-failed” when pyproject.toml is missing or unreadable, has no [project] table, or has a urls value that is not a table, which the metadata check reports. It is “network-unavailable” when no host answered.
: CheckResult

A URL on a local or private host is listed as not checked and

: CheckResult

counts as neither unreachable nor unverified.