Optimize Imports

Automate the organizing and cleaning up of your Python imports with Optimize Imports.

PyCharm automates many "gardening" tasks when writing Python code. Managing your imports is one of them: with the Optimize Imports action, PyCharm cleans up your imports, using your import style preferences.

For example, Python's PEP 8 section on import style might complain that you have an unused imports, your imports aren't sorted within a group, and you have two top-level imports on the same line. Also, you might set in a project that you'd like to always split imports from the same source.

PyCharm can clean all of that up using Optimize Imports, which cleans up your imports based on settings you can save. This action can be run on a single file or across all files in a project. Also, the Commit dialog box has a checkbox to run it in the Before Commit section.

Finally, PyCharm Professional applies all of this to imports in other languages such as JavaScript and TypeScript.


Related Resources

Generate Imports While Typing
Avoid interruption by letting PyCharm generate your imports as you type.
Introduction
Breaking Barriers - Revolutionizing Development through Remote Collaboration
Running applications in GKE
Running Applications and Securing Domains with SSL Certificates in GKE