Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/benchmarks-mv/blob/main/scripts/check-no-python.sh # benchmarks-mv Measurement harnesses and evidence bundles for AIEN on the NVIDIA DGX Spark GB10. Speed is reported against the machine's physical limit and my own previous run. Attachment of AienOS. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `benchmarks-mv / scripts / check-no-python.sh` 49 lines ยท 2562 bytes Raw Blame History 1 #!/bin/sh 2 # SPDX-License-Identifier: Apache-2.0 3 # Copyright 2026 Drake Stapleton (AIEN / aien-dev) 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # No-Python guard (Drake's rule, 2026-10-15: no Python anywhere in AIEN). 18 # Fails when git tracks any Python source, notebook, Python packaging or 19 # environment file, or any file whose first line is a python shebang. 20 # POSIX sh, git, grep and head only. 21 # Usage: sh scripts/check-no-python.sh (from anywhere inside the repository) 22 set -eu 23 top=$(git rev-parse --show-toplevel) || { echo "no-python guard: FAIL. Not inside a git repository." >&2; exit 2; } 24 cd "$top" 25 [ -n "$(git ls-files | head -n 1)" ] || { echo "no-python guard: FAIL. No tracked files; refusing to pass an empty check." >&2; exit 2; } 26 27 # File names are matched case-insensitively (Foo.PY counts). 28 names='(^|/)(setup\.py|setup\.cfg|pyproject\.toml|pipfile|pipfile\.lock|poetry\.lock|uv\.lock|\.python-version|requirements[^/]*\.txt|requirements[^/]*\.in)$|\.(py|pyi|pyw|pyx|pyc|ipynb)$' 29 # Tracked paths that match the name rule but are not Python (one ERE, empty for none). 30 exempt='' 31 32 # -z keeps non-ASCII names unquoted so the patterns see the real name. 33 found=$(git ls-files -z | tr '\0' '\n' | grep -i -E "$names" || true) 34 if [ -n "$exempt" ] && [ -n "$found" ]; then 35 found=$(printf '%s\n' "$found" | grep -v -E "$exempt" || true) 36 fi 37 # Candidates contain a python shebang line anywhere; keep those where it is line 1. 38 shebang=$(git grep -I -l -z -i -E '^#!.*python' -- . 2>/dev/null | tr '\0' '\n' | 39 while IFS= read -r f; do 40 if head -n 1 -- "$f" | grep -q -i -E '^#!.*python'; then printf '%s\n' "$f"; fi 41 done || true) 42 43 if [ -n "$found" ] || [ -n "$shebang" ]; then 44 echo "no-python guard: FAIL. Python is not allowed in this repository. Offending tracked files:" >&2 45 [ -n "$found" ] && printf '%s\n' "$found" | sed 's/^/ /' >&2 46 [ -n "$shebang" ] && printf '%s\n' "$shebang" | sed 's/$/ (python shebang)/; s/^/ /' >&2 47 exit 1 48 fi 49 echo "no-python guard: PASS ($(git ls-files | wc -l | tr -d ' ') tracked files, none is Python)"