Keep source files small enough for humans and coding agents
Project description
toobig
toobig is a fast, dependency-free line-limit linter for any text-based source language. It applies graduated
thresholds so a file can become visible before it becomes a hard failure.
Small files are easier for people to review, navigate, test, and refactor. They also fit more readily into the context
windows used by coding agents and LLM tools, leaving more room for the task, related code, and test output. toobig
turns that shared maintainability constraint into a simple, automatable check.
Quick start
Install the toobig command with uv:
uv tool install toobig
Or install it with pipx or pip:
pipx install toobig
# or, inside a virtual environment
python -m pip install toobig
Scan Python files under src/, failing when any file exceeds 1,000 lines:
toobig src 1000 850 700
The three limits are the hard, warning, and informational thresholds, in that order. The default include pattern is
*.py.
Usage
toobig [-v]... [--include GLOB]... [--files-only] DIRECTORY LINE_LIMIT WARNING_LIMIT INFO_LIMIT
Patterns match file basenames and can be repeated. The scan is recursive, includes hidden files, and does not follow
symlinks or apply .gitignore rules.
For a Python project:
toobig src 1000 850 700
toobig --include '*.py' --include '*.pyi' src 1000 850 700
For a Rust project:
toobig --include '*.rs' crates 800 650 500
Use -v to include OK lines for files below every threshold. Use -vv for additional diagnostics about the scan.
Line counts follow wc -l: they count newline characters, so a final line without a trailing newline is not counted.
Threshold semantics
Threshold comparisons are strict. A file exactly at a threshold does not enter that threshold's category.
| File length | Classification | Effect |
|---|---|---|
> LINE_LIMIT |
VIOLATION |
Hard failure |
> WARNING_LIMIT |
WARNING |
Reported, but does not fail |
> INFO_LIMIT |
FYI |
Early heads-up, but does not fail |
<= INFO_LIMIT |
OK |
Shown only with -v |
Exit codes
| Code | Meaning |
|---|---|
0 |
The scan completed with no violations; warnings and FYIs may still have been reported |
1 |
A file exceeded the hard limit, the directory was invalid, or a threshold was invalid |
2 |
Command-line usage error, such as a missing positional argument |
Feed paths to another command
--files-only prints each unique file classified as a violation, warning, or FYI to stdout, in sorted order. It keeps
the normal scan's exit code and emits no log output, making it suitable for scripts:
toobig --files-only src 1000 850 700 | xargs -r editor
When there are no files above the informational threshold, stdout is empty.
Continuous integration
A small Justfile recipe keeps the project policy easy to run locally and in CI:
toobig:
uvx --from toobig toobig src 1000 850 700
Then call the same recipe from GitHub Actions:
- uses: astral-sh/setup-uv@v4
- uses: extractions/setup-just@v3
- run: just toobig
Pin toobig to the version range appropriate for your project when reproducibility is important.
Development
The repository uses uv for environments and dependency installation, and just as its task runner. From a clone:
just install
just check
just check verifies formatting, runs Ruff and strict mypy, and executes the pytest suite. The package supports Python
3.10 through 3.14 and has no runtime dependencies.
Releases
Commits and pull-request titles follow Conventional Commits. On every push to
master, release-please updates or opens a release pull request containing the next version and changelog. Merging
that pull request creates the GitHub release, builds and smoke-tests both distributions, and publishes
toobig to PyPI using trusted publishing (GitHub Actions OIDC), without a long-lived PyPI token.
License
toobig is available under the MIT License.
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 toobig-0.1.0.tar.gz.
File metadata
- Download URL: toobig-0.1.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
534f3880b314dc94dc3101025523573240eb66227e00ded00e18cea9f0d70986
|
|
| MD5 |
5d6b8eb5bc628bab01ef42f5b0a4019a
|
|
| BLAKE2b-256 |
897bdc8fc7792adf8dca95c808300c60eb691ebab4c70b39a31359e5b4a57487
|
Provenance
The following attestation bundles were made for toobig-0.1.0.tar.gz:
Publisher:
publish.yml on bbugyi200/toobig
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
toobig-0.1.0.tar.gz -
Subject digest:
534f3880b314dc94dc3101025523573240eb66227e00ded00e18cea9f0d70986 - Sigstore transparency entry: 2155862917
- Sigstore integration time:
-
Permalink:
bbugyi200/toobig@79ee94bcde279511ed3f670c8a8c8d490aa05fb5 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/bbugyi200
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@79ee94bcde279511ed3f670c8a8c8d490aa05fb5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file toobig-0.1.0-py3-none-any.whl.
File metadata
- Download URL: toobig-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1e585e8b5ed57ae60abdcaec5dad54685b0004e7cf7f860d1a69a7fd9d8ce1f
|
|
| MD5 |
5b117d1038479ea1934ae07186e501f4
|
|
| BLAKE2b-256 |
a86884bacb9693e83e1318d74b18ac85905ac5fff94b3a3f83cb9a4a386f66b9
|
Provenance
The following attestation bundles were made for toobig-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on bbugyi200/toobig
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
toobig-0.1.0-py3-none-any.whl -
Subject digest:
c1e585e8b5ed57ae60abdcaec5dad54685b0004e7cf7f860d1a69a7fd9d8ce1f - Sigstore transparency entry: 2155863002
- Sigstore integration time:
-
Permalink:
bbugyi200/toobig@79ee94bcde279511ed3f670c8a8c8d490aa05fb5 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/bbugyi200
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@79ee94bcde279511ed3f670c8a8c8d490aa05fb5 -
Trigger Event:
push
-
Statement type: