This is something I’ve been thinking about recently, since it came up with how PEP 807 plans to encode its error responses.
TL;DR: the current simple index standards (PEP 503 / PEP 691 and their living forms) adequately describe the shape of successful index responses, but not the shape of failure responses. As a result, installer clients (pip, uv, poetry, etc.) frequently have to assume a lowest common denominator of HTTP error code semantics, which in turn are frequently sparse or inaccurate (e.g. an index returning 404 because the client lacks access to a package, rather than because that package doesn’t exist).
For example, with PyPI, error responses are always plain text regardless of the negotiated success response:
$ curl 'https://pypi.org/simple/rlsgkljsgfslgjb/' -H 'Accept: application/vnd.pypi.simple.v1+json'
404 Not Found
whereas other indices may return HTML, JSON, or another differently structured but still plaintext response.
I’m curious if people have thoughts on this – if there’s ample interest, I’ll turn this into a pre-PEP discussion with some rough ideas on how we could accomplish this in a backwards compatible way ![]()