AI-first Python code structure enforcer — 1 file, 1 function
Project description
big-brother
AI-first Python code structure enforcer — 1 file, 1 function.
Code is organized for agents that ls a directory and know what every file does by its name. Big brother sees everything but judges nothing — it reports violations, the gatekeeper decides which are acceptable cohesion and which are real debt.
Install
pip install py-big-brother
CLI Usage
# Scan a project
big-brother .
# Exit 1 on unvetted violations (for CI)
big-brother . --strict
# Skip patterns
big-brother . --ignore "test_*" --ignore "migrations/*"
# Show line ranges per function
big-brother . --lines
# Custom LOC limits
big-brother . --source-max 600 --test-max 400
# Extract a monolith into a 1-file-1-function package
big-brother --stub server.py --output server/
Module invocation also works:
python3 -m big_brother .
Python API
from big_brother import scan, print_report, print_laws
# scan() needs an args-like object with: ignore, source_max, test_max
import argparse
args = argparse.Namespace(ignore=[], source_max=800, test_max=500)
violations, vetted = scan("/path/to/project", args)
print_report(violations, vetted, lines=False)
The Laws
- One public function per
.pyfile — filenames ARE the API __init__.pywith re-exports must have__all__— no opaque packages- Entry files ≤3 non-main defs — routers route, they don't work
- Source files ≤800 LOC, test files ≤500 LOC — agents lose coherence past these limits
Vetting
Not every violation needs fixing. Cohesive small functions that are always modified together can stay in one file. To acknowledge a reviewed file:
Add # bb:vetted to the first 10 lines of the file (usually in the module docstring). Vetted files still appear in output but won't block --strict.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_big_brother-0.1.0.tar.gz.
File metadata
- Download URL: py_big_brother-0.1.0.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f303122d43881f3a6458f4a3df316cdc9af95646afd68a5a9a2e74e0e37abbc
|
|
| MD5 |
9fbfa4cb48b579222e65c566d7a87577
|
|
| BLAKE2b-256 |
f3a7baf37b625a2d9ec81530c37adcfe5020fee6d52b5704854c9ba17a746df7
|
Provenance
The following attestation bundles were made for py_big_brother-0.1.0.tar.gz:
Publisher:
publish.yml on ai-janitor/big-brother
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_big_brother-0.1.0.tar.gz -
Subject digest:
8f303122d43881f3a6458f4a3df316cdc9af95646afd68a5a9a2e74e0e37abbc - Sigstore transparency entry: 930118388
- Sigstore integration time:
-
Permalink:
ai-janitor/big-brother@942d91acce12a7ca3db710b25cd470f806201483 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ai-janitor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@942d91acce12a7ca3db710b25cd470f806201483 -
Trigger Event:
release
-
Statement type:
File details
Details for the file py_big_brother-0.1.0-py3-none-any.whl.
File metadata
- Download URL: py_big_brother-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad4213a8e1f9b0b172855a4766a7bbaa39857a90122e8d47c99e5831f908528e
|
|
| MD5 |
8e18c8313f46c10f5de0d83afdef88d8
|
|
| BLAKE2b-256 |
693c5806f9e2dbd2ead08584a380c3e5b654f622f39388f4429a8f8a59c0aad4
|
Provenance
The following attestation bundles were made for py_big_brother-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on ai-janitor/big-brother
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_big_brother-0.1.0-py3-none-any.whl -
Subject digest:
ad4213a8e1f9b0b172855a4766a7bbaa39857a90122e8d47c99e5831f908528e - Sigstore transparency entry: 930118395
- Sigstore integration time:
-
Permalink:
ai-janitor/big-brother@942d91acce12a7ca3db710b25cd470f806201483 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ai-janitor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@942d91acce12a7ca3db710b25cd470f806201483 -
Trigger Event:
release
-
Statement type: