python-notes-remover README
A Visual Studio Code extension for managing Python comments.
This extension helps you check and remove comments from Python files or directories, only using python build-in functions(AST and tokenize).
Count or remove Python comments (docstrings; single-line; multi-line; inline, etc.), supporting single files and folders. Used for regenerating comments for AI, translating comments, or simply reducing code volume.
Features

- Analyze Python files or entire directories to identify comments
- View detailed reports of comment usage
- Get insights into comment patterns in your codebase

- Safely remove comments from Python files while preserving functionality
- Automatic backup creation before any modifications
- Integrated diff viewer to review changes before accepting them
- Support for both individual files and entire directories
📊 Change Reporting

- Generate comprehensive change reports after comment removal
- Visual diff comparisons between original and modified files
- Backup file management and restoration capabilities
Requirements
Python 3.12 or later.
Usage
Using Command Palette
- Open a Python file or select a directory in Explorer
- Press
Ctrl+Shift+P to open Command Palette
- Choose one of the following commands:
- Python Notes Manager: Check Comments - Analyze comments in selected file/directory
- Python Notes Manager: Remove Comments - Remove comments from selected file/directory
- Right-click on a Python file or directory in Explorer
- Select either:
- Check Python Comments
- Remove Python Comments
Output Panel
After running any command, check the Output Panel (View → Output) and select "Python Notes Manager" from the dropdown to see detailed execution logs and results.
Configuration
The extension works out of the box with default settings. For advanced configuration, you can modify these settings in VS Code preferences:
pythonNotesManager.pythonPath: Custom Python interpreter path
pythonNotesManager.backupLocation: Custom backup directory
Features in Detail
- Identifies all types of Python comments (single-line, multi-line, inline)
- Provides statistics on comment density
- Highlights potential issues with commented code
- Creates
.bak backup files before modification
- Preserves code functionality and structure
- Supports incremental processing for large codebases
Change Management
- Side-by-side diff views for easy comparison
- Detailed change reports with timestamps
- Option to restore from backups if needed
Supported File Types
.py files (Python source files)
- Directories containing Python files
- Recursive directory processing
Troubleshooting
Common Issues
Python not found
- Ensure Python is installed and in your system PATH
- Check the Output Panel for specific error messages
Permission errors
- Make sure you have write permissions for the target files/directories
- Run VS Code as administrator if needed (Windows)
Backup files not found
- Backup files are created in the same directory as original files with
.bak extension
- Use system search to locate backup files if needed
Getting Help
If you encounter any issues:
- Check the Output Panel for detailed error information
- Ensure your Python environment is properly configured
- Verify file and directory permissions
- Create an issue on our GitHub repository with:
- Error message from Output Panel
- Steps to reproduce
- Your environment details (OS, Python version, VS Code version)
Release Notes
Users appreciate release notes as you update your extension.
0.1.0
- Initial release with comment checking and removal features
- Support for individual files and directory processing
- Integrated diff viewer and change reporting
- Backup and restoration capabilities
Contributing
We welcome contributions! Please see our contributing guidelines for more information.
License
This extension is licensed under the GPL v3.0 License.
Enjoy cleaner Python code! 🐍✨