Taragolis commented on PR #38262:
URL: https://github.com/apache/airflow/pull/38262#issuecomment-2003994139
Locally I use simple script for check is version yanked and is it exists in
changelog
```python
from __future__ import annotations
import json
from pathlib import Path
import requests
from packaging.utils import (
canonicalize_name,
parse_sdist_filename,
parse_wheel_filename,
)
airflow_project = (
Path("/Users/taragolis/Projects/common/airflow").resolve(strict=True).absolute()
)
metadata = json.loads((airflow_project /
"generated/provider_metadata.json").read_text())
packages = {
canonicalize_name(f"apache-airflow-providers-{package}"): package
for package in metadata
}
s = requests.session()
# Follow PEP 691: https://peps.python.org/pep-0691/
s.headers.update({"Accept": "application/vnd.pypi.simple.v1+json"})
for package, internal_name in packages.items():
res = s.get(f"https://pypi.org/simple/{package}")
versions = {}
files = res.json()["files"]
for file_metadata in files:
if not (yanked := file_metadata.get("yanked", False)):
continue
file = file_metadata["filename"]
if file.endswith(".whl"):
version = parse_wheel_filename(file)[1]
else:
version = parse_sdist_filename(file)[1]
if version.is_prerelease:
continue
versions[version] = yanked
if not versions:
continue
changelog = (
airflow_project
/ f"airflow/providers/{internal_name.replace('.',
'/')}/CHANGELOG.rst"
)
if not changelog.exists():
raise FileNotFoundError(changelog.as_posix())
changelog_content = changelog.read_text()
versions_formatted = {}
for version, reason in sorted(versions.items()):
version_str = f"{version} (YANKED)"
if version_str in changelog_content:
continue
rst_reason = (
f".. warning:: This release has been **yanked** with a reason:
``{reason}``"
)
versions_formatted[version] = (
f"{version_str}\n{'.' * len(version_str)}\n\n{rst_reason}"
)
if versions_formatted:
print(f" {package} ".center(72, "="))
for version, text in sorted(versions_formatted.items()):
print(f" {version} ".center(72, ">"))
print(text)
print()
print(f" {version} ".center(72, "<"))
print()
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]