Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): avoid false positive cli upgrade suggestions #12497

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions metadata-ingestion/src/datahub/upgrade/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ async def get_client_version_stats():
async with session.get(pypi_url) as resp:
response_json = await resp.json()
try:
releases = response_json.get("releases", [])
sorted_releases = sorted(releases.keys(), key=lambda x: Version(x))
latest_cli_release_string = [
x for x in sorted_releases if "rc" not in x
][-1]
releases = response_json.get("releases", {})
filtered_releases = {
version: release_files
for version, release_files in releases.items()
if not all(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not all or not any ? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have two files per release - a .tar.gz and .whl file. If in the future we add architecture-specific .whl files, we'll have multiple. We should only really consider a release yanked if every file is yanked - if we yank only a specific file due to a packaging issue, the release is still mostly valid

release_file.get("yanked") for release_file in release_files
)
and "rc" not in version
}
sorted_releases = sorted(
filtered_releases.keys(), key=lambda x: Version(x)
)
latest_cli_release_string = sorted_releases[-1]
latest_cli_release = Version(latest_cli_release_string)
current_version_info = releases.get(current_version_string)
current_version_date = None
Expand Down
Loading