I am giving PyCharm a try for the first time. Coming from an Eclipse/PyDev environment I have to say so far things have been going well.
There is one feature I am missing that I can't seem to find though and that is as follows:
In the auto-complete list in PyDev, when typing a symbol that doesn't exist in the file's scope it will show a list of modules that it's in. If you select that autocomplete item not only will PyDev complete the symbol for you but it will automatically add the import statement to take care of the dependency as well.
Does this exist in PyCharm?
So far it only seems to autocomplete things already in the scope of the document.
Go to Settings / Preferences | Editor | General | Postfix Completion and select the Enable postfix completion checkbox.
PyCharm can do both. Type the name of the package and hit Alt-Enter , then choose Install and Import package . PyCharm will do both: you'll see a notification during the installation, then the import will be generated in the right way, according to your project styles.
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.
In the Settings/Preferences dialog ( Ctrl+Alt+S ), click Editor | General | Auto Import. In the Python section, configure automatic imports: Select Show import popup to automatically display an import popup when tying the name of a class that lacks an import statement.
See Settings | Editor | General | Auto Import.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With