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.2.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.2-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: claudectx_py-1.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 7fd59d9edc53089228bae01f7eab3a7d631d025aef93589ac7fb9331c4caebb1
MD5 283e3633c0deb1a2a7f3523b5e47e1c3
BLAKE2b-256 8bc7adbf5a0d4c8522256e73797abcdef57807876b8e202b09724dcdb09ec7bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for claudectx_py-1.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: claudectx_py-1.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 13e4f9d17b6ff30a0a7de1469e4f03b8c0fc7549e81d7a8a15451691e7738635
MD5 589368c3eb72006f3b36825e0108c54a
BLAKE2b-256 737ed1aed9539479510896e6e3d8f6d6170fbc41050dfb667de4194d784dd120

See more details on using hashes here.

Provenance

The following attestation bundles were made for claudectx_py-1.1.2-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