Re-add 3 retries in uv publish (#12041)

In the publish client, we have to set the client retries to 0 as the
retry middleware is incompatible with upload bodies. This however also
sets `client.retry_policy()` to a zero-retry policy, so we need to
construct our own policy.

Fixes #12027

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
konsti 2025-03-10 12:38:08 +01:00 committed by GitHub
parent ba74b9ea93
commit aa629c4a54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 10 deletions

View file

@ -181,12 +181,18 @@ def get_latest_version(project_name: str, client: httpx.Client) -> Version:
break
except httpx.HTTPError as err:
error = err
print(f"Error getting version, sleeping for 1s: {err}", file=sys.stderr)
print(
f"Error getting version for {project_name}, sleeping for 1s: {err}",
file=sys.stderr,
)
time.sleep(1)
except InvalidSdistFilename as err:
# Sometimes there's a link that says "status page"
error = err
print(f"Invalid index page, sleeping for 1s: {err}", file=sys.stderr)
print(
f"Invalid index page for {project_name}, sleeping for 1s: {err}",
file=sys.stderr,
)
time.sleep(1)
else:
raise RuntimeError(f"Failed to fetch {url}") from error