This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow-site-archive.git
The following commit(s) were added to refs/heads/main by this push:
new c821ad26ec8 Fix lint failures caused by the unpinned ruff hook (#46)
c821ad26ec8 is described below
commit c821ad26ec869cd6f3f96730eee980c10f68a289
Author: Jarek Potiuk <[email protected]>
AuthorDate: Mon Aug 10 22:37:37 2026 +0800
Fix lint failures caused by the unpinned ruff hook (#46)
Basic checks has been red on main since 2026-08-09. The ruff hook declared
`additional_dependencies: ['ruff']` with no version, so every run installs
whatever ruff was released last - and ruff 0.16 widened its default rule
set, which started flagging code that had not changed.
* Pin the hook to ruff 0.16.1 so the rule set only moves when we move it.
0.16.2 exists but is inside the 7-day cooldown this repository uses.
* Apply ruff's own fixes: sorted imports and `Callable` from
`collections.abc`.
* GITHUB_RUN_ID defaulted to an int rather than a str (PLW1508).
* apply_summit_banner.py has a shebang, so make it executable (EXE001).
* Ignore BLE001 - these scripts catch broad exceptions on purpose, to print
a readable message instead of a traceback for someone running them by
hand.
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
---
.pre-commit-config.yaml | 4 +++-
pyproject.toml | 5 +++++
scripts/apply_summit_banner.py | 0
scripts/github_to_s3.py | 9 ++++++---
scripts/s3_to_github.py | 13 ++++++++-----
scripts/transfer_utils.py | 16 +++++-----------
6 files changed, 27 insertions(+), 20 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 295e378257c..34cdf49ec76 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -48,7 +48,9 @@ repos:
types_or: [python, pyi]
args: [--fix]
require_serial: true
- additional_dependencies: ['ruff']
+ # Pinned: an unpinned ruff picks up whatever was released last, so a
+ # release that widens the default rule set turns CI red without a
commit.
+ additional_dependencies: ['ruff==0.16.1']
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
hooks:
diff --git a/pyproject.toml b/pyproject.toml
index a074dd5dc59..a76a63b7658 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -8,3 +8,8 @@ dependencies = [
"boto3>=1.38.11",
"rich>=14.0.0",
]
+
+[tool.ruff.lint]
+# These scripts deliberately catch broad exceptions to print a readable message
+# and exit, rather than dumping a traceback on a user running them by hand.
+ignore = ["BLE001"]
diff --git a/scripts/apply_summit_banner.py b/scripts/apply_summit_banner.py
old mode 100644
new mode 100755
diff --git a/scripts/github_to_s3.py b/scripts/github_to_s3.py
index 27d63185eaa..1126835aaa5 100644
--- a/scripts/github_to_s3.py
+++ b/scripts/github_to_s3.py
@@ -30,9 +30,12 @@ import sys
from pathlib import Path
from rich.console import Console
-
-from transfer_utils import CommonTransferUtils,
convert_short_name_to_full_package_name, \
- sort_priority_packages, invalidate_cloudflare_cache
+from transfer_utils import (
+ CommonTransferUtils,
+ convert_short_name_to_full_package_name,
+ invalidate_cloudflare_cache,
+ sort_priority_packages,
+)
console = Console(width=200, color_system="standard")
diff --git a/scripts/s3_to_github.py b/scripts/s3_to_github.py
index f780ffd7b4a..4aba808dbb1 100644
--- a/scripts/s3_to_github.py
+++ b/scripts/s3_to_github.py
@@ -22,15 +22,18 @@
# "rich>=14.0.0",
# ]
# ///
-import os
-from pathlib import Path
import argparse
+import os
import sys
+from pathlib import Path
from rich.console import Console
-
-from transfer_utils import CommonTransferUtils,
convert_short_name_to_full_package_name, sort_priority_packages, \
- sort_priority_tuples
+from transfer_utils import (
+ CommonTransferUtils,
+ convert_short_name_to_full_package_name,
+ sort_priority_packages,
+ sort_priority_tuples,
+)
console = Console(width=200, color_system="standard")
diff --git a/scripts/transfer_utils.py b/scripts/transfer_utils.py
index 06e62aa1e4e..f97184a34e4 100644
--- a/scripts/transfer_utils.py
+++ b/scripts/transfer_utils.py
@@ -2,12 +2,13 @@ import os
import subprocess
import sys
import tempfile
+from collections.abc import Callable
from functools import cached_property
from multiprocessing import Pool
from pathlib import Path
from threading import Thread
from time import sleep
-from typing import Callable, Any
+from typing import Any
import boto3
import urllib3
@@ -46,8 +47,7 @@ class CommonTransferUtils:
def prefix(self) -> str:
try:
pref = urllib3.util.parse_url(self.bucket).path
- if pref.startswith('/'):
- pref = pref[1:]
+ pref = pref.removeprefix('/')
return pref
except Exception as e:
console.print(f"[red] Error: {e}[/]")
@@ -85,18 +85,12 @@ class CommonTransferUtils:
thread = Thread(target=track_progress, args=(source,
Path(output_file.name),))
thread.start()
delete= ["--delete"] if not skip_delete else []
- if source.startswith("s3://"):
+ if source.startswith("s3://") or Path(source).is_dir():
subprocess.run(
["aws", "s3", "sync", *delete, "--no-progress", source,
destination],
stdout=output_file,
text=True, check=True
)
- elif Path(source).is_dir():
- subprocess.run(
- ["aws", "s3", "sync", *delete, "--no-progress", source,
destination],
- stdout=output_file,
- text=True, check=True
- )
else:
self.copy(source, destination)
Path(output_file.name).unlink(missing_ok=True)
@@ -188,7 +182,7 @@ def invalidate_cloudflare_cache(destination_location: str):
"Quantity": 1,
"Items": ["/*"],
},
- "CallerReference": str(int(os.environ.get("GITHUB_RUN_ID", 0))),
+ "CallerReference": str(int(os.environ.get("GITHUB_RUN_ID", "0"))),
},
)
console.print(