Skip to main content

Count tokens in dir or git repos

Project description

countmytokens

Ever wondered how big in tokens are your codebase? No? Well, too bad, because countmytokens is here to count them anyway.

Features

  • Token Counting: Counts tokens in all your files.
  • Binary File Skipping: Skipps binary files because counting tokens in those would be just silly.
  • CSV Reports: Generates CSV reports so you can pretend to analyze the data.
  • Tree Reports: Creates tree reports to visualize the token hierarchy.
  • Git Integration: If it detects a Git repository, it uses ls-files to respect .gitignore and other exclude settings.

Installation

pip install countmytokens

For users who prefer to use pipx, you can install it globally:

pipx install countmytokens

If you are using uv, you can install it with:

uv tool install countmytokens

Usage

countmytokens /path/to/your/code/project

Options

  • --exclude*: Paths to exclude. Because some files just don't deserve to be counted.
  • --include-binary*: Include binary files in the token count. If you're into that sort of thing.
  • --max-files*: Maximum concurrent file operations. Default is 100. Because why not?
  • --report*: Choose your report format: lines or tree
  • --output: Output file for CSV report. Default is token_report.csv. Creative, huh?
  • --verbose: Increase output verbosity

Example

countmytokens /path/to/your/code/project --exclude venv --report tree --verbose

Contributing

Feel free to contribute. Or don't. It's your life.

LICENSE MIT License. Because sharing is caring.

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

countmytokens-0.1.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

countmytokens-0.1.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file countmytokens-0.1.1.tar.gz.

File metadata

  • Download URL: countmytokens-0.1.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for countmytokens-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a0907d6661710b17b096e961c3108aed81d29147b287e4d1ea8a02a0648eda66
MD5 a27f8c696877686c8c0edc7a613cabf7
BLAKE2b-256 c1964e0c6d2e24dead14f1282dd9187ec94e765d68f8e18f5bf7909ba2b72801

See more details on using hashes here.

Provenance

The following attestation bundles were made for countmytokens-0.1.1.tar.gz:

Publisher: publish.yml on autoscatto/countmytokens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file countmytokens-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: countmytokens-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for countmytokens-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 78a1c2d37b204ba27d96e1e4d7e1261001ac3bda2a0d6bac3519a8de07d592c6
MD5 96d7a6c82f20bc77abd81de249c90317
BLAKE2b-256 140b7d3363f71dacc7f2d0c530322ebdf3cadd70c4e82b2954431a57a45e8583

See more details on using hashes here.

Provenance

The following attestation bundles were made for countmytokens-0.1.1-py3-none-any.whl:

Publisher: publish.yml on autoscatto/countmytokens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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