PyPI packages uploaded to package registry have undocumented limit on description length

Summary

  1. PyPI packages with descriptions longer than 4000 chars fail to upload to the package registry.
  2. This limit doesn't seem to be documented anywhere.
  3. This limit is very easy to hit or exceed since package descriptions typically contain the project entire README file (Ref: https://python-poetry.org/docs/pyproject/#readme)
  4. PyPI.org does not enforce a similar limit.

Steps to reproduce

Build and attempt to upload a PyPI package with a readme longer than 4000 chars.

Example Project

Example: https://gitlab.com/thelabnyc/django-oscar/django-oscar-bluelight/-/blob/master/server/pyproject.toml

  1. CI job which failed due to this limit: https://gitlab.com/thelabnyc/django-oscar/django-oscar-bluelight/-/jobs/5545630647.
  2. Notice how just prior to failing to upload to the Gitlab registry, the PyPI.org upload of the same pkg binary worked fine.

What is the current bug behavior?

The twine upload fails with this reponse:

{"message":"Validation failed: Description is too long (maximum is 4000 characters)"}

What is the expected correct behavior?

Gitlab package registry should allow long descriptions of packages.

Relevant logs and/or screenshots

2023-11-15T155553-0500_screenshot_crgwbr_ip-10-0-1-10__projectstempur-sealythelab-fossdjango-oscar-bluelightserver

Output of checks

This bug happens on GitLab.com

Possible fixes

Increase description length limit to match behavior of PyPI.org—either no limit, or at least long enough to allow the average-length README.