Skip to content

Commit

Permalink
shorten the changelog included in package description
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
anthrotype committed Jan 27, 2025
1 parent 42db704 commit 41c8671
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
----------------------------

Expand Down
16 changes: 15 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,21 @@ def doraise_py_compile(file, cfile=None, dfile=None, doraise=False):
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
Expand Down Expand Up @@ -493,6 +506,7 @@ def build_extensions(self):
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,
Expand Down

0 comments on commit 41c8671

Please sign in to comment.