potiuk commented on PR #60674: URL: https://github.com/apache/airflow/pull/60674#issuecomment-3763484664
It feels that there is a lot of AI -generated content that could be simpliified a lot if you assume that you have a prek hook that check individual files (which we will have to do anyway), I just (also using Claude Sonnet) generated minimal prek hook doing such verification https://github.com/apache/airflow/pull/60699/ and it's ** really simple **. Take a look as an example. Again I asked Claude to generate minimal verification script without and configuration parameters - because we generally do not need them And it proposed this: ```bash set -euo pipefail tmpdir=$(mktemp -d) trap "rm -rf $tmpdir" EXIT for file in dist/*.{whl,tar.gz}; do [[ -f "$file" ]] || continue unzip -q -j "$file" "*/NOTICE" -d "$tmpdir" 2>/dev/null || \ tar -xzf "$file" --wildcards "*/NOTICE" -C "$tmpdir" --strip-components=1 2>/dev/null || true done notices=("$tmpdir"/NOTICE*) [[ -f "${notices[0]}" ]] && ./scripts/ci/prek/check_notice_files.py "${notices[@]}" ``` ```python from __future__ import annotations import glob import subprocess import tarfile import tempfile import zipfile from pathlib import Path with tempfile.TemporaryDirectory() as d: for f in glob.glob("dist/*.{whl,tar.gz}", recursive=True): try: zipfile.ZipFile(f).extract( next(n for n in zipfile.ZipFile(f).namelist() if n.endswith("NOTICE")), d ) except: try: tarfile.open(f).extract( next(n for n in tarfile.open(f).getnames() if n.endswith("NOTICE")), d ) except: pass if n := list(Path(d).rglob("NOTICE")): subprocess.run(["./scripts/ci/prek/check_notice_files.py", *map(str, n)]) ``` It probably needs a b it polish. but it's generally way, way smaller and does the same job IMHO. -- 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]
