Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-add 3 retries in uv publish #12041

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

konstin
Copy link
Member

@konstin konstin commented Mar 7, 2025

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

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
@konstin konstin added the bug Something isn't working label Mar 7, 2025
@konstin konstin requested review from charliermarsh and zanieb March 7, 2025 12:56
@konstin konstin temporarily deployed to uv-test-publish March 7, 2025 12:58 — with GitHub Actions Inactive
@charliermarsh
Copy link
Member

Can you add a test plan that we can use to reproduce and test in the future?

@charliermarsh
Copy link
Member

Even if it’s not an automated test, it’d be great to be able to look back here and know how to test this.

@konstin
Copy link
Member Author

konstin commented Mar 7, 2025

I've used this script:

# /// script
# requires-python = ">=3.12"
# dependencies = [
#     "flask>=3.1.0,<4",
# ]
# ///

from argparse import ArgumentParser
from flask import Flask, app

app = Flask(__name__)


@app.route("/", defaults={"path": ""}, methods=["GET", "POST"])
@app.route("/<path:path>", methods=["GET", "POST"])
def always_error(path):
    return "Internal Server Error", 500


def main():
    app.run(debug=True, host="0.0.0.0", port=5000)


if __name__ == "__main__":
    main()

With released uv:

$ uv publish -v --publish-url http://127.0.0.1:5000 -u ferris -p f3rr1s scripts/packages/built-by-uv/dist/*
DEBUG uv 0.6.5
Publishing 2 files http://127.0.0.1:5000/
DEBUG Using request timeout of 900s
Uploading built_by_uv-0.1.0-py3-none-any.whl (10.3KiB)
DEBUG Hashing scripts/packages/built-by-uv/dist/built_by_uv-0.1.0-py3-none-any.whl
DEBUG Using username/password basic auth
DEBUG Transient request failure for: http://127.0.0.1:5000/
DEBUG Response code for http://127.0.0.1:5000/: 500 Internal Server Error
DEBUG Upload error response: Internal Server Error
error: Failed to publish `scripts/packages/built-by-uv/dist/built_by_uv-0.1.0-py3-none-any.whl` to http://127.0.0.1:5000/
  Caused by: Upload failed with status code 500 Internal Server Error. Server says: Internal Server Error

With this branch:

$ uv-debug publish -v --publish-url http://127.0.0.1:5000 -u ferris -p f3rr1s scripts/packages/built-by-uv/dist/*
DEBUG uv 0.6.5+7 (7d065acc2 2025-03-07)
Publishing 2 files http://127.0.0.1:5000/
DEBUG Using request timeout of 900s
Uploading built_by_uv-0.1.0-py3-none-any.whl (10.3KiB)
DEBUG Hashing scripts/packages/built-by-uv/dist/built_by_uv-0.1.0-py3-none-any.whl
DEBUG Using username/password basic auth
DEBUG Transient request failure for: http://127.0.0.1:5000/
warning: Transient failure while handling response for http://127.0.0.1:5000/; retrying...
DEBUG Using username/password basic auth
DEBUG Transient request failure for: http://127.0.0.1:5000/
warning: Transient failure while handling response for http://127.0.0.1:5000/; retrying...
DEBUG Using username/password basic auth
DEBUG Transient request failure for: http://127.0.0.1:5000/
warning: Transient failure while handling response for http://127.0.0.1:5000/; retrying...
DEBUG Using username/password basic auth
DEBUG Transient request failure for: http://127.0.0.1:5000/
DEBUG Response code for http://127.0.0.1:5000/: 500 Internal Server Error
DEBUG Upload error response: Internal Server Error
error: Failed to publish `scripts/packages/built-by-uv/dist/built_by_uv-0.1.0-py3-none-any.whl` to http://127.0.0.1:5000/
  Caused by: Upload failed with status code 500 Internal Server Error. Server says: Internal Server Error

@konstin konstin temporarily deployed to uv-test-publish March 7, 2025 16:21 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uv publish failed to retry on a 502 bad gateway error
3 participants