Skip to main content

A blazing-fast, parallel Lines of Code counter with Rich terminal UI

Project description

codelines ๐Ÿš€

A blazing-fast, parallel Lines of Code counter with a beautiful terminal UI.

Count lines of actual code in any project โ€” respects .gitignore and .ignore files, uses multi-threaded parallel counting, and displays results in rich, interactive tables.

Features

  • โšก Parallel counting โ€” uses all CPU cores for maximum speed
  • ๐ŸŽจ Rich terminal UI โ€” live progress bars, spinners, and formatted tables
  • ๐Ÿ“ Git-aware โ€” automatically respects .gitignore and .ignore patterns
  • ๐Ÿ“Š Smart stats โ€” breakdowns by file extension, directory, and root folder
  • ๐Ÿ”ง Flexible output โ€” table (default), JSON, CSV formats
  • ๐ŸŽฏ Filtering โ€” include/exclude specific file extensions
  • ๐Ÿ“ Depth control โ€” limit directory traversal depth

Installation

pip install codelines

Quick Start

# Count lines in current directory
codelines .

# Count lines in a specific directory
codelines ~/my-project

# Output as JSON
codelines . --format json

# Only count Python and JavaScript files
codelines . --include .py .js

# Limit to 3 levels deep
codelines . --max-depth 3

Usage

Usage: codelines [OPTIONS] [DIRECTORY]

Options:
  --format [table|json|csv]   Output format (default: table)
  --include EXT [EXT ...]     Only count files with these extensions
  --exclude EXT [EXT ...]     Skip files with these extensions
  --max-depth N              Maximum directory depth to traverse
  --workers N                Number of worker threads (default: CPU count ร— 2)
  --ignore-file PATH         Additional ignore file to use
  --detail / --no-detail     Show per-file line counts (default: --no-detail)
  --sort-by [ext|dir|lines]  Sort results by (default: lines)
  --top N                    Show top N results (default: 5)
  --version                  Show version and exit
  --help                     Show this message and exit

Example Output

                    Summary
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Metric                  โ”‚ Value   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Total Files (counted)   โ”‚ 847     โ”‚
โ”‚ Total Lines (real code) โ”‚ 124,532 โ”‚
โ”‚ Workers                 โ”‚ 16      โ”‚
โ”‚ Skipped Directories     โ”‚ 23      โ”‚
โ”‚ Skipped Files           โ”‚ 156     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

             Top File Types (Actual Code)
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Extension โ”‚ Lines   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ .py       โ”‚ 52,341  โ”‚
โ”‚ .js       โ”‚ 28,912  โ”‚
โ”‚ .ts       โ”‚ 18,234  โ”‚
โ”‚ .css      โ”‚ 12,567  โ”‚
โ”‚ .html     โ”‚  8,901  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

License

MIT ยฉ Muneer Alam

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

codelines-0.1.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

codelines-0.1.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file codelines-0.1.0.tar.gz.

File metadata

  • Download URL: codelines-0.1.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for codelines-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4123c67330a63e5bc3d430f78f808ea2edcd8a144134cf0ec95e6ac16df87cea
MD5 e643de181de591ad6f03252200bb48fe
BLAKE2b-256 d6e1c35d75ce297ac13ee61c21ceb71fbf00ffc7c5b721ee5eb54617c718672d

See more details on using hashes here.

File details

Details for the file codelines-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: codelines-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for codelines-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 497898cb89e2e66e389b8f114e874808720b4bb8c11ac5225395762bb503edd1
MD5 3d833063839f91a11aae899a6f4433ab
BLAKE2b-256 b976a6ab2ce8d4fa84a22a5ddbc7a71279163d3a0773d4730818420f3d95940a

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