A Python package to remove comments from Python code.
Project description
📜 CommentBeGone
Do you have too many comments? Can’t see the forest for the comments? Or maybe your code is as chatty as that one friend who always leaves voice notes? Introducing CommentBeGone – the revolutionary Python package that puts your comments in their place: nowhere.
Why CommentBeGone?
Let’s face it – comments are great, until they aren’t:
- Too many “I’ll explain this later” notes? Later is now.
- Confusing inline comments? Your
ifstatements deserve a little peace and quiet. - Random comments in YAML files that aren’t helping anyone? Say goodbye.
With CommentBeGone, your code can finally look as mysterious as you always wanted it to be!
What It Does
CommentBeGone purges comments from your Python and YAML files so you can send cleaner code to your coworkers, or impress hiring managers with a mysterious sense of minimalism.
Install
pip install commentbegone
Requires Python 3.8+. Will probably not work on ancient computers or quantum systems.
Usage
Want to rid your file of those pesky comments? Just call CommentBeGone from the command line.
commentbegone your_code.py no_more_comments.py
Or for YAML files:
commentbegone configs.yaml clean_configs.yaml
Poof! Your comments are gone, and your file is ready for a quieter tomorrow.
Advanced Example
Let’s say you have a file, chatty_code.py, with this noisy mess:
# This function adds two numbers
def add(a, b):
return a + b # Returns the sum of two numbers, obviously
Just run:
commentbegone chatty_code.py silent_code.py
And in silent_code.py you’ll find:
def add(a, b):
return a + b
Pure, mysterious code – just like nature intended.
How It Works
"How does it know the difference between escaped and unescaped hashes?" –You
Good question! CommentBeGone uses regex sorcery to differentiate real comments from innocent hashes. We make sure those escaped # symbols in strings stay untouched. It’s a magical balance of regex and Python wizardry.
Contributing
Found a way to silence even more comments? Or maybe you’ve written some code that needs more comments removed? Either way, submit a PR, open an issue, or shout into the void – we might hear you.
License
MIT – use responsibly. (No, it won’t work on your boss’s emails.)
Enjoy a quieter codebase with CommentBeGone – because code is meant to be read... by the very brave.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file commentbegone-1.0.2.tar.gz.
File metadata
- Download URL: commentbegone-1.0.2.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b4612d8ce1aaf0baf47d9965736007ddcbe9c645e5d70095e6603f3865dde84
|
|
| MD5 |
54ae4b1773add5dc25d8cd983f72fe4a
|
|
| BLAKE2b-256 |
e733aa3664efa7ad06742330f5a4ac65dfaa1bacc753f5c42b8bfe18acd249f1
|
File details
Details for the file commentbegone-1.0.2-py3-none-any.whl.
File metadata
- Download URL: commentbegone-1.0.2-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be1411931d93916063519696807c0eea0331344b91a837ce51d2251280eaa0ae
|
|
| MD5 |
33e7562c243cf7b6ee208dc900de3731
|
|
| BLAKE2b-256 |
892d9a029db61bda7d58f1bd2efded1121426504a7ca3d276e7b47836624cb18
|