codesize
A simple CLI tool that scans directories for code files and displays statistics. Supports Python, Go, Rust, Elixir, JavaScript, TypeScript, Swift, C, and Objective-C.
.h files are auto-detected as C or Objective-C based on their content.
Respects .gitignore files found in the tree by default (pass --no-gitignore to disable).
Features
- Recursively scans directories for supported code files
- Reports per-language breakdown:
- Number of files
- Total size (KB/MB)
- Total lines
- Code lines (excluding blank lines, docstrings, and decorative comments)
- Combined totals when multiple languages are present
- Only shows languages that have files — no clutter
- Beautiful ASCII box output with ANSI colours (when running in a terminal)
- Plain text and JSON output formats available
Installation
# Using uv
uv pip install codesize
# Using pip
pip install codesize
Usage
# Scan current directory
codesize
# Scan a specific directory
codesize /path/to/project
# Plain text output (no box)
codesize --plain
# JSON output
codesize --json
# Ignore .gitignore files (scan everything)
codesize --no-gitignore
# Sort languages by something other than code lines
codesize --sort files # or: size, lines, code (default), name
Languages are listed biggest first by code-line count by default. Pass --sort name for alphabetical, or --sort files|size|lines for the other fields.
Example Output
╭──────────────────────────────────────────────╮
│ Code Stats: my-project │
│──────────────────────────────────────────────│
│ Files Size Lines Code │
│ Python 42 128.50 KB 3,847 2,691 │
│ Go 18 65.20 KB 1,523 1,210 │
│ Rust 7 22.00 KB 580 445 │
│──────────────────────────────────────────────│
│ Total 67 215.70 KB 5,950 4,346 │
╰──────────────────────────────────────────────╯
Development
# Set up development environment
make dev
# Run linting and type checks
make check
# Format code
make format
# Build wheel and docs
make build
Publishing
Publishing requires wj-publish configuration.
# Build first
make build
# Publish wheel to PyPI and docs to docs.waterjuice.org
make publish
Licence
Unlicense — public domain. See LICENSE.
Metadata
Release files for codesize 1.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| codesize-1.5.1-py3-none-any.whl | Python 3 | none | any | Details for codesize-1.5.1-py3-none-any.whl |
Release files / codesize-1.5.1-py3-none-any.whl
| Download URL | codesize-1.5.1-py3-none-any.whl |
|---|---|
| Size | 83.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0381a921ae21877c0ba4b596d258a8accb6828ce9505c66cb7c3a78e6051aa3b
|
|
BLAKE2b-256 checksum How to use checksums |
ad569755c9356f83a81b6233dc895c3c2d602f804db2ee731ed381fa8a18885d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for codesize 1.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.