Skip to main content

A simple CLI tool to analyse Python file statistics in a directory

Project description

cal-pystats

A simple CLI tool that scans directories for Python files and displays statistics.

Features

  • Recursively scans directories for .py files
  • Reports:
    • Number of Python files
    • Total size (KB/MB)
    • Total lines
    • Code lines (excluding blank lines, docstrings, and decorative comments)
  • 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 cal-pystats

# Using pip
pip install cal-pystats

Usage

# Scan current directory
cal-pystats

# Scan a specific directory
cal-pystats /path/to/project

# Plain text output (no box)
cal-pystats --plain

# JSON output
cal-pystats --json

Example Output

╭────────────────────────────────╮
│     Python Stats: my-project   │
│────────────────────────────────│
│  Files       :            42   │
│  Total Size  :       128.5 KB  │
│  Total Lines :         3,847   │
│  Code Lines  :         2,691   │
╰────────────────────────────────╯

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. See the cal-publish-python documentation for setup.

# Build first
make build

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

Licence

MIT License — Copyright (c) 2026 Cyber Assessment Labs

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.

cal_pystats-1.0.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file cal_pystats-1.0.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for cal_pystats-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ddb6a735c29a30667e996b2790a640b210e0bd727e85677806bfe390476f9979
MD5 3a1efc221244431e768b2ffdf7853bd8
BLAKE2b-256 862c1105dd7ae087a8a7fa56899d9f2a4bae2d6c3bd4e73f59b671980b94d664

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