From 41c86719a893dcbf9952de4f2e236a5fd77519b6 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Mon, 27 Jan 2025 11:06:56 +0000 Subject: [PATCH] shorten the changelog included in package description Fixes #3754 Previously we were appending the entire NEWS.rst to the README.rst to make up the PyPI package description. Now we trim the changelog up to some arbitrary `.. package description limit` and insert a link that points to the full NEWS.rst on Github. I set it to just before 4.0 release which is 5 years ago, about half the total number of lines of the full NEWS.rst, so we should be good for a few years at least. --- NEWS.rst | 2 ++ setup.py | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/NEWS.rst b/NEWS.rst index b954535b2..01a531c84 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -1640,6 +1640,8 @@ Minor release to fix uploading wheels to PyPI. - [cffLib] Make sure glyph names are unique (#1699). - [feaLib] Fix feature parser to correctly handle octal numbers (#1700). +.. package description limit + 3.44.0 (released 2019-08-02) ---------------------------- diff --git a/setup.py b/setup.py index 52557fe66..1cf817339 100755 --- a/setup.py +++ b/setup.py @@ -181,8 +181,21 @@ classifiers = { with io.open("README.rst", "r", encoding="utf-8") as readme: long_description = readme.read() long_description += "\nChangelog\n~~~~~~~~~\n\n" +# At the same time, we don't want the PyPI package description becoming too +# long (some tools like Azure DevOps impose maximum length of 324KB) so we +# trim it when we see a special rst comment +changelog_limit_re = re.compile(r"^\.\. package description limit") with io.open("NEWS.rst", "r", encoding="utf-8") as changelog: - long_description += changelog.read() + short_changelog = [] + for line in changelog: + if changelog_limit_re.match(line): + break + short_changelog.append(line) +short_changelog.append( + "\\... see `here `__ " + "for earlier changes\n" +) +long_description += "".join(short_changelog) @contextlib.contextmanager @@ -493,6 +506,7 @@ setup_params = dict( platforms=["Any"], python_requires=">=3.8", long_description=long_description, + long_description_content_type="text/x-rst", package_dir={"": "Lib"}, packages=find_packages("Lib"), include_package_data=True,