Skip to main content

A fast Rust-based CLI tool for removing comments from source code

Project description

uncomment

PyPI version MIT License

A blazing fast Rust-based command-line tool that removes comments from your source code. Perfect for cleaning up AI-generated code that comes with excessive explanations.

Why Use This?

  • 🚀 Lightning Fast - Built in Rust for maximum performance
  • 🎯 100% Accurate - Never accidentally removes code that looks like comments
  • 🛡️ Safe by Default - Preview changes before applying them
  • 🌍 Multi-language - Supports Python, JS, TS, Rust, Go, Java, C/C++, and more
  • 🔧 Zero Dependencies - Downloads a self-contained binary

Installation

pip install uncomment

The installer will automatically download the appropriate pre-compiled Rust binary for your platform (Windows, macOS, or Linux).

Quick Start

Remove comments from a single file:

uncomment main.py

Preview changes without modifying files:

uncomment --dry-run src/

Process all Python files in a directory:

uncomment "src/**/*.py"

Key Features

Smart Comment Detection

Unlike simple regex-based tools, uncomment understands your code's structure:

# This comment will be removed
code = "# But this won't - it's in a string!"

Preserves Important Comments

Keeps what matters:

  • TODO and FIXME comments (configurable)
  • License headers and copyright notices
  • Linting directives (# noqa, # type: ignore, etc.)
  • Docstrings (configurable)

Perfect for Python Projects

  • Handles all Python comment styles
  • Preserves type hints and annotations
  • Respects # pylint:, # flake8:, and other linter directives
  • Works with .py, .pyw, .pyi, .pyx, and .pxd files

Common Use Cases

Clean up AI-generated code:

uncomment generated_script.py

Remove all comments including TODOs:

uncomment --remove-todo --remove-fixme module.py

Remove docstrings:

uncomment --remove-doc api.py

Process entire packages:

uncomment my_package/

Use multiple threads for large codebases:

uncomment --threads 8 entire_project/

Supported Languages

While this tool works great for Python, it also supports: JavaScript, TypeScript, Rust, Go, Java, C/C++, Ruby, YAML, Terraform/HCL, Makefile, and more!

Documentation

For detailed documentation, advanced options, and examples, visit: https://github.com/Goldziher/uncomment

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.9.1.tar.gz (4.7 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.9.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for uncomment-2.9.1.tar.gz
Algorithm Hash digest
SHA256 3c70f25cd36671af8ee61e1c3f3f44d31b1b3208b4230495021521f89af3f580
MD5 6dad8819861a9ab6ca9a0fbfa2f80f71
BLAKE2b-256 6f5054c257325f6a63e9b817f5e3ad9853d1a5ca1adacf01870a54e9d7eec4fc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: uncomment-2.9.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 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.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 21c443743d410b5d3b4ad0255fd7e27aa176f7ab07d773b46299b2965cf2c330
MD5 7db7a24ed1c4c4440f0098aa157abe97
BLAKE2b-256 356dd6ae901c2605a7d663f1af21893a6a0b7ec21ac254e9fa9274856a6fa07a

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