Skip to main content

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 - 49 built-in languages, 306 available via tree-sitter-language-pack
  • 🔧 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: 49 built-in languages including JavaScript, TypeScript, Rust, Go, Java, C/C++, Ruby, Dockerfile, Scala, Dart, and many more. 306 total languages available via tree-sitter-language-pack.

Documentation

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

License

MIT - see LICENSE for 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-3.3.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

uncomment-3.3.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for uncomment-3.3.0.tar.gz
Algorithm Hash digest
SHA256 ae3a9f7a0186a4175d21fc798ced650d57ee38184b5fd257a0374a1f69696c8d
MD5 10c82e8ec57cf01452d5ad86d185df07
BLAKE2b-256 fb264dd135e24a94918074b4d4d6e674eb95c209017c5b49d322e0d279804868

See more details on using hashes here.

Provenance

The following attestation bundles were made for uncomment-3.3.0.tar.gz:

Publisher: publish.yaml on Goldziher/uncomment

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

File details

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

File metadata

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

File hashes

Hashes for uncomment-3.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ec9f4ecb7ebe192480d6580165b73e87d6841695011e7a8cce2906cd2d8e88e
MD5 47184e0270342dbb392b657974feaa1f
BLAKE2b-256 5df1e16b1697237573dd9c1ea83cc0fbb392057f5aed913b8489376eadff15fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for uncomment-3.3.0-py3-none-any.whl:

Publisher: publish.yaml on Goldziher/uncomment

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 Sentry Error logging StatusPage Status page