interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core-mv / scripts / check-no-python.sh

51 lines · 2756 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)
22set -eu
23top=$(git rev-parse --show-toplevel) || { echo "no-python guard: FAIL. Not inside a git repository." >&2; exit 2; }
24cd "$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).
28names='(^|/)(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). Here: the
30# requirement-reader probe evidence files (plain-text output of the Rust
31# requirements::analyze probe, not pip requirements files).
32exempt='^docs/campaigns/[^/]+/evidence-[^/]+/requirements-probe-[^/]+\.txt$'
33
34# -z keeps non-ASCII names unquoted so the patterns see the real name.
35found=$(git ls-files -z | tr '\0' '\n' | grep -i -E "$names" || true)
36if [ -n "$exempt" ] && [ -n "$found" ]; then
37 found=$(printf '%s\n' "$found" | grep -v -E "$exempt" || true)
38fi
39# Candidates contain a python shebang line anywhere; keep those where it is line 1.
40shebang=$(git grep -I -l -z -i -E '^#!.*python' -- . 2>/dev/null | tr '\0' '\n' |
41 while IFS= read -r f; do
42 if head -n 1 -- "$f" | grep -q -i -E '^#!.*python'; then printf '%s\n' "$f"; fi
43 done || true)
44
45if [ -n "$found" ] || [ -n "$shebang" ]; then
46 echo "no-python guard: FAIL. Python is not allowed in this repository. Offending tracked files:" >&2
47 [ -n "$found" ] && printf '%s\n' "$found" | sed 's/^/ /' >&2
48 [ -n "$shebang" ] && printf '%s\n' "$shebang" | sed 's/$/ (python shebang)/; s/^/ /' >&2
49 exit 1
50fi
51echo "no-python guard: PASS ($(git ls-files | wc -l | tr -d ' ') tracked files, none is Python)"