Skip to main content

codetool-shell

Python interface library for compressing plain shell-output text before it is returned to an LLM/tool consumer.

from codetool_shell import compress_text

compressed = compress_text("one  \n\n\n two\t\n")
print(compressed)

The core pipeline is intentionally conservative:

  • normalize CRLF/CR line endings to LF
  • trim trailing whitespace on each line
  • run dedicated output filters only when they make the text smaller
  • collapse repeated blank lines to max_blank_lines (default: 1)

Initial dedicated filters cover:

  • git output: short and long status, tabbed name-status, diff stats, and patch hunks/binary-patch payloads with verbose unchanged or encoded context summarized
  • test-runner output: conservative ANSI-aware pytest (including quiet progress/summary output), unittest-like, vitest-like, Playwright, and cargo-test summaries that preserve failure identifiers, assertion/error text, source locations, artifacts/traces, and final totals
  • CI/job logs: conservative GitHub Actions / gh run-style summaries that collapse repeated timestamped step noise while preserving step names, annotations, warnings/errors, file locations, artifact/URL/path references, and job/workflow conclusions
  • standalone Python tracebacks: conservative traceback summaries that preserve exception type/message, file stack frames, chained-exception separators, source/caret context, and small command noise while collapsing repeated or internal stack frames
  • structured tables: conservative psql, SQLite/column, MySQL boxed, and long Markdown pipe table summaries that preserve headers, footers, first/last rows, and warning/error/URL/path/ID rows while counting omitted middle rows
  • file/tree/listing output: conservative path-only, tree, and safe ls -R reducers that render repeated path prefixes as compact trees while preserving visible summary totals and leaving metadata-rich listings unchanged
  • ripgrep output: direct path:line[:column]:text, heading-mode, context-mode path-line-context with -- separators, and ANSI-colored matches grouped into a compact path tree when repeated paths or prefixes would otherwise be duplicated, while diagnostic/table/prose-looking output is left alone
  • generic application logs: conservative long timestamp/level-prefixed log summaries that collapse repeated INFO/DEBUG/TRACE patterns while preserving first/last context, warnings/errors/fatal/panic/exception lines, file paths/URLs, failure summaries, and unusual levels
  • package-manager logs: conservative uv/pip, npm, bun, and cargo package install/update summaries that collapse progress/download/resolve/install noise while preserving warnings/errors, package summaries, versions, lock/frozen conflicts, audit/vulnerability summaries, hints, paths, and URLs
  • build/compiler diagnostics: conservative cargo/rustc, tsc, ESLint, and mypy-like reducers that collapse build progress while preserving warnings/errors, codes, file spans, source/caret snippets, notes/help, rule IDs, and final summaries

Backends

codetool-shell is a Python library with a Rust compression engine. All compression/filter logic runs in the codetool-shell-rust helper binary; Python keeps the public API, binary discovery, and subprocess boundary.

  • backend="auto" uses the Rust CLI backend and raises a clear RustBackendUnavailable/RustBackendError if the helper cannot be found or fails.
  • backend="rust" is the same strict Rust path.
  • backend="python" is no longer supported.

Rust helper discovery order:

  1. CODETOOL_SHELL_RUST_BINARY
  2. packaged wheel binaries under codetool_shell/bin/<platform>/
  3. development binaries under rust/target/{release,debug}/
  4. PATH

Build and stage the Rust CLI before creating a target wheel with:

python scripts/package_rust_binary.py --target-runtime linux-x86_64

Then build the Python distributions with:

uv build

During local development you can also rely on the development build directly:

cd rust
cargo build

Packaging and release

codetool-shell publishes target-specific wheels that include one matching Rust helper binary under codetool_shell/bin/<runtime>/. Supported runtime keys are:

  • linux-x86_64
  • linux-aarch64
  • macos-x86_64
  • macos-arm64
  • windows-x86_64
  • windows-arm64

To build a Linux x86_64 wheel locally (replace the runtime key for other targets):

uv run python scripts/package_rust_binary.py --target-runtime linux-x86_64
CODETOOL_SHELL_TARGET_RUNTIME=linux-x86_64 uv build --wheel

The release workflow builds an sdist, manylinux wheels, native macOS/Windows wheels, checks the distributions, and publishes to PyPI via trusted publishing for tagged releases (v*) or manual dispatch with publish=true.

Development

uv sync --dev
uv run pytest
uv run python benchmarks/benchmark_compress_text.py
uv run python scripts/benchmark_filters.py --iterations 1000

Metadata

Release files for codetool-shell 0.1.3

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

Source distribution (sdist)

Source distribution for codetool-shell 0.1.3
File Size Uploaded Provenance
codetool_shell-0.1.3.tar.gz 193.9 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for codetool-shell 0.1.3
File
codetool_shell-0.1.3-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details
codetool_shell-0.1.3-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
codetool_shell-0.1.3-py3-none-manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
codetool_shell-0.1.3-py3-none-manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
codetool_shell-0.1.3-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
codetool_shell-0.1.3-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 4.7 MB

Release files / codetool_shell-0.1.3.tar.gz

Download URL codetool_shell-0.1.3.tar.gz
Size 193.9 kB
Tags Source
SHA-256 checksum
How to use checksums
fc92586e22523a0e730c646cbb4452e19543e2ea8d1008a179b382e76f2083fc
BLAKE2b-256 checksum
How to use checksums
21c8d839e59a40245b3efb165724c27bdaedbf51a3ee65b395c98b6f3063f106
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Jun 24, 2026.

Transparency log

Release files / codetool_shell-0.1.3-py3-none-win_arm64.whl

Download URL codetool_shell-0.1.3-py3-none-win_arm64.whl
Size 639.9 kB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
5338010d288a01d03f03f1e7b6f218dcb2343cbdaa8c973a7c789a5f1193cb2b
BLAKE2b-256 checksum
How to use checksums
ebc3a7e3f151fa5b13660d6f9ce8c8cf42fdb219e9c4bb20bb599f82d0a839b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Jun 24, 2026.

Transparency log

Release files / codetool_shell-0.1.3-py3-none-win_amd64.whl

Download URL codetool_shell-0.1.3-py3-none-win_amd64.whl
Size 696.6 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
4823d0a2fa677cd2ba7e15ea99a929a0edba0e5d8df9f0934303193d612fbb60
BLAKE2b-256 checksum
How to use checksums
e6e3937ce7704598cd2caff0be7fc6e300bdc750d346a000b00dda49f88a7c35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Jun 24, 2026.

Transparency log

Release files / codetool_shell-0.1.3-py3-none-manylinux2014_x86_64.whl

Download URL codetool_shell-0.1.3-py3-none-manylinux2014_x86_64.whl
Size 841.2 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
908568fb421d2435188f2b052515a7c7bb4c632f611740f51d8f1dcc05100b21
BLAKE2b-256 checksum
How to use checksums
b3d9bc44d754511c799b7785aedf896b61e4f5be3d9fd178075987c3680bd678
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Jun 24, 2026.

Transparency log

Release files / codetool_shell-0.1.3-py3-none-manylinux2014_aarch64.whl

Download URL codetool_shell-0.1.3-py3-none-manylinux2014_aarch64.whl
Size 803.4 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
871a20c33f3e6c4cceebc4a68fcb88e180637f8cf4ec5ea8ee1e8ab832713db8
BLAKE2b-256 checksum
How to use checksums
b011da158593f2aee21f9e4bc40146febfea790e5d7c415055b433105720054e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Jun 24, 2026.

Transparency log

Release files / codetool_shell-0.1.3-py3-none-macosx_11_0_arm64.whl

Download URL codetool_shell-0.1.3-py3-none-macosx_11_0_arm64.whl
Size 763.7 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a40b73fad3af2be35be315cd2ffa0e3ce813bbd681ea75ac15f3d43d3eeceed6
BLAKE2b-256 checksum
How to use checksums
732861823a24af4f784ede3763f2c52f5339b137e3fba5c2b03b4d3034e6b6f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Jun 24, 2026.

Transparency log

Release files / codetool_shell-0.1.3-py3-none-macosx_10_12_x86_64.whl

Download URL codetool_shell-0.1.3-py3-none-macosx_10_12_x86_64.whl
Size 799.6 kB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0ebeb7fee0d0c5758bee7cc7cc2100d346c9eaf61dba13f7407d7a5e475d580f
BLAKE2b-256 checksum
How to use checksums
6f6065a808ccdf37c3073ad984c7f786d5697f72262c40107bc41d681bfbcb2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Jun 24, 2026.

Transparency log

Security for codetool-shell 0.1.3

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.

Full provenance

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for codetool_shell-0.1.3.tar.gz

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 Jun 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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