Skip to main content

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.

Release files for countmytokens 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for countmytokens 0.1.1
File Size Uploaded
countmytokens-0.1.1.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for countmytokens 0.1.1
File Interpreter ABI Platform
countmytokens-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.3 kB

Release files / countmytokens-0.1.1.tar.gz

Download URL countmytokens-0.1.1.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a0907d6661710b17b096e961c3108aed81d29147b287e4d1ea8a02a0648eda66
BLAKE2b-256 checksum
How to use checksums
c1964e0c6d2e24dead14f1282dd9187ec94e765d68f8e18f5bf7909ba2b72801
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 24, 2025.

Transparency log

Release files / countmytokens-0.1.1-py3-none-any.whl

Download URL countmytokens-0.1.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78a1c2d37b204ba27d96e1e4d7e1261001ac3bda2a0d6bac3519a8de07d592c6
BLAKE2b-256 checksum
How to use checksums
140b7d3363f71dacc7f2d0c530322ebdf3cadd70c4e82b2954431a57a45e8583
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 24, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page