Skip to main content

A simple CLI tool to analyse code statistics in a directory

Project description

codesize

A simple CLI tool that scans directories for code files and displays statistics. Supports Python, Go, Rust, Elixir, JavaScript, 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

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 cal-publish-python configuration.

# Build first
make build

# Publish wheel to PyPI and docs to GitLab Pages
make publish

Licence

Unlicense — public domain. See LICENSE.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

codesize-1.2.0-py3-none-any.whl (82.9 kB view details)

Uploaded Python 3

File details

Details for the file codesize-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: codesize-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 82.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for codesize-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dee54351b43346c45dc0abb6732680445bbaffffbea48654b4297097da0779ab
MD5 8e72aae0168525d7a048ce531376a453
BLAKE2b-256 00255a89c28b6e627bef0f01a227fe3767391e8765b8e2d02a63aaabdbb79e4d

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