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.
This commit is contained in:
Cosimo Lupo 2025-01-27 11:06:56 +00:00
parent 42db704693
commit 41c86719a8
2 changed files with 17 additions and 1 deletions

View File

@ -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)
----------------------------

View File

@ -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 <https://github.com/fonttools/fonttools/blob/main/NEWS.rst>`__ "
"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,