Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Python Import CleanerNew to Visual Studio Code? Get it now.
Python Import Cleaner

Python Import Cleaner

Mehdi Afzali

|
62 installs
| (0) | Free
Clean unused imports in all Python files in the workspace.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Python Import Cleaner

Version 1.0.0
Author: Mehdi Afzali


🌟 Overview

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

  1. Install the extension from the VS Code Marketplace or a .vsix file.
  2. Open your Python project in VS Code.
  3. Open the Command Palette (Ctrl+Shift+P) → search for "Clean All Unused Imports (Workspace)"
  4. Click the command.
  5. Watch the Progress Bar update live as Python Import Cleaner removes unused imports.
  6. 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

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft