Skip to main content

Python wrapper for claudectx — reduce Claude Code token usage by up to 80%

Project description

claudectx-py

Python wrapper for claudectx — reduce Claude Code token usage by up to 80%.

Install

pip install claudectx-py

This installs the claudectx command into your Python environment's PATH. The wrapper delegates to the underlying npm package, which must be installed separately:

npm install -g claudectx
# or
brew tap Horilla/claudectx && brew install claudectx

Usage

Once both are installed, use claudectx exactly as you would from npm:

claudectx analyze                    # Token breakdown per context component
claudectx optimize --apply           # Auto-fix all token waste
claudectx report                     # 7-day usage analytics
claudectx watch                      # Live token dashboard
claudectx budget "src/**/*.py"       # Estimate cost before a big task
claudectx warmup                     # Pre-warm the Anthropic prompt cache
claudectx drift                      # Find stale CLAUDE.md references
claudectx compress                   # Compress session into MEMORY.md
claudectx teams export               # Export usage for team cost reporting

Why a Python wrapper?

If your team uses Python-based tooling (pyenv, pip, Poetry, uv), this lets you add claudectx as a project dependency in pyproject.toml alongside your other dev tools — no separate npm install step in your CI.

[tool.poetry.dev-dependencies]
claudectx-py = "^1.1.2"

The wrapper is intentionally thin: it locates the claudectx binary on PATH and delegates all arguments to it. No logic is duplicated.

Requirements

  • Python 3.8+
  • Node.js 18+ with claudectx installed globally (npm install -g claudectx)

License

MIT — see claudectx 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 Distribution

claudectx_py-1.1.4.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

claudectx_py-1.1.4-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file claudectx_py-1.1.4.tar.gz.

File metadata

  • Download URL: claudectx_py-1.1.4.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for claudectx_py-1.1.4.tar.gz
Algorithm Hash digest
SHA256 d0116fcb5192576a43a516ac215431e4d83f929f780f4495bae391937e861bbe
MD5 7123e4605084398a82e448fea5bbc1af
BLAKE2b-256 c8a3034b0859b21a59e4015148760c8b6cc1d2ab362e60e6454a3842a738fd02

See more details on using hashes here.

Provenance

The following attestation bundles were made for claudectx_py-1.1.4.tar.gz:

Publisher: publish.yml on Horilla/claudectx-py

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

File details

Details for the file claudectx_py-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: claudectx_py-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for claudectx_py-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 04dea8133ee14e7053f926281091c89baf061d20e78229a3aaad954065bc4697
MD5 ea3ec33e58ba8dde4765a656058a8374
BLAKE2b-256 69252af0053e576184a868222910ca326e098363d8df7127449d458e45e4e845

See more details on using hashes here.

Provenance

The following attestation bundles were made for claudectx_py-1.1.4-py3-none-any.whl:

Publisher: publish.yml on Horilla/claudectx-py

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