Python Import Cleaner is a powerful and intelligent VS Code extension designed to automatically detect and remove all unused imports in your Python projects.
No prompts, no backups—just clean, readable, and maintainable code in seconds.
Crafted by Mehdi Afzali, this tool is perfect for developers who want to keep their Python projects organized and efficient.
⚡ Key Features
✅ Automatic Cleanup: Removes unused imports across the entire workspace.
🔄 All Python Files: Scans and processes every .py file in your project without manual selection.
📊 Interactive Progress Bar: Displays live updates, including which file is being processed and how many imports are removed.
🚀 Scale-Friendly: Efficient for small projects or massive workspaces with dozens or hundreds of Python files.
🐍 Dynamic Python Path: Automatically detects your Python interpreter from VS Code settings.
🔧 Safe & Clean: No backup files are created, and your code structure remains untouched.
🛠 How to Use
Install the extension from the VS Code Marketplace or a .vsix file.
Open your Python project in VS Code.
Open the Command Palette (Ctrl+Shift+P) → search for "Clean All Unused Imports (Workspace)"
Click the command.
Watch the Progress Bar update live as Python Import Cleaner removes unused imports.
Once complete, a notification will show the total number of imports removed.
💡 Why Use Python Import Cleaner?
Keep your code clean, organized, and readable
Reduce errors caused by unused or unnecessary imports
Boost maintainability and performance of your Python projects
Save time—especially in large projects with many files
📌 Important Notes
Only unused imports are removed; your project logic remains intact.
Python path is automatically determined from VS Code Python extension or falls back to "python".
Best practice: commit your project before running the cleaner, just in case you need to revert changes.
🙌 Credits
Developed with care by Mehdi Afzali.
This extension reflects a focus on smart, practical, and time-saving tools for Python developers.
📝 Changelog (v1.0.0)
Initial release with workspace-wide cleanup
Interactive Progress Bar for real-time feedback
Supports multiple files simultaneously
Live reporting of removed imports in Console and Notification