Skip to main content

A fast, accurate comment removal tool using tree-sitter for AST parsing

Project description

uncomment

PyPI version MIT License

A fast, accurate comment removal tool using tree-sitter for AST parsing. Perfect for cleaning up AI-generated code with excessive comments.

Installation

pip install uncomment

Note: This Python package downloads and wraps the native Rust binary, providing fast performance without requiring Rust to be installed.

Quick Start

# Remove comments from a single file
uncomment src/app.py

# Process entire directory with 8 parallel threads
uncomment --threads 8 src/

# Preview changes without modifying files
uncomment --dry-run src/

# Remove TODO/FIXME comments too
uncomment --remove-todo --remove-fixme src/

# Remove documentation comments
uncomment --remove-doc src/

Supported Languages

  • Python (.py, .pyw, .pyi, .pyx, .pxd)
  • JavaScript (.js, .jsx, .mjs, .cjs)
  • TypeScript (.ts, .tsx, .mts, .cts, .d.ts)
  • Rust (.rs)
  • Go (.go)
  • Java (.java)
  • C/C++ (.c, .h, .cpp, .hpp, .cc, .hh)
  • Ruby (.rb)
  • YAML (.yml, .yaml)
  • HCL/Terraform (.hcl, .tf, .tfvars)
  • Makefile (Makefile, .mk)

Features

  • 100% Accurate: Uses tree-sitter AST parsing - never removes comment-like content from strings
  • Smart Preservation: Automatically keeps important metadata:
    • Linting directives (ESLint, Biome, Pylint, etc.)
    • Type annotations and coverage ignores
    • TODO/FIXME comments (optional)
    • Documentation comments (optional)
  • High Performance: Multi-threaded processing with up to 3.4x speedup
  • Safe: Dry-run mode to preview changes before applying
  • Cross-platform: Works on Windows, macOS, and Linux

Why Use This?

Perfect for:

  • Cleaning up AI-generated code with excessive explanatory comments
  • Preparing code for production by removing development comments
  • Batch processing large codebases
  • Maintaining clean, professional code without manual comment removal

Documentation

Alternative Installation Methods

# Rust/Cargo
cargo install uncomment

# Node.js/npm
npm install -g uncomment

# Direct download
# See GitHub releases for pre-built binaries

License

MIT - see LICENSE for details.

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

uncomment-2.1.17.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

uncomment-2.1.17-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file uncomment-2.1.17.tar.gz.

File metadata

  • Download URL: uncomment-2.1.17.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for uncomment-2.1.17.tar.gz
Algorithm Hash digest
SHA256 66c1707702dc427b9edc6728badaa4ef214a10424234256bc98420100815cc9b
MD5 8f643f94228393558df897dfcf3a81cb
BLAKE2b-256 c98cc04820c519a1d1bad45bfa41a3c190b521e5b711b65368b8fb0db3a632a3

See more details on using hashes here.

File details

Details for the file uncomment-2.1.17-py3-none-any.whl.

File metadata

  • Download URL: uncomment-2.1.17-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for uncomment-2.1.17-py3-none-any.whl
Algorithm Hash digest
SHA256 710e541ff0896d247a1b6790e8918c03f147d3f90cc6d5812c1f9b303eca53ca
MD5 4c75a5770347d359855344812d4ef75d
BLAKE2b-256 a55419c63e891180ee5882fa313e6cb6c7d8a3b575b194d98c06d0b95a3e5e21

See more details on using hashes here.

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