You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2025/10/25 08:50:26 UTC
(airflow) 01/01: Only show latest minor versions in version drop-down in docs
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch filter-versions-to-latest-minor
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 09a624562f0874648d538745f6eef28c4d18f8d5
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Sat Oct 25 10:46:26 2025 +0200
Only show latest minor versions in version drop-down in docs
This does not remove the actual versions from S3 only limits
the drop-down. All versions are available still to see and they
are indexed, also links from PyPI continue to work, you can
also manually update version in the URL.
---
.../src/airflow_breeze/utils/publish_docs_to_s3.py | 26 +++++++++++++---------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/dev/breeze/src/airflow_breeze/utils/publish_docs_to_s3.py b/dev/breeze/src/airflow_breeze/utils/publish_docs_to_s3.py
index dbf3b96fd5d..863c59779cb 100644
--- a/dev/breeze/src/airflow_breeze/utils/publish_docs_to_s3.py
+++ b/dev/breeze/src/airflow_breeze/utils/publish_docs_to_s3.py
@@ -303,7 +303,7 @@ class S3DocsPublish:
all_packages_infos = [
{
"package-name": package_name,
- "all-versions": (all_versions := self.get_all_versions(package_name, versions)),
+ "all-versions": (all_versions := self.get_latest_minor_versions(package_name, versions)),
"stable-version": all_versions[-1],
}
for package_name, versions in package_versions.items()
@@ -312,22 +312,26 @@ class S3DocsPublish:
return all_packages_infos
@staticmethod
- def get_all_versions(package_name: str, versions: list[str]) -> list[str]:
+ def get_latest_minor_versions(package_name: str, versions: list[str]) -> list[str]:
from packaging.version import Version
- good_versions = []
- for version in versions:
+ all_versions: list[Version] = []
+ for v in versions:
try:
- Version(version)
- good_versions.append(version)
+ all_versions.append(Version(v))
except ValueError as e:
- get_console().print(f"[error]Invalid version {version}: {e}\n")
+ get_console().print(f"[error]Invalid version {v}: {e}\n")
global version_error
version_error = True
- return sorted(
- good_versions,
- key=lambda d: Version(d),
- )
+ all_versions.sort(reverse=True)
+ minor_versions: list[str] = []
+ good_versions = []
+ for version in all_versions:
+ minor_version = str(version.major) + "." + str(version.minor)
+ if minor_version not in minor_versions:
+ minor_versions.append(minor_version)
+ good_versions.append(str(version))
+ return good_versions
@staticmethod
def get_bucket_key(bucket_path: str) -> tuple[str, str]: