docs: fix partner package table build for packages with no download stats (#29871)

The build in #29867 is currently broken because `langchain-cli` didn't
add download stats to the provider file.

This change gracefully handles sorting packages with missing download
counts. I initially updated the build to fetch download counts on every
run, but pypistats [requests](https://pypistats.org/api/) that users not
fetch stats like this via CI.
This commit is contained in:
Ben Burns 2025-02-19 11:05:57 +13:00 committed by GitHub
parent 8e5074d82d
commit e2ba336e72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -93,7 +93,7 @@ packages_n = [_enrich_package(p) for p in data["packages"]]
packages = [p for p in packages_n if p is not None]
# sort by downloads
packages_sorted = sorted(packages, key=lambda p: p["downloads"], reverse=True)
packages_sorted = sorted(packages, key=lambda p: p.get("downloads", 0), reverse=True)
def package_row(p: dict) -> str: