Skip to main content

Enforce file size constraints

Project description

loq

Enforce file size constraints.

loq is a fast, minimal tool that keeps codebases LLM-context-friendly and human-maintainable by enforcing hard per-file line limits. The name visually resembles "loc" (lines of code).

LLMs happily generate big files. Big files burn context, slow reviews, and become dumping grounds. loq provides a hard constraint that stops files from growing too large.

Install

pip install loq

# Or with uv
uv tool install loq

# Or with cargo
cargo install loq

Quick start

# zero-config: uses built-in defaults
loq

# explicit check
loq check src/

# stdin list
git diff --cached --name-only | loq check -

Output

Violations show the file, line count, and how far over the limit:

✖  src/utils.py
   512 lines   (+12 over limit)

Summary:

Found 2 violations in 150 checked files.

  ✖  2 Errors
  ⚠  0 Warnings
  ✔  148 Passed

  Time: 12ms

Config

Create a config with defaults:

loq init

Baseline a legacy repo (exempts current errors, blocks new ones):

loq init --baseline

Config discovery walks upward from each file’s directory and uses the nearest loq.toml. Patterns are matched against paths relative to the config directory.

respect_gitignore defaults to true and applies the root .gitignore when scanning. The built-in defaults do not add any exclude patterns.

Development

Install Rust (once):

rustup default stable

Common tasks:

# build
cargo build

# run the CLI locally
cargo run -p loq -- check .

# install locally
cargo install --path crates/loq_cli

# quick checks (fmt + clippy)
just check

# benchmark against a public repo
just bench https://github.com/astral-sh/ruff

Enable git hooks in this repo:

git config core.hooksPath .githooks

Default loq.toml

default_max_lines = 500

respect_gitignore = true

exclude = []

exempt = []

# Last match wins. Put general rules first and overrides later.
[[rules]]
path = "**/*.tsx"
max_lines = 300
severity = "warning"

[[rules]]
path = "tests/**/*"
max_lines = 500

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

loq-0.1.0a2.tar.gz (39.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

loq-0.1.0a2-py3-none-win_amd64.whl (1.2 MB view details)

Uploaded Python 3Windows x86-64

loq-0.1.0a2-py3-none-musllinux_1_2_x86_64.whl (1.3 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

loq-0.1.0a2-py3-none-musllinux_1_2_aarch64.whl (1.2 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

loq-0.1.0a2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

loq-0.1.0a2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

loq-0.1.0a2-py3-none-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

loq-0.1.0a2-py3-none-macosx_10_12_x86_64.whl (1.2 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file loq-0.1.0a2.tar.gz.

File metadata

  • Download URL: loq-0.1.0a2.tar.gz
  • Upload date:
  • Size: 39.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for loq-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 0225dcdf98c8bdda6ac5a8d1612433852991d40e19123f9ee19725c0864c4c09
MD5 d6fd89cff0b4f27fb2732c3cad1f894b
BLAKE2b-256 d9df95fcb5f7f4a3e9b0aa7dd5768ff76c58077849ebe7bb600639a7a820ac4e

See more details on using hashes here.

File details

Details for the file loq-0.1.0a2-py3-none-win_amd64.whl.

File metadata

  • Download URL: loq-0.1.0a2-py3-none-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for loq-0.1.0a2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 20238579c81238ced239986afbd16aec64d2eef82004075eaef0e5ccb55c30f4
MD5 8fe14a193fe9781aa100c47874d77fe6
BLAKE2b-256 89b95b60bded81067b6db4fa477ae4222908f7fed91b8880290676eb5a64e94c

See more details on using hashes here.

File details

Details for the file loq-0.1.0a2-py3-none-musllinux_1_2_x86_64.whl.

File metadata

  • Download URL: loq-0.1.0a2-py3-none-musllinux_1_2_x86_64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3, musllinux: musl 1.2+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for loq-0.1.0a2-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0086db8bb30f11e8ca2e419b85a8ad41257637301a71f6baaf691633303d92a8
MD5 7e2e21606e039f4d8430f16a71e9deb4
BLAKE2b-256 6cf6db386bd7f67c6d394919f693d3f654a0eeb83f149347a61cbd755471d298

See more details on using hashes here.

File details

Details for the file loq-0.1.0a2-py3-none-musllinux_1_2_aarch64.whl.

File metadata

  • Download URL: loq-0.1.0a2-py3-none-musllinux_1_2_aarch64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 3, musllinux: musl 1.2+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for loq-0.1.0a2-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 4be8e8a6d3e127169a80d1b631bf47feb625b629e175e7a90860083eadc1fc77
MD5 3d481f9f2e294e9f7efd5a7063297abe
BLAKE2b-256 1c3eabd4d73373369f55499b7a7f4f55cec6f0c8676f9921574aa5e871d30f0e

See more details on using hashes here.

File details

Details for the file loq-0.1.0a2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: loq-0.1.0a2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 3, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for loq-0.1.0a2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2fbb3603406f42c2e8fb2585a9a3dcf170a4b2adf34e2cdf34cf0f31e6c60bdb
MD5 9fc0d7e347e3dffa4a32b248050e0b27
BLAKE2b-256 5910db140c3004d73060e537c85f235a467f5e13b51c22d3535f44e909f43d90

See more details on using hashes here.

File details

Details for the file loq-0.1.0a2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

  • Download URL: loq-0.1.0a2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for loq-0.1.0a2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e9e1efb7acb3fdc8a6df253eaa46c9fac9028c71c875ddd1288be871211941fb
MD5 5d6975057b2e5d1102d7efe92be55dff
BLAKE2b-256 22189c291f9a6b353eafd5ecf73bc1e84085c37a2faf37cdd1b4a582c3803748

See more details on using hashes here.

File details

Details for the file loq-0.1.0a2-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: loq-0.1.0a2-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for loq-0.1.0a2-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ffc8fd7e00f26e541ac46317834fa5a0cc4a873f74b8f5c692614e76ca548693
MD5 d3598079634e4f215091cdfb7c26ba04
BLAKE2b-256 4abf77b89ae1a596d4b828972f1160ffb8612f9718c0b8d0659799db88f59ad4

See more details on using hashes here.

File details

Details for the file loq-0.1.0a2-py3-none-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: loq-0.1.0a2-py3-none-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 3, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for loq-0.1.0a2-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 cf0fdabd86eaeebd2d61b163f93ac3541a1fb2e0733471f1212042a738b221aa
MD5 9694cb0b3fd30ac66a35f5c6e247c5c0
BLAKE2b-256 5e3786448b6828b471451820cea7332b3a0efe88ffab05c20f21d94607fb5142

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page